IBM Support

PH68254: 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.5 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

    PH68254

  • Reported component name

    ENT COBOL FOR Z

  • Reported component ID

    5655EC600

  • Reported release

    650

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2025-09-23

  • Closed date

    2025-09-24

  • Last modified date

    2025-10-02

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

    PH67073

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

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 IGYCJDMJ IGYCJDNJ IGYCJGEN IGYCLIBR
    IGYCLSTR IGYCLVL0 IGYCLVL1 IGYCLVL2 IGYCLVL3 IGYCLVL8 IGYCMALL
    IGYCOB2  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

  • R650 PSY UO05070

       UP25/10/01 P F509

  • R651 PSY UO05071

       UP25/10/01 P F509

  • R652 PSY UO05072

       UP25/10/01 P F509

  • R65H PSY UO05073

       UP25/10/01 P F509

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":"6.5","Line of Business":{"code":"LOB70","label":"Z TPS"}}]

Document Information

Modified date:
02 October 2025