Why is this COBOL code failing to compile?

76 Views Asked by At

I'm trying to get this code to compile and I continue to get the same error at the same location. I will show the error I'm getting when I compile it along with the code where it's erroring out.

Error:

UPDATE-TOTALS.
  000202                    ADD WS-T-EXTENDED-PRICE TO WS-TOTALS (1:13)                           99 98
 
==000202==> IGYPA3074-S "WS-TOTALS (ALPHANUMERIC REFERENCE MODIFIED ITEM)" was not numeric, but
                        was a sender in an arithmetic expression.  The statement was discarded.
 
  000203                    ADD WS-T-NET-PRICE TO WS-TOTALS (14:13)                               101 98
 
==000203==> IGYPA3074-S "WS-TOTALS (ALPHANUMERIC REFERENCE MODIFIED ITEM)" was not numeric, but
                        was a sender in an arithmetic expression.  The statement was discarded.
 
  000204                    ADD WS-T-TRANSPORTATION TO WS-TOTALS (27:13)                          103 98
 
==000204==> IGYPA3074-S "WS-TOTALS (ALPHANUMERIC REFERENCE MODIFIED ITEM)" was not numeric, but
                        was a sender in an arithmetic expression.  The statement was discarded.
 
  000205                    ADD WS-T-DISCOUNT-AMOUNT TO WS-TOTALS (40:13).                        105 98
 
==000205==> IGYPA3074-S "WS-TOTALS (ALPHANUMERIC REFERENCE MODIFIED ITEM)" was not numeric, but
                        was a sender in an arithmetic expression.  The statement was discarded.

Code:

//where i declared it
01  WS-TOTALS.
           05  WS-T-EXTENDED-PRICE              PIC S9(11)V99
                VALUE 0.
           05  WS-T-NET-PRICE                   PIC S9(11)V99
                VALUE 0.
           05  WS-T-TRANSPORTATION              PIC S9(11)V99
                VALUE 0.
           05  WS-T-DISCOUNT-AMOUNT             PIC S9(11)V99
                VALUE 0.
//rest of my code
//error where its happening
       UPDATE-TOTALS.
           ADD WS-T-EXTENDED-PRICE TO WS-TOTALS (1:13)
           ADD WS-T-NET-PRICE TO WS-TOTALS (14:13)
           ADD WS-T-TRANSPORTATION TO WS-TOTALS (27:13)
           ADD WS-T-DISCOUNT-AMOUNT TO WS-TOTALS (40:13).
0

There are 0 best solutions below