我正在尝试查看我正在处理的此程序的输出。我被指示使用记事本,但每次打开文件时,我都会获得旧的输出,然后再对其进行更改。我不知道这是编程错误还是技术问题。你们可以看一看,看看有什么问题吗?
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.
在这里输入代码
答案 0 :(得分:1)
通常的嫌疑人是
答案 1 :(得分:0)
确保在再次运行程序时没有打开输出文件。另外,找一个更好的文本编辑器,如Notepad ++来使用。
答案 2 :(得分:0)
删除或重命名" old"文件确定。
你可以添加" eyecatcher"写作验证。
如果文件时间戳正在更改但输出不是您正在运行旧版本。
您是否更改了代码中的文件名但正在检查旧名称?