The language elements relevant to inter-program communication are summarized in the following table:
Language element |
Function |
END PROGRAM entry |
Denotes the end of the named compilation unit |
INITIAL clause |
The program is set to its initial state each time it is called |
COMMON clause |
The program can also be called by its sibling programs and their descendants |
LINKAGE SECTION |
In the called program: to define data passed from the calling program |
EXTERNAL clause |
Declaration of files and data items as external |
GLOBAL clause |
Declaration of names as global |
PROCEDURE DIVISION USING phrase |
In the called program: definition of the standard entry point List of data-names; indicates that data is passed to the called program |
CALL statement USING phrase |
In the calling program: call for a subprogram or a contained program List of data-names; indicates that data is transferred to the called program |
CANCEL statement |
The program is set to its initial state the next time it is called |
ENTRY statement USING phrase |
Only in the subprogram of a run unit: definition of a non-standard entry point List of data-names (defined in the LINKAGE SECTION); indicates that data is transferred from the calling program |
EXIT PROGRAM statement |
Return of control to the calling program |
GOBACK statement |
Identifies the logical end of a program |
USE statement with GLOBAL attribute |
In nested programs: definition of global USE procedures |