PROGRAM FOR ADD VERB:
We have to write a simple program to elaborate the ADD verb. You can also use edit characters in the program.
Identification division.
Program- id. Addverb.
Environment division.
Data division.
Working-storage section.
77 a pic s9(3)v9(2) value 0.
77 b pic s9(3)v9(2) value 0.
77 c pic s9(4)v9(2) value 0.
77 e-c pic +z(4).z(2).
Procedure division.
Para-1.
Identification division.
program- id. Add verb.
environment division.
data division.
working - storage section.
77 A PIC S9(3) V9(2)
77 B PIC S9(3) V9(2)
77 C PIC S9(4) V9(2)
77 e-a PIC +z(4) Value 0
PROCEDURE DIVISION
PARA - 1
Description: This program gets 2 inputs from the user.
It adds them by using the ADD verb.
c=a+b
The unedited outcome is available in c.
We move c to e-c, where the edit characters are available.
Note that the variable e-c makes the use of the + edit character.
The e-c will always be exhibited with result.