Previous Topic: GOTO CommandNext Topic: LIBRARY Command


INCREMENT Command

(Area 3)

The INCREMENT command algebraically increments a predefined numeric field by a specified numeric constant or the contents of another predefined numeric field. INCR or UP can be used in place of INCREMENT. The format of the INCREMENT command is as follows:

►►─┬──────────┬─┬─ INCREMENT ─┬─ fieldname1 ─┬──────┬─────────────────────────►
   └─ label: ─┘ └─ UP ────────┘              └─ BY ─┘

 ►─┬─ fieldname2 ───────┬─┬───────────────────────────┬─┬─────────┬───────────►◄
   └─ numeric constant ─┘ └─┬──────────┬─ fieldname3 ─┘ └─ ROUND ─┘
                            └─ GIVING ─┘
label:

Specifies an optional identifying label, referenced within a GOTO command, that allows a GOTO branch to be made to this statement.

fieldname1

Specifies the name given to the predefined numeric field whose value is to be used as the base for the addition of two variables. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

fieldname2

Specifies the name given to the predefined numeric field whose value is to be added to the value in fieldname1. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

numeric constant

Specifies an absolute numeric constant to add to fieldname1.

fieldname3

Optionally specifies the predefined numeric field in which the sum is placed. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

ROUND

Optionally defines whether the result will be rounded before being placed into the result field. For rounding to occur, the computed value must have more decimal places than the result field. The default is not to round.

Example

            Predefined field name:    FIELD1    FIELD2    FIELD3    INDEX
		   Numeric precision:      3.2       1.4       3.4      2.0
           Initial value of field:   (123.45)  (5.4321)     (1)      (10)
     INCREMENT INDEX BY 1                nc        nc         nc       11
     INCREMENT INDEX BY FIELD3           nc        nc         nc       11
     INCREMENT FIELD1 BY FIELD2
          GIVING FIELD3                  nc        nc   128.8821       nc
     INCR FIELD1 by -1.5             121.95        nc         nc       mc
     INCREMENT INDEX BY FIELD2
          GIVING FIELD3                  nc        nc    15.4321       nc
     UP INDEX BY INDEX                   nc        nc         nc       20
     UP INDEX BY 10                      nc        nc    11.0000       nc
     INCREMENT FIELD3 INDEX INDEX        nc        nc         nc       11
     INCREMENT FIELD2 BY FIELD3          nc    6.4321         nc       nc
     INCREMENT INDEX BY 2.93             nc        nc         nc       12
     INCR FIELD1 BY +.92             124.37        nc         nc       nc
     UP FIELD2 BY .333                   nc    5.7651         nc       nc

Note the following: