BY REFERENCE Phrase
The value of a parameter passed through the BY REFERENCE phrase is evaluated when the CALL statement runs. This value is assigned to the corresponding parameter of the called program. The number of characters in each parameter must be equal; however, the data descriptions need not be the same.
When an ILE COBOL parameter is passed BY REFERENCE, a pointer to the original data item passes to the called program. Because of this, a change to a parameter in a called program will result in a change to a data item in a calling program.
- identifier-2
- Must be defined as a level-01, level-77, or elementary
data item in the File, Working-Storage, Local-Storage or Linkage Sections. Must not be a function-identifier.
IBM ExtensionIBM Extension It can be a:
- Data item of any level in the Data Division
- Pointer data item (an item defined implicitly or explicitly as USAGE IS POINTER)
- Procedure-pointer data item
- DBCS data item
- National data item
- Floating-point data item
- Date-time data item.
End of IBM Extension
IBM Extension
IBM Extension
- ADDRESS OF special register
- For information about this special register, see page ADDRESS OF Special Register. Note that the calculated ADDRESS OF is not allowed in this case.
- file-name-1
- Must appear in an FD entry. It passes a null pointer data item.
- OMITTED
- For standard parameters when a parameter is passed BY REFERENCE, a pointer
to the original data item is passed to the called program. When OMITTED is
specified, a NULL pointer is passed to the called program. In this case,
the called program will use its default value.
OMITTED can only be specified on calls to programs with a LINKAGE TYPE of procedure.
End of IBM Extension