What you can learn from the Cobol compiler about Assembly language

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.

1 Comment

Filed under IBM Mainframe Assembler

One response to “What you can learn from the Cobol compiler about Assembly language

  1. MELVYN MALTZ

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.