Monday, 28 July 2014

COBOL Program Compilation Process | COBOL Compilation Process | Compilation process in COBOL - Awesome 5 Min Guide.

COBOL Program Compilation Process.

Imagine, you've recently joined a team of developers. Your first assignment is to compile a standalone COBOL program. But, being a new team member you don't know how to compiler a COBOL program or a "COBOL compilation process". 
Welcome to today’s session on “COBOL Compilation Process”. In this session, you’ll learn the underline concept of compiling a COBOL program. You'll get an overview of the compiler and its functions. Finally, you'll go through the COBOL compilation flow diagram with a detailed steps explanation. Let's get started. 


COBOL is one of the oldest programming languages. It's a high-level programming language.  The program should be compiled to a low-level machine language code (i.e. object code/load module) so that the program can be executed on a machine.

What is a compiler?

A COBOL compiler is a software program/tool. It’s used to translate high-level COBOL programs into low-level executable code. It’s one of the most important phases of the programming development life cycle. IBM® Enterprise COBOL for z/OS® compiler, v6.3 is the latest version of COBOL compiler.

COBOL compiler performs four important functions: 
  • Syntax Scanning. 
  • Semantic Analysis.
  • Code optimization. 
  • Code Generations.
The input to the compiler is high-level COBOL program code and the output would be object code/machine code.

COBOL Program Compilation Process.

COBOL Compilation Process. 

There are different variants of the COBOL programs. You’ve standalone COBOL programs, COBOL-DB2 program, COBOL-CICS, etc. COBOL+DB2 program and COBOL+CICS program required special pre-compilation steps. But, standalone COBOL program compilation is straight forward and does not require any pre-compilation processing because they do not have any EXEC SQL or EXEC CICS commands.

COBOL compilation is an important process of converting high-level program code to low-level machine language that machines can understand. It is one of the most important phases of the programming development life cycle.

COBOL program compilation is a three-step process, i.e. convert source code to object module, link edit COBOL program with any subprogram, last but not least create executable object module. Refer to the figure for more details:

Compilation Flow diagram.

COBOL Compilation Process
COBOL Compilation Process Flow.

Step 1  

  • The COBOL compiler compiles the source program into an object module. If necessary, it gets the copy members it needs for the compilation from the specified copy libraries.
  • During compilation, the compiler produces output that can be printed or displayed on the terminal or monitor.
Step 2 
  • The linkage editor links the object program with any subprograms it needs, thus creating an executable program called a load module.
  • On most systems, the linkage editor links the object program with one or more system subprograms. However, it can also link it with COBOL subprograms.
Step 3 
  • The executable program runs so you can see whether it works correctly. This is the testing phase of program development. 
Note: COBOL-DB2 and COBOL-CICS compilation process are a little different from native COBOL program compilation.  In both, case you need to pre-process SQL and CICS commands. However, modern days compilers are capable of performing pre-process steps. You only need to select an appropriate compiler option while compiling COBOL+DB2 program or COBOL+CICS programs.

COBOL Compilation Process.

This tutorial is associated with a video tutorial. It explains the compilation process for all different flavors of COBOL programs. 

Created with Artisteer


The COBOL compilation process is an important and integral part of the software development life cycle. The standalone COBOL compilation process is simple and does not require any pre-compilation processing. But COBOL + DB2 a COBOL + CICS program requires special pre-compilation processing.

Read More…

Please Subscribe to Topictrick & Don’t forget to press THE BELL ICON to never miss any updates. Please visit below mention the link below to stay connected with Topictrick.

► Medium
Follow us on Twitter
Mainframe Blog

Thank you for your support.


No comments:

Post a Comment