COBOL Manual for TNS and TNS/R Programs

Program Compilation
HP COBOL Manual for TNS and TNS/R Programs522555-006
11-16
CALL and ENTER Statement Processing: Detailed
Explanation
When you install the NMCOBOL compiler, the NMCOBEX1 and NMCOBEXT files are
stored on the subvolume $SYSTEM.SYSTEM. If you move either file to another
subvolume, use the CONSULT directive to tell the compiler where to find it.
CALL and ENTER Statement Processing: Detailed Explanation
In processing CALL and ENTER statements, the compiler attempts to:
1. Find the called program (see Finding the Called Program) or the entered program
(see Finding the Entered Program)
2. Validate the parameters in the calling program against those expected by the
called program (see CALL and ENTER)
3. Generate any necessary instructions to present the parameters from the calling
program in the form that the called program expects (see Presenting Parameters
to the Called Program)
4. Generate any necessary instructions to deliver a returned value (from the GIVING
clause of an ENTER statement) in the form that the calling program expects (see
Delivering the Returned Value)
5. Bind or link the object code for the called program into the target file or postpone
the binding or linking until the first time the loadfile is loaded for execution (see
Binding or Linking the Object Code)
Finding the Called Program
When the compiler reaches the end of a separately compiled program, it identifies all
program names that were explicitly referenced by CALL statements in that program. If
a CALL statement specified an identifier instead of an explicit name, the compiler
cannot validate the parameters and does not try to locate the program for that CALL.
You are responsible for the conformance of the parameters.
A compilation source text consists of one or more separately compiled HP COBOL
programs. Each such program can include nested programs. Suppose separately
compiled program S includes program P, which contains the statement CALL A. The
compiler follows this procedure:
1. If program P directly contains a program named A, the compiler always chooses
that program.
In Example 11-5
, the compiler issues a warning if a file-mnemonic appears.
Note. The preceding paragraph applies only to the NonStop system. For the locations of files
on the PC, see NonStop COBOL for TNS/R (ETK)
.