Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
Good Monday maheshk84,
The answers to Q#1 are: NO, Maybe, But you won?t like it.
NO ? For each using and linkage 01 in the Called program you need to have a corresponding argument in the calling program. The pointers for the linkage 01?s are set to the working storage area in the calling programs working storage.
The linkage section PIC 9(6) will look at 6 contiguous bytes from the storage pointer. If the DD,MM,YY are not in contiguous storage it will not pick up the date you expect.
Maybe ? If the DD,MM,YY are in contiguous storage the linkage PIC 9(6) will pick up the date, but this is dangerous.
But you won?t like it ? When the Calling program calls the subroutine with augments, the location of the NSI (Next Sequential Instruction) is based on the number of arguments in the argument list. If the Calling and Called programs do not match, the Called program will return control to the incorrect address in the Calling program.
The answer to Q#2. You need both, they must correspond to each other. i.e. the first 01 in the linkage section MUST correspond the first USING on the PROCEDURE DIVISION, the second to the second, etc. AND they must correspond to the arguments in the Calling program.