IBM Support

PH67073: A LOOP WITH A GOTO STATEMENT EXECUTES MORE TIMES THAN EXPECTED AT OPT(2)

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Users of Enterprise COBOL 6.x compiling programs at OPT(2) that
    include a GO TO statement working with a BINARY/COMP/COMP-4 data
    item serving as a loop counter which increments or decrements by
    1 each iteration where the initial value of the loop counter is
    at or outside the bounds for the loop.
    
    The compiler optimizes the loop to count down to 0 and generates
    an instruction that decrements the loop counter, compares it to
    zero, and branches to the top of the loop if non-zero. If the
    initial value of the counter is at or exceeding the loop bounds,
    it will be transformed to be 0 or negative, and decrementing the
    counter means it's definitely negative, so the loop continues to
    execute until the counter wraps around and eventually reaches 1,
    decrementing to 0, allowing the loop to finally terminate.
    

Local fix

  • Compile with OPT(0|1)
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of Enterprise COBOL 6.4 compiling      *
    *                 programs at OPT(2) that include a GO TO      *
    *                 statement working with a BINARY/COMP/COMP-4  *
    *                 data item serving as a loop counter which    *
    *                 increments or decrements by 1 each iteration *
    *                 where the initial value of the loop counter  *
    *                 is at or outside the bounds for the loop.    *
    ****************************************************************
    * PROBLEM DESCRIPTION: Loop executes many more times than      *
    *                      expected.                               *
    ****************************************************************
    * RECOMMENDATION: Apply the provided PTF                       *
    ****************************************************************
    The compiler optimizes the loop to count down to 0 and generates
    an instruction that decrements the loop counter, compares it to
    zero, and branches to the top of the loop if non-zero. If the
    initial value of the counter is at or exceeding the loop bounds,
    it will be transformed to be 0 or negative, and decrementing the
    counter means it's definitely negative, so the loop continues to
    execute until the counter wraps around and eventually reaches 1,
    decrementing to 0, allowing the loop to finally terminate.
    

Problem conclusion

  • The compiler was fixed to avoid the optimization in cases where
    it can't ensure the initial value of the loop counter is within
    the loop bounds.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH67073

  • Reported component name

    ENT COBOL FOR Z

  • Reported component ID

    5655EC600

  • Reported release

    640

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2025-06-23

  • Closed date

    2025-08-25

  • Last modified date

    2025-09-23

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PH68254

Modules/Macros

  • IGY8RWTU IGYCASMB IGYCCBE  IGYCCCRT IGYCCICS IGYCCSRV IGYCDGEN
    IGYCDIAG IGYCDMAP IGYCEN$0 IGYCEN$1 IGYCEN$2 IGYCEN$3 IGYCEN$4
    IGYCEN$5 IGYCEN$8 IGYCEN$D IGYCEN$R IGYCFGEN IGYCFREE IGYCINIT
    IGYCJA$0 IGYCJA$1 IGYCJA$2 IGYCJA$3 IGYCJA$4 IGYCJA$5 IGYCJA$8
    IGYCJA$D IGYCJA$R IGYCJBLD IGYCJGEN IGYCLIBR IGYCLSTR IGYCLVL0
    IGYCLVL1 IGYCLVL2 IGYCLVL3 IGYCLVL8 IGYCMALL IGYCOB2E IGYCOSCN
    IGYCPGEN IGYCRCTL IGYCRDPR IGYCRDSC IGYCREAL IGYCRWT  IGYCSCAN
    IGYCSIMD IGYCUE$0 IGYCUE$1 IGYCUE$2 IGYCUE$3 IGYCUE$4 IGYCUE$5
    IGYCUE$8 IGYCUE$D IGYCUE$R IGYCXREF IGYDRV   IGYEQCWI IGYMSGE
    IGYMSGK  IGYMSGT  IGYQCBE  IGYQSPLT IGYZQEN6 IGYZQENU IGYZQJP6
    IGYZQJPN
    

Fix information

  • Fixed component name

    ENT COBOL FOR Z

  • Fixed component ID

    5655EC600

Applicable component levels

  • R640 PSY UO04614

       UP25/08/30 P F508

  • R641 PSY UO04615

       UP25/08/30 P F508

  • R642 PSY UO04616

       UP25/08/30 P F508

  • R64H PSY UO04617

       UP25/08/30 P F508

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS6SG3","label":"Enterprise COBOL for z\/OS"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"640","Line of Business":{"code":"LOB70","label":"Z TPS"}}]

Document Information

Modified date:
23 September 2025