RPG/400 Help

Arithmetic Operations Examples

Figure 3. Summary of Arithmetic Operations

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++*
C*  Before the operations are processed, the field values are:
C*       A = 1.00       G = 2.77
C*       B = 10.0       H = 70
C*       C = 32         J = .6
C*       D = -20        K = 25
C*       E = 6.         L = 1.0, 1.7, -1.1              RESULTS
C*       F = 10.0                                       -------
C                     ADD  1         A       30         002
C           B         ADD  C         V       52         042.00
C           B         ADD  D         V                  -10.00
C*
C                     Z-ADDC         V                  032.00
C*
C                     SUB  1         E       30         005
C           C         SUB  B         W       51         0022.0
C           C         SUB  D         W                  0052.0
C*
C                     Z-SUBC         W                  -0032.0
C*
C                     MULT E         F       30         060
C           B         MULT G         X       84         0027.7000
C           B         MULT D         X                  -200.0000
C*
C                     DIV  B         H       30         007
C           C         DIV  J         Y       62         0053.33
C*
C                     MVR            Z       53         00.020
C*
C                     SQRT K         Z                  05.000
C*
C                     XFOOTL         Z                  01.600


[ Top of Page | Previous Page | Next Page | Table of Contents ]