Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.4 CALL Statement



The CALL statement transfers control from one object program to another within the run unit.

The program containing the CALL statement is the calling program; the program identified in the CALL statement is the called subprogram. Called programs can contain CALL statements; however, a called program must not execute a CALL statement that directly or indirectly calls the calling program.


X Programs defined with the RECURSIVE attribute can execute a CALL statement
X that directly or indirectly CALLs itself.


X Do not specify the name of a class or a method in the CALL statement.


    ___ Format _______________________________________________________________________________________ 
   |                                                                                                  |
   | >>__CALL__ _identifier-1______ ________________________________________________________________> |
   |           |_literal-1_________|                                                                  |
   |           |_ procedure-ptr-1 _|                                                                  |
   |                                                                                                  |
   | >__ ______________________________________________________________________________ ____________> |
   |    |        <___________________________________________________________________  |              |
   |    |                                   <____________________________________    | |              |
   |    |_USING____ _ ___________________ ____ _ ______________ __identifier-2_ _|_ _|_|              |
   |               | |_ ____ __REFERENCE_|    | |_ ADDRESS OF _|               |   |                  |
   |               |   |_BY_|                 |               (1)              |   |                  |
   |               |                          |_ file-name-1 __________________|   |                  |
   |               |                          |_ OMITTED ______________________|   |                  |
   |               |                  <____________________________________        |                  |
   |               |_ ____ __CONTENT____ _ ______________ __identifier-3_ _|_______|                  |
   |               | |_BY_|             | |_ ADDRESS OF _|               |         |                  |
   |               |                    | |_ LENGTH OF __|               |         |                  |
   |               |                    |_ literal-2 ____________________|         |                  |
   |               |                    |_ OMITTED ______________________|         |                  |
   |               |                    <______________________________________    |                  |
   |               |_ ______ __ VALUE ____ _ ______________ __ identifier-4 _ _|___|                  |
   |                 |_ BY _|             | |_ ADDRESS OF _|                 |                        |
   |                                      | |_ LENGTH OF __|                 |                        |
   |                                      |_ literal-3 ______________________|                        |
   |                                                                                                  |
   | >__ _______________________________ __ ________________________________________________ _______> |
   |    |__ RETURNING __ identifier-5 __|  |_ __________________ __ ______________________ _|         |
   |                                       | |_| on_exception |_|  |_| not_on_exception |_| |         |
   |                                       |_ ____ __OVERFLOW__imperative-statement-3_______|         |
   |                                         |_ON_|                                                   |
   |                                                                                                  |
   | >__ __________ _______________________________________________________________________________>< |
   |    |_END-CALL_|                                                                                  |
   |                                                                                                  |
   | on_exception:                                                                                    |
   | |__ ___________________________________________ _______________________________________________| |
   |    |_ ____ __EXCEPTION__imperative-statement-1_|                                                 |
   |      |_ON_|                                                                                      |
   |                                                                                                  |
   | not_on_exception:                                                                                |
   | |__ ________________________________________________ __________________________________________| |
   |    |_NOT__ ____ __EXCEPTION__imperative-statement-2_|                                            |
   |           |_ON_|                                                                                 |
   |                                                                                                  |
   | Note:                                                                                            |
 X | (1)  File-name-1 is supported on OS/390 and VM only.                                             |
   |                                                                                                  |
   |__________________________________________________________________________________________________|

identifier-1, literal-1
Literal-1 must be a nonnumeric literal. Identifier-1 must be an alphanumeric data item such that its value can be a program name.


X The rules of formation for program names are dependent on the PGMNAME
X compiler option. For details, see the discussion of program names in
X "PROGRAM-ID Paragraph" in topic 3.1.1 and also the description of the
X PGMNAME compiler option in the IBM COBOL Programming Guide for your
X platform.


X Identifier-1 can be an alphabetic or zoned decimal data item.
X Identifier-1 cannot be a windowed date field.


X procedure-pointer-1

X Must be defined with USAGE IS PROCEDURE-POINTER, and must be set to a
X valid program entry point; otherwise, the results of the CALL
X statement are undefined.


X After a program has been canceled by COBOL, released by PL/I or C, or
X deleted by assembler, any procedure-pointers that had been set to that
X program's entry point are no longer valid.

When the called subprogram is to be entered at the beginning of the Procedure Division, literal-1 or the contents of identifier-1 must specify the program-name of the called subprogram.


X When the called subprogram is entered through an ENTRY statement,
X literal-1 or the contents of identifier-1 must be the same as the name
X specified in the called subprogram's ENTRY statement.

For information on how the compiler resolves CALLs to program names found in multiple programs, see "Conventions for Program-Names" in topic 2.1.1.1.

Subtopics:



Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.