Skip to main content

XML problems after software upgrade

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

The comp-3 arithmetic should only retain the result equal to the defined pick value not what it can hold.

       WORKING-STORAGE SECTION.

      *****************************************************************

       01  PIC-S9X4-COMP-3         pic S9(4)   COMP-3  value 5001.

       01  PIC-S9X9-COMP-3         pic S9(9)   COMP-3  value 5001.

       01  WRK-S9X4-COMP-3         pic S9(4)   COMP-3  value 0.

       01  WRK-S9X9-COMP-3         pic S9(9)   COMP-3  value 0.

      *****************************************************************

       PROCEDURE DIVISION.

           display 'NUMBUGC1 is starting...' upon console

           perform TEST-001

           perform TEST-002

           perform TEST-003

           display 'NUMBUGC1 is finished...' upon console

           GOBACK.

      *****************************************************************

       TEST-001.

           display 'NUMBUGC1 is starting, Step 1...' upon console

           move ZERO to WRK-S9X4-COMP-3

           add  5001 to WRK-S9X4-COMP-3

           add  5001 to WRK-S9X4-COMP-3

      *    At this point the PACKED field (WRK-S9X4-COMP-3) with a

      *    PIC S9(4) should contain 0002 and not 10002.

      *    Even though the capabilites of the physical field could

      *    contain 5 digits it should conform to the picture

      *    clause values.

           if  WRK-S9X4-COMP-3 is NUMERIC

               display 'WRK-S9X4-COMP-3 is numeric' upon console

               display 'Result 4... ' WRK-S9X4-COMP-3 upon console

               add WRK-S9X4-COMP-3 to ZERO giving WRK-S9X9-COMP-3

               display 'Result 9... ' WRK-S9X9-COMP-3 upon console

           else

               display 'WRK-S9X4-COMP-3 is NOT numeric' upon console

           end-if

           exit.

      *****************************************************************

Resolution:

ADD compiler directive HOSTARITHMETIC will guarantees decimal truncation on arithmetic when ON SIZE ERROR is not defined.

       01  WRK-S9X4-COMP-3         pic S9(4)   COMP-3  value 0.

           move ZERO to WRK-S9X4-COMP-3

           add  5001 to WRK-S9X4-COMP-3

           add  5001 to WRK-S9X4-COMP-3

Before using HOSTARITHMETIC directive the result would be 10002

After adding HOSTARITHMETIC directive the result will be 0002

Old KB# 5384

0 replies

Be the first to reply!