我正在尝试查看我正在处理的这个程序的输出。我被指示使用记事本,但每次打开文件时,我都会得到旧的输出,然后再对其进行更改。我不知道这是我的编程错误还是技术失误。各位大佬可以看看是怎么回事吗?
IDENTIFICATION DIVISION.
PROGRAM-ID. CH0402Practice.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PAYROLL-MASTER
ASSIGN TO "C0402.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PRINT-FILE
ASSIGN TO "C0402.RPT".
DATA DIVISION.
FILE SECTION.
FD PAYROLL-MASTER
LABEL RECORDS ARE STANDARD
RECORD CONTAINS 80 CHARACTERS
BLOCK CONTAINS 20 RECORDS.
01 MASTER-REC.
05 EMP-NO-IN PIC X(5).
05 NAME-IN PIC X(20).
05 LOC-CODE-IN.
10 TERR-NO-IN PIC XX.
10 OFFICE-NO-IN PIC XX.
05 SALARY-IN PIC 9(6).
05 SS-NO-IN PIC 9(9).
05 DEP-IN PIC 99.
05 JOB-CLASS-IN PIC 99.
05 PIC X(32).
FD PRINT-FILE
LABEL RECORDS ARE OMITTED
RECORD CONTAINS 80 CHARACTERS.
01 REPORT-OUT PIC X(80).
WORKING-STORAGE SECTION.
01 ARE-THERE-MORE-RECORDS PIC XXX.
01 HEADING-LINE1.
05 PIC X(33) VALUE SPACES.
05 PIC X(15) VALUE
"PAYROLL LISTING".
05 PIC X(32) VALUE SPACES.
01 HEADING-LINE2.
05 PIC X(5) VALUE SPACES.
05 PIC X(10) VALUE
"EMP NUMBER".
05 PIC X(4) VALUE SPACES.
05 PIC X(4) VALUE
"NAME".
05 PIC X(16) VALUE
"SALARY".
05 PIC X(7) VALUE SPACES.
05 PIC X(5) VALUE
"SS NO".
05 PIC X(9) VALUE
"DEPENDENT".
05 PIC X(25) VALUE SPACES.
01 DETAIL-LINE.
05 PIC X(5).
05 EMP-NO-OUT PIC X(5).
05 PIC X(14).
05 NAME-OUT PIC X(20).
05 PIC X(4).
05 SALARY-OUT PIC 9(6).
05 PIC X(7).
05 SS-NO-OUT PIC 9(9).
05 PIC X(7).
05 DEP-OUT PIC 99.
05 PIC X(21).
PROCEDURE DIVISION.
100-MAIN-MODULE.
PERFORM 100-INITIALIZATION-MODULE.
PERFORM 200-PRINT-MODULE
UNTIL ARE-THERE-MORE-RECORDS = 'NO '.
CLOSE PAYROLL-MASTER
PRINT-FILE.
STOP RUN.
100-INITIALIZATION-MODULE.
OPEN INPUT PAYROLL-MASTER
OUTPUT PRINT-FILE.
MOVE 'YES' TO ARE-THERE-MORE-RECORDS.
PERFORM 300-TOP-OF-PAGE-MODULE.
PERFORM 600-READ-MODULE.
200-PRINT-MODULE.
MOVE SPACES TO REPORT-OUT.
MOVE EMP-NO-IN TO EMP-NO-OUT.
MOVE NAME-IN TO NAME-OUT.
MOVE SALARY-IN TO SALARY-OUT.
MOVE SS-NO-IN TO SS-NO-OUT.
MOVE DEP-IN TO DEP-OUT.
MOVE DETAIL-LINE TO REPORT-OUT.
WRITE REPORT-OUT AFTER ADVANCING 1 LINES.
PERFORM 600-READ-MODULE.
300-TOP-OF-PAGE-MODULE.
MOVE HEADING-LINE1 TO REPORT-OUT.
WRITE REPORT-OUT AFTER ADVANCING 1 LINES.
MOVE SPACES TO REPORT-OUT.
WRITE REPORT-OUT AFTER ADVANCING 1 LINES.
MOVE HEADING-LINE2 TO REPORT-OUT.
WRITE REPORT-OUT AFTER ADVANCING 1 LINES.
600-READ-MODULE.
READ PAYROLL-MASTER
AT END MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
END-READ.
在这里输入代码