Compiling programs on z/OS is not easy. The most common way to do this is to use JCL.
Two steps are necessary to obtain an executable load of a simple COBOL program:
- compilation
- link-edit
Writing the JCL performing these two steps is complex and will take time if changed.
An IBM cataloged procedure, present by default on z/OS machines, performs all these steps in a minimum of lines: this is the IGYWCL procedure.
Basic use of the IGYWCL procedure
I offer you this JCL which uses this IGYWCL procedure and which will require a small adaptation on your side:
- fill in the program name in the COBOL source library and LOAD
- fill in DSN (DataSet Name) of the libraries
//MYJOB JOB 'COMPIL',REGION=1M,NOTIFY=&SYSUID
//*
//*=========================================================*
//* COMPILATION JCL *
//* *
//* TO DO : *
//* -> REPLACE MEMBER NAME BY YOUR PROGRAM *
//* -> FILL IN LIBRARIES PATHS *
//*=========================================================*
//*
//COMPIL EXEC IGYWCL
//COBOL.SYSIN DD DSN=YOURUSER.PATH.COBOL(YOURPROGRAM),DISP=SHR
//LKED.SYSLMOD DD DSN=YOURUSER.PATH.LOAD(YOURPROGRAM),DISP=OLD
//
Compilation using libraries containing copys
If you want to include a library containing copies, the JCL above will evolve slightly to include a DD COBOL.SYSLIB card:
//COMPIL EXEC IGYWCL,PARM='LIB'
//COBOL.SYSIN DD DSN=YOURUSER.PATH.COBOL(YOURPROGRAM),DISP=SHR
//COBOL.SYSLIB DD DSN=YOURUSER.PATH.COPY,DISP=SHR
// DD DSN=YOURUSER.PATH.OTHERCOPY,DISP=SHR (to add if needed)
//LKED.SYSLMOD DD DSN=YOURUSER.PATH.LOAD(YOURPROGRAM),DISP=OLD
//
You can add as many complementary DD cards as you want, if needed. This is useful mainly in the case where the copies are distributed in several libraries:
//COBOL.SYSLIB DD DSN=YOURUSER.PATH.COPY,DISP=SHR
// DD DSN=PRJZOE.SRC.COPY,DISP=SHR
// DD DSN=BLIB.MAC,DISP=SHR
Compiling COBOL programs calling submodules
If you compile a program calling submodules, the DD LKED.SYSLIB card will have to be specified. It will allow you to specify the library (s) in which to look for the LOADs of the submodules during the link-edit step. If this card is missing, you will encounter the following error:
IEW2456E 9207 SYMBOL MSUBMODULE UNRESOLVED. MEMBER COULD NOT BE INCLUDED
FROM THE DESIGNATED CALL LIBRARY.
The JCL which will allow you to include the submodule load libraries during compilation:
//COMPIL EXEC IGYWCL,PARM='LIB'
//COBOL.SYSIN DD DSN=YOURUSER.PATH.COBOL(YOURPROGRAM),DISP=SHR
//COBOL.SYSLIB DD DSN=YOURUSER.PATH.COPY,DISP=SHR
//LKED.SYSLIB DD DSN=YOURUSER.PATH.LOAD,DISP=SHR
// DD .... (to add if needed)
//LKED.SYSLMOD DD DSN=YOURUSER.PATH.LOAD(YOURPROGRAM),DISP=OLD
//
To go further
You can simultaneously specify other DD cards expected by the procedure if other specific compilation needs arise.
To come, other compilation JCLs, in particular for COBOL programs using DB2.
Feel free to add a comment below or contact me if you wish to set up a training session.