Compile
Turns your COBOL source into machine instructions, and lists any mistakes it finds.
Also written compiler, COBOL compile
Why it matters. A program cannot run until it compiles. When it does not, the listing names the line and the reason.
See it
A comma at the end of a line means the statement carries on.
Syntax
//COMPILE EXEC PGM=IGYCRCTL,PARM='LIB,OBJECT' //SYSIN DD DSN=source.library(member),DISP=SHR //SYSLIB DD DSN=copybook.library,DISP=SHR //SYSLIN DD DSN=&&OBJSET,DISP=(NEW,PASS)
- PGM=IGYCRCTL
- The Enterprise COBOL compiler.
- SYSIN
- The source program to compile.
- SYSLIB
- Where COPY members are found.
- SYSLIN
- Where the object code is written.
- SYSPRINT
- The listing, with messages under the lines they are about.
- PARM
- Compiler options, such as LIB, OBJECT, XREF and SSRANGE.
Try it IGYCRCTL
- 1
Job COMPILE compiles the program ZBINT01. Send it from your DEV JCL library to run.
SUBMIT 'ZB0001.DEV.JCL(COMPILE)' - 2
Read the output of the job. Look for the number of errors.
OUTPUT COMPILE
Remember
- The compiler reads source and writes object code.
- Read the listing. A message sits under the line it is about.
- On z/OS the compiler is the program IGYCRCTL, run as a job step. Its return code is 0, 4, 8, 12 or 16 for the worst message found.
The usual mistake
DISPLAY 'BALANCE ' WS-BALL
WS-BAL was spelt with an extra L. The compiler gives IGYPS2121-S (the name was not defined), discards the statement and the step ends with RC=0012.
DISPLAY 'BALANCE ' WS-BAL
On real z/OS
The listing in MF/OS is its own layout (MF/OS COBOL, simulated). A real listing starts with the product banner and options, and ends with 'End of compilation' and a return code. Real sites compile with a procedure from the site's procedure library rather than writing every DD.
Where can I practise Compile?
Right here, at ZedBank. You take a junior job at a simulated bank and use Compile in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.
- Link-editCombining compiled object code with the other modules it needs into a single runnable program.
- Load moduleThe runnable form of a program, stored in a library, which JCL executes by name.
- PROCA reusable piece of JCL stored as a member and invoked by name, so common steps are written once.
- Return codeA number a program leaves behind saying how it went. Zero for clean, higher numbers for warnings and failures.
- CopybookA shared block of COBOL declarations kept in a library and included into programs, so a record layout is defined once.