ILE COBOL Programmer's Guide
When calling another ILE COBOL program that is not in the same module
object as the calling program and the call is made through a CALL
literal statement, you must specify whether the called program is an
ILE program object or an ILE procedure.
You identify whether you are calling a program object or a procedure by
specifying the linkage type of the call.
The LINKAGE type of call can be specified explicitly or it can be forced by
specifying a phrase that is associated with a particular linkage. For
example, the IN LIBRARY phrase forces a call to be a LINKAGE program.
In the instances where there is not a phrase that forces a linkage, there are
three ways to explicitly specify a linkage. They are listed in order of
precedence:
- The LINKAGE phrase of the CALL, CANCEL, or SET...ENTRY statements
- To call or cancel a program object, specify LINKAGE TYPE IS PROGRAM in the
CALL, CANCEL, or SET...ENTRY statement.
PROCEDURE DIVISION.
·
·
·
CALL LINKAGE TYPE IS PROGRAM literal-1
·
·
·
CALL LINKAGE PROGRAM literal-2 IN LIBRARY literal-3
·
·
·
CANCEL LINKAGE PROGRAM literal-2 IN LIBRARY literal-3
·
·
·
CANCEL LINKAGE TYPE IS PROGRAM literal-1
- To call or cancel a procedure, specify LINKAGE TYPE IS PROCEDURE in the
CALL, CANCEL statement, or SET...ENTRY statement. The IN LIBRARY
phrase cannot be specified for a CALL, CANCEL, or a SET statement with a
LINKAGE TYPE IS PROCEDURE phrase. The IN LIBRARY phrase is used to
specify an OS/400 library name for a program object (*PGM).
PROCEDURE DIVISION.
·
·
·
CALL LINKAGE TYPE IS PROCEDURE literal-1
·
·
·
CANCEL LINKAGE TYPE IS PROCEDURE literal-1
- The LINKAGE TYPE clause of the SPECIAL-NAMES paragraph
- To call or cancel a program object, specify LINKAGE TYPE IS PROGRAM FOR
literal-1 in the SPECIAL-NAMES paragraph where literal-1
is the name of the program object you are calling. You do not need to
specify the LINKAGE TYPE keyword with the CALL, CANCEL, or SET...ENTRY
statement when the linkage has been defined in the SPECIAL-NAMES
paragraph.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
·
·
·
SPECIAL-NAMES.
LINKAGE TYPE IS PROGRAM FOR literal-1.
·
·
·
PROCEDURE DIVISION.
·
·
·
CALL literal-1.
·
·
·
CANCEL literal-1.
- To call or cancel a procedure, specify LINKAGE TYPE IS PROCEDURE FOR
literal-1 in the SPECIAL-NAMES paragraph where literal-1
is the name of the procedure you are calling. You do not need to
specify the LINKAGE TYPE phrase with the CALL, CANCEL, or SET...ENTRY
statement. When the linkage has been defined in the SPECIAL-NAMES
paragraph.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
·
·
·
SPECIAL-NAMES.
LINKAGE TYPE IS PROCEDURE FOR literal-1.
·
·
·
PROCEDURE DIVISION.
·
·
·
CALL literal-1.
·
·
·
CANCEL literal-1.
- the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands, or the
associated PROCESS statement option.
- The LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands allows you
to specify, at compile time, the linkage type for all external CALL
literal-1, CANCEL literal-1, or SET
procedure-pointer-data-item TO ENTRY literal-1
statements in the ILE COBOL program. You do not need to specify the
LINKAGE TYPE clause in the SPECIAL-NAMES paragraph or the LINKAGE TYPE phrase
with the CALL, CANCEL, or SET...ENTRY statement when the linkage has been
defined by the LINKLIT parameter of CRTCBLMOD or CRTBNDCBL.
- To create a module that calls program objects, type:
CRTCBLMOD MODULE(MYLIB/XMPLE1)
SRCFILE(MYLIB/QCBLLESRC) SRCMBR(XMPLE1)
LINKLIT(*PGM)
- To create a module which calls procedures, type:
CRTCBLMOD MODULE(MYLIB/XMPLE1)
SRCFILE(MYLIB/QCBLLESRC) SRCMBR(XMPLE1)
LINKLIT(*PRC)
- You code the CALL and CANCEL statements as follows when using the LINKLIT
parameter of CRTCBLMOD to specify linkage type:
PROCEDURE DIVISION.
·
·
·
CALL literal-1.
·
·
·
CANCEL literal-1.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.