It can be fun to take a look at the assembly language listing of a Cobol program. Geeky, admittedly, but still fun. If you have never given the listings much thought, take a look at this video. You might be surprised what the Cobol compiler gets up to, and what you can learn about Cobol and assembler. In this video I examine whether to COMPUTE or not to COMPUTE, whether to PERFORM or to PERFORM THRU, and what happens when you tell the optimizer to give it the old college try.
What you can learn from the Cobol compiler about Assembly language
Categories:
Hi David,
I hope you and your family are well
I’ve just watched your video and was very much amused I’ve never seen such a botch made of a simple EDMK operation 🙂
In my days of debugging other people’s code I would always generate the assembler from COBOL and PL/1 so that I could see exactly what was going on
But it must be understood that COBOL must generalise and therefore even when optimising, will not generate perfect assembler code
It should also be understood that the assembler listing from COBOL is not ‘true’ assembler (it’s even weirder in PL/1), so I see obsessive commas…MVI 273(,R13),X’4E’ as well as invalid formats…OILL R4,0xf0 It looks like a bad disassembler has been at work
Nevertheless, a useful observation into assembler techniques
ZAP changes the first operand to a packed zero field for the specified length before doing the add
Melvyn Maltz.