Showing posts with label Assembler Language. Show all posts
Showing posts with label Assembler Language. Show all posts

Friday, December 17, 2010

What are the differences between COBOL and Assembler?

Assembler Language differs from all of the other languages such as COBOL, PL/I, RPG etc. It resembles the actual machine-instructions that you are likely to find on a Mainframe. Assembler-Language is a Low-level language. For performing a complex-task, you need to write several instructions. On the other hand, COBOL and other modern platforms such as Java or C# are High-Level Languages(HLL). In these languages, its possible to represent a complex task by one single-instruction.

COBOL looks more English-like. Its quite verbose. Writing a program in Assembler requires a different line-of-thinking, different thought pattern. Unlike COBOL, Assembler-Language statements don’t terminate with a period. Assembler language commands don’t even come close to English.

Alright, now let's keep this between you, me and the gatekeeper – COBOL Programs are actually transformed to Machine code. In fact, you can see the equivalent Machine-code corresponding to your COBOL-Program, for yourself when you run the Compiler IGYCRCTL with the PARM='LIST' Option. You would find that 1 COBOL Instruction generates several Machine-Instructions. By contrast, 1 Assembler-Instruction generates only one single Machine-Instruction. Guess what, you need to code several lines-of-Assembler to achieve the same effect as one line-of-COBOL.

Another paradigm-shift of thinking is needed, with the order of operands. COBOL does a MOVE A TO B, or ADD 1 TO COUNTER, take the first thing and do something to the second. In Assembler, you’d have to code MVC B,A or AP COUNTER,=P'1', the second operand normally does something on the first.

COBOL Programs are broken down into divisions, sections and para's – its strictly organized and structured. In Assembler, you just start coding. You decide your own custom-organization and enforce it, follow it throughout the program.