IBM Support

PI48348: ON SIZE ERROR ON A COMPUTE INSTRUCTION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When using the 'on size error' statement with values
    really large, the on size error does not seem to catch it,
    but instead traps at runtime.
    
    ===== COMPILE COMMAND:
    cob2 test.cbl
    
    ===== TESTCASE:
    $ cat test4.cbl
    
           IDENTIFICATION DIVISION.
    
           PROGRAM-ID. 'tst'.
    
           ENVIRONMENT DIVISION.
    
           DATA DIVISION.
    
           WORKING-STORAGE SECTION.
    
    
    
           01 VAR1     PIC 9(18) value 100000000000000000.
    
           01 VAR2     PIC 9(18) value 100000000000000000.
    
           01 VAR3     PIC 9(18).
    
    
    
           PROCEDURE DIVISION.
    
    
    
               COMPUTE VAR3 = VAR1 * VAR2 * 10
    
                    on size error perform erro-overflow.
    
               DISPLAY "VAR3:", VAR3.
    
    
    
               STOP RUN.
    
               EXIT.
    
           erro-overflow.
    
               display "overflow".
    
               stop run.
    
    $
    
    
    With test2.cbl (using smaller values), its fine:
    $ cat test2.cbl
    
           IDENTIFICATION DIVISION.
    
           PROGRAM-ID. 'tst'.
    
           ENVIRONMENT DIVISION.
    
           DATA DIVISION.
    
           WORKING-STORAGE SECTION.
    
    
    
           01 VAR1     PIC 9(18) value 100000000000000.
    
           01 VAR2     PIC 9(18) value 100000000000000.
    
           01 VAR3     PIC 9(18).
    
    
    
           PROCEDURE DIVISION.
    
    
    
               COMPUTE VAR3 = VAR1 * VAR2 * 10
    
                    on size error perform erro-overflow.
    
               DISPLAY "VAR3:", VAR3.
    
    
    
               STOP RUN.
    
               EXIT.
    
           erro-overflow.
    
               display "overflow".
    
               stop run.
    
    $
    
    
    ===== ACTUAL OUTPUT:
    $./a4.out
    <Thread 1>
    <Thread 1>  Traceback:
    <Thread 1>    Offset 0x00000564 in procedure writeERRmsg
    <Thread 1>    Offset 0x00000044 in procedure _iwzWriteERRmsg
    <Thread 1>    Offset 0x00000280 in procedure TST
    <Thread 1>    --- End of call chain ---
    IWZ036W  Truncation of high order digit positions occurred in
    program TST on line number 26.
    
    VAR3:000000000000000000
    
    $
    
    ===== EXPECTED OUTPUT:
    $./a2.out
    overflow
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    COBOL for AIX clients who use 'on size error' with very large
    values may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    The program will produce an abend instead of catching the
    overflow in size error.
    The compiler was checking for overflow in the MOVE code.  This
    code assumes that if it catches an overflow it should issue an
    error.
    But the MOVE code can be part of a statement with a SIZE ERROR
    phrase (as in this case).
    

Problem conclusion

  • The compiler code has been fixed to handle the above mentioned
    case.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI48348

  • Reported component name

    COBOL AIX RUNTI

  • Reported component ID

    5724Z8702

  • Reported release

    411

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-09-08

  • Closed date

    2015-09-08

  • Last modified date

    2015-09-09

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

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

    PI55304

Fix information

  • Fixed component name

    COBOL AIX RUNTI

  • Fixed component ID

    5724Z8702

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SS6SGM","label":"COBOL for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"411","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
15 October 2021