COBOL Manual for TNS and TNS/R Programs
Program Compilation
HP COBOL Manual for TNS and TNS/R Programs—522555-006
11-18
CALL and ENTER Statement Processing: Detailed
Explanation
Finding the Entered Program
When it encounters an ENTER or X/Open CALL statement, the compiler follows this
procedure:
1. If the compiler has already resolved the reference to the specified routine-name
during the current compilation, the compiler resolves the current reference to that
program.
2. If the compiler has not yet encountered the routine-name during the current
compilation, the compiler conducts a search for the program:
a. If file-mnemonic appears, the compiler tries to find a program with the
specified name in the file associated with file-mnemonic. If the compiler
finds the program, it verifies that language is the language in which the
program was written. If the compiler does not find such a program, it reports an
error.
Example 11-5. For Step 1 of Finding the Called Program
IDENTIFICATION DIVISION.
PROGRAM-ID. P. ...
PROCEDURE DIVISION. ...
CALL A ...
...
IDENTIFICATION DIVISION.
PROGRAM-ID. A.
...
END PROGRAM A.
IDENTIFICATION DIVISION.
PROGRAM-ID. B. ...
END PROGRAM B.
END PROGRAM P.
Example 11-6. For Step 2 of Finding the Called Program
IDENTIFICATION DIVISION.
PROGRAM-ID. S. ...
PROCEDURE DIVISION. ...
IDENTIFICATION DIVISION.
PROGRAM-ID. A COMMON. ...
END PROGRAM A.
IDENTIFICATION DIVISION.
PROGRAM-ID. P. ...
CALL A ...
END PROGRAM P.
END PROGRAM S.