(Area 3)
The SUBTRACT command algebraically subtracts a specified numeric constant or the contents of a predefined field from another predefined numeric field.
The format of the SUBTRACT command is as follows:
►►─┬──────────┬─ SUBTRACT ─┬─ fieldname1 ───────┬─┬────────┬─ fieldname2 ─────► └─ label: ─┘ └─ numeric constant ─┘ └─ FROM ─┘ ►─┬───────────────────────────┬─┬─────────┬──────────────────────────────────►◄ └─┬──────────┬─ fieldname3 ─┘ └─ ROUND ─┘ └─ GIVING ─┘
Specifies an optional identifying label, referenced within a GOTO command, that allows a GOTO branch to be made to this statement.
Specifies the name given a predefined numeric field whose value represents 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.
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.
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)
SUBTRACT 2 FROM FIELD1 121.45 nc nc nc
SUBTRACT FIELD3 FROM INDEX nc nc nc 9
SUBTRACT FIELD1 FROM
FIELD2 GIVING FIELD3 nc nc -118.0179 nc
SUBTRACT -1.5 FROM FIELD1 124.95 nc nc nc
SUBTRACT 3 FROM FIELD2
GIVING FIELD3 nc nc 2.4321 nc
SUBTRACT INDEX FROM INDEX nc nc nc 0
SUBTRACT INDEX FROM FIELD3 nc nc -9.0000 nc
SUBTRACT FIELD2 INDEX FIELD2 nc 4.5679 nc nc
SUBTRACT FIELD2 FROM INDEX nc nc nc 4
SUBTRACT 16 FROM INDEX nc nc nc -6
SUBTRACT +.92 FROM FIELD1 122.53 nc nc nc
SUBTRACT .333 FROM FIELD2 nc 5.0991 nc nc
Note the following:
|
Copyright © 2014 CA.
All rights reserved.
|
|