When can the USING phrase be included in the call statement ?

Questions by sprabodhini

Showing Answers 1 - 6 of 6 Answers

  • The USING phrase makes data items defined in a calling program available to a called subprogram. The USING phrase is required only if the object program is to be invoked by a CALL statement and that statement includes a USING phrase.
  • Each USING identifier in a calling program names data items that are defined in any Data Division section.
  • An identifier may appear more than once in a Procedure Division USING phrase. The last value passed to it by a CALL USING statement is used.
  • Data items defined in the Linkage Section of the called program may be referenced within the Procedure Division of that program if, and only if, they satisfy one of the following conditions:
    • They are operands of the USING phrase of the Procedure Division header.
    • They are defined with a REDEFINES or RENAMES clause, the object of which satisfies the above conditions.
    • They are items subordinate to any item that satisfies the condition in the rules above.
    • They are condition-names or index-names associated with data items that satisfy any of the above conditions.

The USING phrase is valid with the following:

    • The Procedure Division header of a called subprogram:

      The USING phrase is valid in the Procedure Division header of a called subprogram entered at the beginning of the nondeclaratives portion; each USING identifier must be defined as a level-01 or level-77 item in the Linkage Section of the called subprogram; it must not contain a REDEFINES clause.

    • The CALL statement of a called subprogram:

      In a calling program, the USING phrase is valid for the CALL statement; each USING identifier must be defined as a level-01, level-77, or an elementary item in the Data Division. The maximum number of data-names that can be specified is 30.

      The USING phrase is specified in the Procedure Division header if, and only if, this program is a subprogram invoked by a CALL statement that itself contains a USING phrase. That is, for each CALL USING statement in a calling program, a corresponding USING phrase must be specified in a called subprogram.

      The identifiers specified in a CALL USING statement name data items available to the calling program that may be referred to in the called program; a given identifier may appear more than once. These items are defined in any Data Division section.

  Was this answer useful?  Yes

sangu.pd

  • Apr 27th, 2009
 

The using phrase will be coded along with the call statement in case any literal or address of the value is to be passed to the called program. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions