Describing parameters in the called program
You must know what data is
being passed from the calling
program and describe it in the LINKAGE SECTION
of
each program that is called directly or indirectly by the calling
program.
Code the USING
phrase
after the PROCEDURE DIVISION
header to name the parameters
that receive the data that is passed from the calling program.
When arguments are passed
to the subprogram BY REFERENCE
, it is invalid for
the subprogram to specify any relationship between its parameters
and any fields other than those that are passed and defined in the
main program. The subprogram must not:
- Define a parameter to be larger in total number of bytes than the corresponding argument.
- Use subscript references to refer to elements beyond the limits of tables that are passed as arguments by the calling program.
- Use reference modification to access data beyond the length of defined parameters.
- Manipulate the address of a parameter in order to access other data items that are defined in the calling program.
If any of the rules above are violated, unexpected results might occur.