GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Mainframe

 Print  |  
Question:  When can the USING phrase be included in the call statement ?



July 07, 2008 04:45:04 #1
 shrutimehendiratta   Member Since: July 2008    Total Comments: 1 

RE: When can the USING phrase be included in the call statement ?
 
  • 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.

     

 

Back To Question