Cobol Mainframe
Level Numbers in Cobol:-
01-49 : General purpose variables
66 - to rename the group
77 - declare the individual variables
88 - Conditional Variables
CALL Statement:- Transfers the control from one program to another program.
Static Call: Call by value
eg: Call “sub-program”
Dynamic Call: Call by reference
eg: 01 ws-subprog pic x(08) value spaces.
Move “subprog” to ws-subprog
call ws-subprog
Cobol-DB2 Compilation Process:-
Precompile → 2. Compile (IGYCRCTL) → 3. Link-Edit (IEWL) → 4. Bind
1. Precompilation
Purpose: Converts embedded SQL statements into COBOL-compatible calls and generates a DBRM (Database Request Module) for the BIND step.
Utility: DB2 Precompiler (e.g., DSNHPC).
Input: Source program (.cbl with SQL).
Outputs:
Modified COBOL source (SQL replaced with COBOL calls).
DBRM (contains SQL statements for binding).
Validates SQL syntax against the DB2 catalog.
2. Compilation
Purpose: Compiles the preprocessed COBOL code into an object module.
Utility: IGYCRCTL (IBM COBOL Compiler).
Input: Modified COBOL source (from precompilation).
Output: Object module (.obj).
Requires DB2 libraries (e.g., DSNAOBIX) for SQL linkage.
3. Link-Editing
Purpose: Links the object module with DB2 and other required libraries to create an executable load module.
Utility: IEWL (IBM Linkage Editor, part of Language Environment).
Input: Object module (.obj).
Output: Executable load module (.load).
Includes DB2 interface modules (e.g., DSNELI) and runtime libraries.
4. Binding Purpose:
Binds the DBRM to a DB2 plan or package, creating an access path for SQL statements. Utility: BIND command (via IKJEFT01 or DSN subcommand).
Input: DBRM (from precompilation).
Output: DB2 plan/package stored in the DB2 directory.
Optimizes SQL execution using DB2’s optimizer.