Image description: passing BY REFERENCE, BY CONTENT, and BY VALUE
The following code excerpt is used to explain the different ways to pass data.
MOVE 16 TO X.
CALL ABC USING
BY REFERENCE X
BY CONTENT X
BY VALUE X
BY CONTENT ADDRESS OF X
Register 1 contains the memory address of the parameter list. The parameter list has four entries, one for each instance of data item X in the order that X is passed in the CALL statement.
The first entry illustrates passing by reference: the parameter list contains a pointer to the memory address of X in the WORKING-STORAGE of the calling program.
The second entry illustrates passing by content: the parameter list contains a pointer to a copy of data item X in temporary storage.
The third entry illustrates passing by value: the parameter list contains the content of data item X (decimal value 16 in the code sample).
The fourth entry illustrates passing the address of data item X by content: the parameter list contains a pointer to memory in temporary storage. That memory contains the address of data item X.
End of image description.