Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact
💻 COBOL

COBOL Compile Directives

Advanced 🕑 10 min read 👁 0 views

12

Code Example


## COBOL Compile Directives and Options

Compiler directives control how COBOL source code is processed and compiled.

### Common Enterprise COBOL Options

**Source Processing:**
- **LIB**: Enable COPY/BASIS processing
- **SOURCE/NOSOURCE**: Include source in listing
- **XREF**: Cross-reference listing
- **MAP**: Data Division map

**Code Generation:**
- **OPTIMIZE/NOOPT**: Optimization level
- **TRUNC(STD/OPT/BIN)**: Truncation handling
- **NUMPROC(NOPFD/PFD)**: Numeric processing

**Debugging:**
- **TEST**: Enable debugging
- **SSRANGE**: Subscript range checking
- **CHECK**: Additional runtime checks

**Data Processing:**
- **ARITH(COMPAT/EXTEND)**: Arithmetic precision
- **DYNAM/NODYNAM**: Dynamic CALL
- **RENT/NORENT**: Reentrant code

### CBL/PROCESS Statement

\`\`\`cobol
CBL OPTIMIZE(FULL),SSRANGE,TEST
or
PROCESS XREF,SOURCE,MAP
\`\`\`

### Compiler-Directing Statements

- **EJECT**: Page break in listing
- **SKIP1/2/3**: Line skip in listing
- **TITLE**: Page heading
- **COPY**: Include copybook
- **REPLACE**: Text substitution