COBOL Program Compilation Process.

Topictrick.com
3 min readDec 6, 2020

--

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.

COBOL, COBOL Tutorial, COBOL Programming
COBOL — Common Business Oriented Language.

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.

  1. Convert source code to an object module.
  2. Link edit COBOL program with any subprogram.
  3. 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.

COBOL Compilation Process, COBOL tutorial, COBOL+DB2 compilation, COBOL+CICS compilation process
COBOL Compilation Process.

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.

COBOL Compilation Process.

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.

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 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.

--

--

Topictrick.com
Topictrick.com

Written by Topictrick.com

Topictrick is a comprehensive repository of programming language tutorial and tech reviews. Also, it showcases what new in the tech industry. One place for all.

No responses yet