Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Main program's working storage section variable's contents are moved to the sub program's linkage section variables(ie.,parameter passing using CALL). Linkage section can also get value through PARM parameter.
Main pgm:
WORKING-STORAGE SECTION.
77 A PIC 9 VALUE 9.
77 B PIC 9 VALUE 8.
77 C PIC 99.
PROCEDURE DIVISION.
PARA.
....
CALL SUB USING A,B,C.
DISPLAY C.
.....
Sub pgm:
LINKAGE SECTION.
77 X PIC 9.
77 Y PIC 9.
77 Z PIC 99.
PROCEDURE DIVISION USING X,Y,Z.
....
COMPUTE Z = X - Y.
.....
output:1
Also if the sub pgm has working storage variables by itself then those values can be moved to it's own linkage section variables (though automatically it receives value from the calling pgm)during calculation.
I hope it doesn't confuse...
Regards,
Sridevi |
|