Batch compilation for COBOL programs

Separate COBOL programs can be compiled together as one input file. An END PROGRAM header statement terminates each program and is optional for the last program in the batch. The translator accepts separate COBOL programs in a single input file, and interprets END PROGRAM header statements.

Translator options specified as parameters when invoking the translator are in effect for the whole batch, but can be overridden for a unit of compilation by options specified in the CBL or PROCESS card that initiates the unit.

The options for a unit of compilation are determined according to the following order of priority:
  1. Options fixed as installation non-user-modifiable options.
  2. Options specified in the CBL or PROCESS card that initiates the unit.
  3. Options specified when the translator is invoked.
  4. Default options.

For more information about compilation, see Installing application programs.

If you are using batch compilation, you must take some additional action to ensure that compilation and linkage editing are successful, as follows:
  • Include the compiler NAME option as a parameter in the JCL statement that invokes the compiler or in a CBL statement for each top-level (non-nested) program. This causes the inclusion of a NAME statement at the end of each program. See Figure 1 for more information.
  • Edit the compiler output to add INCLUDE and ORDER statements for the CICS COBOL stub to each object module. These statements cause the linkage editor to include the stub at the start of each load module. These statements can be anywhere in the module, though by convention they are at the start. You might find it convenient to place them at the end of the module, immediately before each NAME statement. Figure 2 shows the output from Figure 1 after editing in this way.

For batch compilation you must vary the procedure described in Installing application programs . The following is a suggested method:

  1. Split the supplied cataloged procedure DFHYITVL into two procedures: PROC1 containing the translate and compilation steps (TRN and COB), and PROC2 containing the linkage editor steps COPYLINK and LKED.
  2. In PROC1, add the NAME option to the parameters in the EXEC statement for the compiler, which then looks like this:
    //COB EXEC PGM=IGYCRCTL,REGION=..,
    // PARM='....,NAME,....',
    
    
  3. In PROC1, change the name and disposition of the compiler output data set &&LOADSET. At least remove the initial && from the data set name and change the disposition to CATLG. The SYSLIN statement should then read:
    //SYSLIN DD DSN=LOADSET,DISP=(NEW,CATLG),
    // UNIT=&WORK,SPACE=(80,(250,100))
    
  4. Run PROC1.
    Figure 1. Compiler output before editing
     .................
    ....program a....
    .................
    NAME PROGA(R)
    .................
    .................
    ....program b....
    .................
    .................
    NAME PROGB(R)
    .................
    ....program c....
    .................
    NAME PROGC(R)
  5. Edit the compiler output in the data set LOADSET to add the INCLUDE and ORDER statements as shown in Figure 2. If you use large numbers of programs in batches, you should write a simple program or REXX EXEC to insert the ORDER and INCLUDE statements.
  6. In PROC2, add a DD statement for the library that includes the CICS stub. The standard name of this library is CICSTS54.CICS .SDFHLOAD. The INCLUDE statement for the stub refers to this library by the DD name. In Figure 2 , it is assumed you have used the DD name SYSLIB ( or concatenated this library to SYSLIB). The suggested statement is:
    
    //SYSLIB DD DSN=
    CICSTS54.CICS
    .SDFHLOAD,
    // DISP=SHR
    
  7. In PROC2, replace the SYSLIN concatenation with the single statement:
    //SYSLIN DD DSN=LOADSET,
    // DISP=(OLD,DELETE)

    In this statement it is assumed that you have renamed the compiler output data set LOADSET.

  8. Run PROC2.
Figure 2. Linkage editor input
 ....program a....
.................
INCLUDE SYSLIB(DFHELII)
ORDER DFHELII
NAME PROGA(R)
.................
.................
....program b....
.................
.................
INCLUDE SYSLIB(DFHELII)
ORDER DFHELII
NAME PROGB(R)
.................
....program c....
.................
INCLUDE SYSLIB(DFHELII)
ORDER DFHELII
NAME PROGC(R)
Note: You are recommended to use the DFHELII stub, but DFHECI is still supplied, and can be used.