Tuesday, April 16, 2019

z/OS Compile Process

Programs are written in programming languages that humans can understand. However, the processor cannot understand these languages. These languages need to be translated into machine language to make them useful. The process of translating these programming languages into machine language is called Compiling.


Each programming language requires a compiler that understands the syntax of the language. If you are compiling a COBOL program, you will need a COBOL compiler to interpret the statements and convert these before you can run the program.

LEVELS OF LANGUAGES

Machine Language

The lowest level of language is machine language. The processor only understand machine language. The machine language is specific to a processor. So the machine language for the mainframe is different from that used in an Intel processor.

The machine language normally has a operation code (opcode) which specifies the operation you want to do and addresses where the operation is to work on. Some opcodes can have implied addresses while some have addresses pointing to specific areas in memory. An opcode is a combination of binary digits that trigger a specific function that the processor does. The combination of binary digits is represented in hexadecimal numbers. Processors only recognize opcodes.

Example of opcode: 90ECD00C


Assembler Language

The next level is the Assembler program. The Assembler is a human readable language that has almost a one-to-one correspondence to machine language. An assembler generates the opcode based on the Assembler instruction. Here is a sample output of an Assembler:

The column under LOC shows the location of the code within the program. The Object Code is the generated opcode and address of the operands. ADDR1 and ADD2 are the addresses of the operands. The statements under the SOURCE STATEMENT column are Assembler codes.


Third Generation Languages

Since Assembler languages are cryptic to read and code, third generation languages were developed to make writing programs simpler and understandable. The more popular third generation languages for z/OS are COBOL, PL/1, C++.

Some of these like COBOL use basic English statements for coding. Shown below is an example of a COBOL program.

These statements are read by the COBOL compiler. The COBOL compiler translates the program to an Assembler program which will then be assembled to produce object code.

No comments:

Post a Comment

Follow by Email

Total Pageviews