In my progarm When I compile it I keep getting illegal character in Numeric Field. MOVE QUANTITY-SOLD TO QUANTITY-SOLD-OUT is where it happens and I can't see why Can someone help?
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSGN-03.
AUTHOR. Jessica Bennett.
DATE-WRITTEN. 10-29-02.
*REMARKS. This program calculates Net-Sales.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. C01 IS NEXT-PAGE.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATA-FILE ASSIGN TO "A:Chdata04.DAT".
SELECT PRINT-FILE ASSIGN TO "A:Calc.cbl".
DATA DIVISION.
FILE SECTION.
FD DATA-FILE.
01 IN-DATA-RECORD.
05 ITEM-NUMBER PIC X(9).
05 ITEM-DESCRIP PIC X(20).
05 PIC X(10) VALUE SPACES.
05 QUANTITY-SOLD PIC 999.
05 UNIT-PRICE PIC 999V99.
05 SALESMAN PIC X(2).
05 PIC X.
FD PRINT-FILE.
01 PRINT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 HEADING-1.
05 HEADER-DATE PIC X(8) VALUE "11/05/02".
05 PIC X(23) VALUE SPACES.
05 PIC X(18) VALUE "KITCHEN INDUSTRIES".
05 PIC X(23) VALUE SPACES.
05 PIC X(5) VALUE "PAGE".
05 PAGE-NUMBER-OUT PIC Z9.
01 HEADING-2.
05 PIC X(12) VALUE "ITEM NUMBER".
05 PIC X(2) VALUE SPACES.
05 PIC X(13) VALUE "QUANTITY SOLD".
05 PIC X(1) VALUE SPACES.
05 PIC X(10) VALUE "UNIT PRICE".
05 PIC X(1) VALUE SPACES.
05 PIC X(11) VALUE "GROSS SALES".
05 PIC X(2) VALUE SPACES.
05 PIC X(8) VALUE "DISCOUNT".
05 PIC X(1) VALUE SPACES.
05 PIC X(9) VALUE "NET SALES".
05 PIC X(2) VALUE SPACES.
05 PIC X(9) VALUE "SALESMAN".
01 DETAIL-LINE.
05 PIC X(1) VALUE SPACES.
05 ITEM-NUMBER-OUT PIC X(9).
05 PIC X(8) VALUE SPACES.
05 QUANTITY-SOLD-OUT PIC ZZ9.
05 PIC X(8) VALUE SPACES.
05 UNIT-PRICE-OUT PIC ZZ9.99.
05 PIC X(5) VALUE SPACES.
05 GROSS-SALES-OUT PIC Z(7).99.
05 PIC X(3) VALUE SPACES.
05 DISCOUNT-OUT PIC Z(4).99.
05 PIC X(1) VALUE SPACES.
05 NET-SALES-OUT PIC Z(7).99.
05 PIC X(5) VALUE SPACES.
05 SALESMAN-OUT PIC X(2).
01 NAME-RECORD.
05 PIC X(60) VALUE SPACES.
05 PIC X(30) VALUE "Jessica Bennett".
01 TOTAL-PRINT-RECORD.
05 PIC X(40) VALUE SPACES.
05 TOTAL-GROSS-SALES-OUT PIC $$$,$$$.99.
05 PIC X(3) VALUE SPACES.
05 TOTAL-DISCOUNT-OUT PIC $$$$.99.
05 PIC X(1) VALUE SPACES.
05 TOTAL-NET-SALES-OUT PIC $$$,$$$.99.
05 UNUSED PIC X(9) VALUE SPACES.
01 COUNTERS.
05 PAGE-NUMBER PIC S99 VALUE ZERO packed-decimal.
05 LINE-COUNT PIC S99 VALUE ZERO packed-decimal.
05 WS-TOTAL-GROSS-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-TOTAL-DISCOUNT PIC S9(3)V99 VALUE ZERO.
05 WS-TOTAL-NET-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-GROSS-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-DISCOUNT PIC S9(3)V99 VALUE ZERO.
05 WS-NET-SALES PIC S9(7)V99 VALUE ZERO.
01 FLAGS.
05 MORE-DATA-FLAG PIC X(3) VALUE "YES".
88 NO-MORE-DATA VALUE "NO".
PROCEDURE DIVISION.
100-MAIN-LINE-ROUTINE.
PERFORM 200-INITIALIZATION-ROUTINE.
PERFORM 300-PROCESS-ROUTINE
UNTIL NO-MORE-DATA.
PERFORM 500-FINAL-ROUTINE.
STOP RUN.
200-INITIALIZATION-ROUTINE.
OPEN INPUT DATA-FILE
OUTPUT PRINT-FILE.
MOVE SPACES TO DETAIL-LINE
PERFORM 600-HEADER-ROUTINE.
READ DATA-FILE AT END MOVE "NO"
TO MORE-DATA-FLAG.
300-PROCESS-ROUTINE.
IF LINE-COUNT > 56
PERFORM 600-HEADER-ROUTINE
ELSE
NEXT SENTENCE.
MOVE ITEM-NUMBER TO ITEM-NUMBER-OUT
MOVE QUANTITY-SOLD TO QUANTITY-SOLD-OUT
MOVE UNIT-PRICE TO UNIT-PRICE-OUT
COMPUTE WS-GROSS-SALES = UNIT-PRICE * QUANTITY-SOLD
IF WS-GROSS-SALES >=500.00
PERFORM 400-CALC-ROUTINE
ELSE
MOVE 0 TO DISCOUNT-OUT, WS-DISCOUNT
MOVE WS-GROSS-SALES TO GROSS-SALES-OUT
MOVE GROSS-SALES-OUT TO NET-SALES-OUT
MOVE NET-SALES-OUT TO WS-NET-SALES
END-IF
MOVE SALESMAN TO SALESMAN-OUT
WRITE PRINT-RECORD FROM DETAIL-LINE
AFTER ADVANCING 1 LINE.
ADD WS-GROSS-SALES TO WS-TOTAL-GROSS-SALES.
ADD WS-DISCOUNT TO WS-TOTAL-DISCOUNT.
ADD WS-NET-SALES TO WS-TOTAL-NET-SALES.
ADD 1 TO LINE-COUNT.
READ DATA-FILE AT END MOVE "NO"
TO MORE-DATA-FLAG.
400-CALC-ROUTINE.
MULTIPLY WS-GROSS-SALES BY .02 GIVING WS-DISCOUNT
SUBTRACT WS-DISCOUNT FROM WS-GROSS-SALES
GIVING WS-NET-SALES.
MOVE WS-GROSS-SALES TO GROSS-SALES-OUT
MOVE WS-DISCOUNT TO DISCOUNT-OUT
MOVE WS-NET-SALES TO NET-SALES-OUT.
500-FINAL-ROUTINE.
MOVE WS-TOTAL-GROSS-SALES TO TOTAL-GROSS-SALES-OUT.
MOVE WS-TOTAL-DISCOUNT TO TOTAL-DISCOUNT-OUT.
MOVE WS-TOTAL-NET-SALES TO TOTAL-NET-SALES-OUT.
MOVE TOTAL-PRINT-RECORD TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
CLOSE DATA-FILE, PRINT-FILE.
600-HEADER-ROUTINE.
MOVE NAME-RECORD TO PRINT-RECORD.
ADD 1 TO PAGE-NUMBER.
MOVE PAGE-NUMBER TO PAGE-NUMBER-OUT.
WRITE PRINT-RECORD AFTER ADVANCING NEXT-PAGE.
MOVE HEADING-1 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-2 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE SPACES TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSGN-03.
AUTHOR. Jessica Bennett.
DATE-WRITTEN. 10-29-02.
*REMARKS. This program calculates Net-Sales.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. C01 IS NEXT-PAGE.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATA-FILE ASSIGN TO "A:Chdata04.DAT".
SELECT PRINT-FILE ASSIGN TO "A:Calc.cbl".
DATA DIVISION.
FILE SECTION.
FD DATA-FILE.
01 IN-DATA-RECORD.
05 ITEM-NUMBER PIC X(9).
05 ITEM-DESCRIP PIC X(20).
05 PIC X(10) VALUE SPACES.
05 QUANTITY-SOLD PIC 999.
05 UNIT-PRICE PIC 999V99.
05 SALESMAN PIC X(2).
05 PIC X.
FD PRINT-FILE.
01 PRINT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 HEADING-1.
05 HEADER-DATE PIC X(8) VALUE "11/05/02".
05 PIC X(23) VALUE SPACES.
05 PIC X(18) VALUE "KITCHEN INDUSTRIES".
05 PIC X(23) VALUE SPACES.
05 PIC X(5) VALUE "PAGE".
05 PAGE-NUMBER-OUT PIC Z9.
01 HEADING-2.
05 PIC X(12) VALUE "ITEM NUMBER".
05 PIC X(2) VALUE SPACES.
05 PIC X(13) VALUE "QUANTITY SOLD".
05 PIC X(1) VALUE SPACES.
05 PIC X(10) VALUE "UNIT PRICE".
05 PIC X(1) VALUE SPACES.
05 PIC X(11) VALUE "GROSS SALES".
05 PIC X(2) VALUE SPACES.
05 PIC X(8) VALUE "DISCOUNT".
05 PIC X(1) VALUE SPACES.
05 PIC X(9) VALUE "NET SALES".
05 PIC X(2) VALUE SPACES.
05 PIC X(9) VALUE "SALESMAN".
01 DETAIL-LINE.
05 PIC X(1) VALUE SPACES.
05 ITEM-NUMBER-OUT PIC X(9).
05 PIC X(8) VALUE SPACES.
05 QUANTITY-SOLD-OUT PIC ZZ9.
05 PIC X(8) VALUE SPACES.
05 UNIT-PRICE-OUT PIC ZZ9.99.
05 PIC X(5) VALUE SPACES.
05 GROSS-SALES-OUT PIC Z(7).99.
05 PIC X(3) VALUE SPACES.
05 DISCOUNT-OUT PIC Z(4).99.
05 PIC X(1) VALUE SPACES.
05 NET-SALES-OUT PIC Z(7).99.
05 PIC X(5) VALUE SPACES.
05 SALESMAN-OUT PIC X(2).
01 NAME-RECORD.
05 PIC X(60) VALUE SPACES.
05 PIC X(30) VALUE "Jessica Bennett".
01 TOTAL-PRINT-RECORD.
05 PIC X(40) VALUE SPACES.
05 TOTAL-GROSS-SALES-OUT PIC $$$,$$$.99.
05 PIC X(3) VALUE SPACES.
05 TOTAL-DISCOUNT-OUT PIC $$$$.99.
05 PIC X(1) VALUE SPACES.
05 TOTAL-NET-SALES-OUT PIC $$$,$$$.99.
05 UNUSED PIC X(9) VALUE SPACES.
01 COUNTERS.
05 PAGE-NUMBER PIC S99 VALUE ZERO packed-decimal.
05 LINE-COUNT PIC S99 VALUE ZERO packed-decimal.
05 WS-TOTAL-GROSS-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-TOTAL-DISCOUNT PIC S9(3)V99 VALUE ZERO.
05 WS-TOTAL-NET-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-GROSS-SALES PIC S9(7)V99 VALUE ZERO.
05 WS-DISCOUNT PIC S9(3)V99 VALUE ZERO.
05 WS-NET-SALES PIC S9(7)V99 VALUE ZERO.
01 FLAGS.
05 MORE-DATA-FLAG PIC X(3) VALUE "YES".
88 NO-MORE-DATA VALUE "NO".
PROCEDURE DIVISION.
100-MAIN-LINE-ROUTINE.
PERFORM 200-INITIALIZATION-ROUTINE.
PERFORM 300-PROCESS-ROUTINE
UNTIL NO-MORE-DATA.
PERFORM 500-FINAL-ROUTINE.
STOP RUN.
200-INITIALIZATION-ROUTINE.
OPEN INPUT DATA-FILE
OUTPUT PRINT-FILE.
MOVE SPACES TO DETAIL-LINE
PERFORM 600-HEADER-ROUTINE.
READ DATA-FILE AT END MOVE "NO"
TO MORE-DATA-FLAG.
300-PROCESS-ROUTINE.
IF LINE-COUNT > 56
PERFORM 600-HEADER-ROUTINE
ELSE
NEXT SENTENCE.
MOVE ITEM-NUMBER TO ITEM-NUMBER-OUT
MOVE QUANTITY-SOLD TO QUANTITY-SOLD-OUT
MOVE UNIT-PRICE TO UNIT-PRICE-OUT
COMPUTE WS-GROSS-SALES = UNIT-PRICE * QUANTITY-SOLD
IF WS-GROSS-SALES >=500.00
PERFORM 400-CALC-ROUTINE
ELSE
MOVE 0 TO DISCOUNT-OUT, WS-DISCOUNT
MOVE WS-GROSS-SALES TO GROSS-SALES-OUT
MOVE GROSS-SALES-OUT TO NET-SALES-OUT
MOVE NET-SALES-OUT TO WS-NET-SALES
END-IF
MOVE SALESMAN TO SALESMAN-OUT
WRITE PRINT-RECORD FROM DETAIL-LINE
AFTER ADVANCING 1 LINE.
ADD WS-GROSS-SALES TO WS-TOTAL-GROSS-SALES.
ADD WS-DISCOUNT TO WS-TOTAL-DISCOUNT.
ADD WS-NET-SALES TO WS-TOTAL-NET-SALES.
ADD 1 TO LINE-COUNT.
READ DATA-FILE AT END MOVE "NO"
TO MORE-DATA-FLAG.
400-CALC-ROUTINE.
MULTIPLY WS-GROSS-SALES BY .02 GIVING WS-DISCOUNT
SUBTRACT WS-DISCOUNT FROM WS-GROSS-SALES
GIVING WS-NET-SALES.
MOVE WS-GROSS-SALES TO GROSS-SALES-OUT
MOVE WS-DISCOUNT TO DISCOUNT-OUT
MOVE WS-NET-SALES TO NET-SALES-OUT.
500-FINAL-ROUTINE.
MOVE WS-TOTAL-GROSS-SALES TO TOTAL-GROSS-SALES-OUT.
MOVE WS-TOTAL-DISCOUNT TO TOTAL-DISCOUNT-OUT.
MOVE WS-TOTAL-NET-SALES TO TOTAL-NET-SALES-OUT.
MOVE TOTAL-PRINT-RECORD TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
CLOSE DATA-FILE, PRINT-FILE.
600-HEADER-ROUTINE.
MOVE NAME-RECORD TO PRINT-RECORD.
ADD 1 TO PAGE-NUMBER.
MOVE PAGE-NUMBER TO PAGE-NUMBER-OUT.
WRITE PRINT-RECORD AFTER ADVANCING NEXT-PAGE.
MOVE HEADING-1 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE HEADING-2 TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE SPACES TO PRINT-RECORD.
WRITE PRINT-RECORD AFTER ADVANCING 2 LINES.
MOVE 8 TO LINE-COUNT.