(Area 3)
The DECREMENT command algebraically decrements the contents of a predefined numeric field by a specified numeric value or the contents of another predefined numeric field. DECR or REDUCE can be used in place of DECREMENT.
The format of the DECREMENT commands follows:
►►─┬────────────────┬─┬─ DECR ──────┬─ fieldname1 ─┬──────┬───────────────────► └─ label: ───────┘ ├─ DECREMENT ─┤ └─ BY ─┘ └─ REDUCE ────┘ ►─┬─ fieldname2 ───────┬─┬───────────────────────────┬─┬─────────┬───────────►◄ └─ numeric constant ─┘ └─┬──────────┬─ fieldname3 ─┘ └─ ROUND ─┘ └─ GIVING ─┘
Specifies an optional identifying label that allows a GOTO branch to be made to this statement.
Specifies the name given a predefined numeric field whose value represents the minuend for the subtraction of two variables. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.
Specifies the name given a predefined numeric field whose value is to be used as the subtrahend for the subtraction of two variables. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary..
Specifies an absolute numeric constant to be used as the subtrahend in the calculation. It can be any valid numeric literal.
Optionally specifies a predefined numeric field in which the difference is placed. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.
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)
DECREMENT INDEX BY 1 nc nc nc 9
DECREMENT INDEX BY FIELD3 nc nc nc 9
DECREMENT FIELD1 BY FIELD2
GIVING FIELD3 nc nc 118.0179 nc
DECR FIELD1 BY -1.5 124.95 nc nc nc
DECREMENT INDEX BY FIELD2
GIVING FIELD3 nc nc 4.5679 nc
REDUCE INDEX BY INDEX nc nc nc 0
REDUCE FIELD3 BY 10 nc nc -9.0000 nc
DECREMENT FIELD3 INDEX INDEX nc nc nc -9
DECREMENT FIELD2 BY FIELD3 nc 4.4321 nc nc
DECREMENT INDEX BY 2.93 nc nc nc 7
DECR FIELD1 BY +.92 122.53 nc nc nc
REDUCE FIELD2 BY .333 nc 5.0991 nc nc
Note the following:
|
Copyright © 2014 CA.
All rights reserved.
|
|