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