COBOL Program Compilation Process.
Welcome back to today’s session on “COBOL Compilation Process”. In this session, you’ll learn the basic concept of compiling a COBOL program and what are the different steps involved in compiling a standalone COBOL program. Let’s get started.
Introduction.
COBOL is a high-level programming language. The COBOL program has to be converted into a low-level machine language code (i.e. object code/load module) so that program can be executed by machines.
What is a compiler?
A COBOL compiler is a software program/tool. It’s used to translate high-level COBOL program 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 compiler is high-level COBOL program code and output would be object code/machine code.
COBOL Compilation Process.
There are different flavours 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.
A standalone COBOL program compilation is a three-step process.
- Convert source code to an object module.
- Link edit COBOL program with any subprogram.
- Last but not least create an executable object module.
Let’s discuss each step one by one in details with the help of the flow diagram.
Compilation Flow diagram.
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.
Note: COBOL-DB2 and COBOL-CICS compilation process are little different from native COBOL program compilation. In both, case you need to pre-process SQL and CICS commands. However, modern days compiler 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 flavours of COBOL programs.
Conclusion.
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.
Please Subscribe to Topictrick & Don’t forget to press THE BELL ICON to never miss any updates. Please visit below mention the link to stay connected with Topictrick.
► Topictrick.com
► Youtube
► Follow us on Twitter
► Facebook
► Linkedin
► Reddit
► Mainframe Blog
Thank you for your support.
Topictrick™
Originally published at https://mainframe-forum.blogspot.com.