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:


A month later the same prompt resulted in the following program after I got a free trial of Gemini 2.5 Pro:
IEFBR14  CSECT ,                 * Start of the control section named IEFBR14.
         USING *,R12             * Establishes R12 as the base register for addressing.
         YREGS                   * Brings in the standard register equates.
         SR    R15,R15           * Sets the return code to 0 by XORing register 15 with itself.
         BR    R14               * Returns control to the calling program by branching to the address in register 14.
         END                     * Marks the end of the assembly program.

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.

This testing was performed in July 2025.


Return to Dave's AI and mainframe assembler page .

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