Ü SUB (Subtract)
·
This op-code adds
factor-1 with factor-2 to place the difference in result field.
·
It can be used for
packed, signed, binary, integer, array element, and subfield.
·
For DATE, TIME, and
TIMESTAMP values, the SUBDUR operation is used.
·
The H operation extender can be specified to cause the
result to be half-adjusted—that is, rounded up.
Factor 1
|
OpCode
|
Factor 2
|
Result Field
|
Resulting Indicators
HI LO EQ
|
Numeric value 1
|
SUB(H)
|
Numeric value 2
|
Difference of value1 from
value2
|
Result > 0
|
Result < 0
|
Result >=0
|
Example
Columns . . . : 6 80 Browse AMINEM/QRPGLESRC
SEU==> OP_SUB
FMT D DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 Da S 2 0 INZ(11) 130125
0002.00 Db S 2 0 INZ(22) 130125
0003.00 Dc S 2 0 INZ(0) 130125
0004.00 Dd S 2 0 INZ(0) 130125
0005.00 C b SUB a c 414243 130130
0006.00 C SUB a d 515253 130130
0007.00 C SUB 11 a 616263 130130
0008.00 C c DSPLY 130125
0009.00 C *In41 DSPLY 130130
0010.00 C *In42 DSPLY 130130
0011.00 C *In43 DSPLY 130130
0012.00 C d DSPLY 130125
0013.00 C *In51 DSPLY 130130
0014.00 C *In52 DSPLY 130130
0015.00 C *In53 DSPLY 130130
0016.00 C a DSPLY 130125
0017.00 C *In61 DSPLY 130130
0018.00 C *In62 DSPLY 130130
0019.00 C *In63 DSPLY 130130
0020.00 C SETON LR 130125
****************** End of data *******************************************************
OUTPUT
DSPLY 11
DSPLY 1
DSPLY 0
DSPLY 0
DSPLY 11-
DSPLY 0
DSPLY 1
DSPLY 0
DSPLY 0
DSPLY 0
DSPLY 0
DSPLY 1