Hi guys,
I’m facing a problem, I have a file contains some information, but when I compiled it I found that the code didn’t work, please help me fixing the problem, Here is the code :
IDENTIFICATION DIVISION.
PROGRAM-ID. MONEY.
AUTHOR. STUDENT.
*
ENVIRONMENT DIVISION.
*
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ACC-RECS ASSIGN TO CUSTRECS.
SELECT PRT-DONE ASSIGN TO TOPACCTS.
DATA DIVISION.
FILE SECTION.
FD ACC-RECS RECORD CONTAINS 80 CHARACTERS RECORDING MODE F.
01 PRINT-REC.
05 FIRST-NAME PIC X(11).
05 LAST-NAME PIC X(22).
05 FILLER PIC X(28) VALUE SPACES.
05 ACC-BAL PIC X(10).
05 FILLER PIC X(9) VALUE SPACES.
FD PRT-DONE RECORD CONTAINS 80 CHARACTERS RECORDING MODE F.
01 PRT-REC.
05 PRT-FIRST-NAME PIC X(11) VALUE SPACES.
05 PRT-LAST-NAME PIC X(22) VALUE SPACES.
05 PRT-ACC-BAL PIC Z,ZZZ,ZZZ.99.
05 FILLER PIC X(35) VALUE SPACES.
WORKING-STORAGE SECTION.
01 FLAGS.
05 LASTREC PIC X VALUE SPACE.
01 COUNTERS.
05 REC-COUNTER PIC 9(2) VALUE 0.
01 HEADER-1.
05 FILLER PIC X(37) VALUE
'REPORT OF TOP ACCOUNT BALANCE HOLDERS'.
05 FILLER PIC X(43) VALUE SPACES.
01 HEADER-2.
05 FILLER PIC X(29) VALUE 'PREPARED FOR PAT STANDARD ON '.
05 HDR-MO PIC X(02).
05 FILLER PIC X VALUE '.'.
05 HDR-DAY PIC X(02).
05 FILLER PIC X VALUE '.'.
05 HDR-YR PIC 9(04).
05 FILLER PIC X(41) VALUE SPACES.
01 HEADER-3.
05 FILLER PIC X(14) VALUE '# OF RECORDS: '.
05 FILLER PIC X(66) VALUE SPACES.
01 HEADER-4.
05 FILLER PIC X(38) VALUE
'======================================'.
05 FILLER PIC X(42) VALUE SPACES.
01 WS-CURRENT-DATE-DATA.
05 WS-CURRENT-DATE.
10 WS-CURRENT-YEAR PIC 9(04).
10 WS-CURRENT-MONTH PIC 9(02).
10 WS-CURRENT-DAY PIC 9(02).
05 WS-CURRENT-TIME.
10 WS-CURRENT-HOURS PIC 9(02).
10 WS-CURRENT-MINUTE PIC 9(02).
10 WS-CURRENT-SECOND PIC 9(02).
10 WS-CURRENT-MILLISECONDS PIC 9(02).
*-----------------
PROCEDURE DIVISION.
*-----------------
OPEN-FILES.
OPEN INPUT ACC-RECS.
OPEN OUTPUT PRT-DONE.
WRITE-HEADERS.
MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-DATA.
MOVE WS-CURRENT-YEAR TO HDR-YR.
MOVE WS-CURRENT-MONTH TO HDR-MO.
MOVE WS-CURRENT-DAY TO HDR-DAY.
WRITE PRT-REC FROM HEADER-1.
WRITE PRT-REC FROM HEADER-2.
WRITE PRT-REC FROM HEADER-3.
WRITE PRT-REC FROM HEADER-4.
READ-NEXT-RECORD.
PERFORM READ-RECORD
PERFORM UNTIL LASTREC = 'Y'
COMPUTE PRT-ACC-BAL = FUNCTION NUMVAL-C(ACC-BAL)
PERFORM IS-EIGHT-FIVE
PERFORM READ-RECORD
END-PERFORM.
CLOSE-STOP.
CLOSE ACC-RECS.
CLOSE PRT-DONE.
STOP RUN.
READ-RECORD.
READ ACC-RECS
AT END MOVE 'Y' TO LASTREC
NOT AT END COMPUTE REC-COUNTER = REC-COUNTER + 1
END-READ.
IS-EIGHT-FIVE.
IF PRT-ACC-BAL >= 8500000 THEN
MOVE FIRST-NAME TO PRT-FIRST-NAME
MOVE LAST-NAME TO PRT-LAST-NAME
WRITE PRT-REC
END-IF.