(Area 3)
The DIVIDE command algebraically divides a predefined numeric field by a specified numeric constant or the contents of another predefined numeric field.
The format of the DIVIDE command is as follows:
►►─┬──────────┬─ DIVIDE ─ fieldname1 ─┬──────┬─┬─ fieldname2 ───────┬─────────► └─ label: ─┘ └─ BY ─┘ └─ numeric constant ─┘ ►─┬───────────────────────────┬─┬─────────┬──────────────────────────────────►◄ └─┬──────────┬─ fieldname3 ─┘ └─ ROUND ─┘ └─ GIVING ─┘
Specifies an optional identifying label that allows a GOTO branch to be made to this statement.
Specifies a predefined numeric field whose value represents the dividend for the division 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 divisor for the division of two variables. Predefine it as zoned decimal, packed decimal, binary, or unsigned binary.
Specifies an absolute numeric constant to be used as the divisor in the calculation. It can be any valid numeric literal.
Specifies a predefined numeric field in which the quotient is placed. Predefine it 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 fieldname: FIELD1 FIELD2 FIELD3 INDEX
Numeric precision: 3.2 1.4 3.4 2.0
Initial value of field: (246.90) (6.0000) (zero) (32)
DIVIDE FIELD1 BY 2 123.45 nc nc nc
DIVIDE FIELD2 BY INDEX nc 0.1875 nc nc
DIVIDE FIELD1 BY FIELD2
GIVING FIELD3 nc nc 41.1500 nc
DIVIDE FIELD1 BY -24 -10.28 nc nc nc
DIVIDE FIELD2 BY 3
GIVING FIELD3 nc nc 2.0000 nc
DIVIDE FIELD1 BY FIELD1 1.00 nc nc nc
DIVIDE FIELD3 BY INDEX nc nc 0.0000 nc
DIVIDE FIELD1 INDEX FIELD2 nc 7.7156 nc nc
DIVIDE INDEX BY FIELD2 nc nc nc 5
DIVIDE INDEX BY 16 nc nc nc 2
DIVIDE FIELD1 BY +.92 268.36 nc nc nc
DIVIDE FIELD2 BY .333 nc 8.0180 nc nc
Note the following:
|
Copyright © 2014 CA.
All rights reserved.
|
|