AI and mainframe assembler

Understanding the simpliest of mainframe programs: IEFBR14


Before I can trust that AI can generate code, I want to know: Can AI understand the simplest mainframe assembler program?

Prompt:
Change the following HLASM program to use register equates from the IBM YREGS macro. Add consise comments on what the code is doing.
IEFBR14  CSECT , 
         SR    15,15
         BR    14 
         END 

ChatGPT generated this program:
IEFBR14  CSECT ,
         YREGS                          * Define register equates R0–R15
         SR     R15,R15                 * Clear return code (set R15 to 0)
         BR     R14                     * Return to caller
         END

My comments:


Grok generated this program:

IEFBR14  CSECT ,           Define program control section
         YREGS ,                   Include IBM register equates
* Clear return code by setting R15 to 0
         SR    R15,R15             Subtract R15 from itself to set to 0
* Return to caller using R14 (return address)
         BR    R14                 Branch to return address in R14
         END                      End of program

My comments:


Gemini generated this program:
         YREGS                          * PULL IN REGISTER EQUATES
IEFBR14  CSECT                          * DEFINE A CONTROL SECTION
         SR    R15,R15                  * SET REGISTER 15 TO ZERO (SUCCESSFUL RETURN CODE)
         BR    R14                      * BRANCH TO THE RETURN ADDRESS IN REGISTER 14
         END                            * END OF THE ASSEMBLY

My comments:


Copilot generated this program:
IEFBR14  CSECT 
         YREGS             Define register equates
         SR    R15,R15     Set return code to zero
         BR    R14         Return to caller
         END

My comments:


Claude generated this program:
IEFBR14  CSECT ,                Program entry point
         YREGS ,                    Include IBM register equates
*
* Simple do-nothing program that sets return code to zero
* and returns to caller
*
         SR    R15,R15              Clear return code register (RC=0)
         BR    R14                  Return to caller
         END

My comments:

My take on these results:

Same prompt, different results

You may get different results with the same prompt. As I've seen with creating images with chatbots, you can get different results on repeated requests. You will probably get different results if you use the same prompt I did.


Return to Dave's AI and mainframe assembler page .

Last Updated: 2025-07-01
This web page is © 1997-2025+ by David Alcock. All Rights Reserved.