USING Phrase
Included in the CALL statement when parameters need to be passed to the
called subprogram.
If the called subprogram is written in COBOL, it must contain a USING phrase in its Procedure
Division header.
The number of operands in both USING phrases must be identical.
For CALL statements with a LINKAGE TYPE of program the maximum number of operands
is 255, and for LINKAGE TYPE of procedure the maximum number of operands is
16,382.
The sequence of identifiers in the USING phrase of the CALL statement and in the corresponding USING phrase in the called subprogram's Procedure Division header determines the correspondence between the identifiers used by the calling and called programs. This correspondence is by position, rather than by name. For more information about the USING phrase, see The USING Phrase.
The attributes of the data passed depend on the requirements of the called subprogram. If a called program requires several parameters, you must specify the identity of each parameter, rather than a group item that consists of the parameters.
IBM Extension Some procedures (for example, the ILE CEEDATE and CEEDAYS APIs) require that the operational descriptor of one or more parameters is made available. This requirement must be satisfied by including, in the SPECIAL-NAMES paragraph, a LINKAGE TYPE clause for the procedure with a USING phrase that specifies the appropriate parameter. In addition, any such parameter must be defined as an elementary data item with a USAGE of DISPLAY or DISPLAY-1, and it may not be reference modified. End of IBM Extension
The values of the parameters referenced in the USING phrase of the CALL statement are made available to the called subprogram at the time the CALL statement is executed.
| Calling Program Description (PGMA) | Called Program Description (PGMB) |
|---|---|
|
|