我有一个小问题我无法解决。我的输出显示错误。例如,我有一条线,假设显示如下:
123-45-6789 J S Doe Second Yr Programming 88 266 3.02
但是却出现了这样的情况:
123-45-6789 J S Doe Second Yr Programming 88 266
3.02
任何人都知道如何解决这个问题。我以前从未遇到过这个问题。
以下是行的存储区域
01 DETAIL-LINE.
05 DL-FIRST-NUM PIC X(3).
05 DL-DASH-1 PIC X VALUE '-'.
05 DL-SECOND-NUM PIC XX.
05 DL-DASH-2 PIC X VALUE '-'.
05 DL-THIRD-NUM PIC X(4).
05 BLANK-A-OUT PIC X(3) VALUE SPACES.
05 DL-FIRST-LETTER PIC X.
05 BLANK-B-OUT PIC X VALUE SPACES.
05 DL-SECOND-LETTER PIC X.
05 BLANK-C-OUT PIC X VALUE SPACES.
05 DL-LAST-NAME PIC X(9).
05 BLANK-D-OUT PIC X(2) VALUE SPACES.
05 DL-CLASS-STANDING PIC X(9).
05 BLANK-E-OUT PIC X(3) VALUE SPACES.
05 DL-MAJOR PIC X(13).
05 BLANK-F-OUT PIC X(3) VALUE SPACES.
05 DL-HOURS PIC ZZ9.
05 BLANK-G-OUT PIC X(5) VALUE SPACES.
05 DL-POINTS PIC ZZ9.
05 BLANK-H-OUT PIC X(4) VALUE SPACES.
05 DL-GPA PIC 9.99.
以下是写出来的代码
400-PROCESS-ONE-RECORD.
IF LINE-COUNT >= 52
PERFORM 600-NEXT-PAGE
END-IF
ADD 2 TO LINE-COUNT
MOVE SSN-IN TO SSN-BREAK
MOVE FIRST-NUM TO DL-FIRST-NUM
MOVE SECOND-NUM TO DL-SECOND-NUM
MOVE THIRD-NUM TO DL-THIRD-NUM
MOVE STUDENT-NAME-IN TO NAME-BREAK
MOVE FIRST-LETTER TO DL-FIRST-LETTER
MOVE SECOND-LETTER TO DL-SECOND-LETTER
MOVE LAST-NAME TO DL-LAST-NAME
IF CLASS-STANDING-IN = 0
MOVE 'HIGH SCHOOL' TO DL-CLASS-STANDING
END-IF
IF CLASS-STANDING-IN = 1
MOVE 'First Yr' TO DL-CLASS-STANDING
END-IF
IF CLASS-STANDING-IN = 2
MOVE 'Second Yr' TO DL-CLASS-STANDING
END-IF
IF CLASS-STANDING-IN = 3
MOVE 'PROGRAM 60' TO DL-CLASS-STANDING
END-IF
IF CLASS-STANDING-IN = ' ' OR 4
MOVE ' ' TO DL-CLASS-STANDING
END-IF
IF MAJOR-IN = 'NES'
MOVE 'Net Security' TO DL-MAJOR
END-IF
IF MAJOR-IN = 'NET'
MOVE 'Networking' TO DL-MAJOR
END-IF
IF MAJOR-IN = 'PGM'
MOVE 'Programming' TO DL-MAJOR
END-IF
IF MAJOR-IN = 'DIG'
MOVE 'Digital Media' TO DL-MAJOR
END-IF
IF MAJOR-IN = 'COR'
MOVE ' ' TO DL-MAJOR
END-IF
MOVE CREDIT-HOURS-IN TO DL-HOURS
IF MAJOR-IN = 'NES'
ADD 1 TO NES-TOTAL
END-IF
IF MAJOR-IN = 'NET'
ADD 1 TO NET-TOTAL
END-IF
IF MAJOR-IN = 'PGM'
ADD 1 TO PGM-TOTAL
END-IF
IF MAJOR-IN = 'DIG'
ADD 1 TO DIG-TOTAL
END-IF
MOVE CREDIT-POINTS-IN TO DL-POINTS
COMPUTE TOTAL-GPA ROUNDED
= CREDIT-POINTS-IN / CREDIT-HOURS-IN
IF MAJOR-IN = 'NES' AND TOTAL-GPA > '3.O'
ADD 1 TO NES-GPA
END-IF
IF MAJOR-IN = 'NET' AND TOTAL-GPA > '3.O'
ADD 1 TO NET-GPA
END-IF
IF MAJOR-IN = 'PGM' AND TOTAL-GPA > '3.O'
ADD 1 TO PGM-GPA
END-IF
IF MAJOR-IN = 'DIG' AND TOTAL-GPA > '3.O'
ADD 1 TO DIG-GPA
END-IF
MOVE TOTAL-GPA TO DL-GPA
MOVE DETAIL-LINE TO STUDENTS-RECORD-OUT
IF DL-CLASS-STANDING = 'First Yr' OR 'Second Yr' AND
GRAD-STAT-IN = ' ' OR 'X'
ADD CREDIT-POINTS-IN TO TOTAL-POINTS
ADD CREDIT-HOURS-IN TO TOTAL-HOURS
WRITE STUDENTS-RECORD-OUT
AFTER ADVANCING 1 LINES
END-IF.
答案 0 :(得分:1)
对于换行符有几种可能的解释。
要消除的第一个解释是由行引起的换行
您正在显示输出的任何设备。基于DETAIL-LINE
记录
你提供的布局,包裹发生在第72列。可疑。您的输出设备(例如屏幕或文件)是否在第72列换行
下一个可能的解释涉及一些非空格字符,例如换行符,
存储在BLANK-H-OUT
中。这可能是通过任何数量的编程蠢事发生的
该计划的其他地方。未经检查的超出范围的数组/表引用通常是
这种事情的来源。解决这个问题需要进行一些实际调试。
答案 1 :(得分:0)
您是否正在写入72个字符宽的文件?我的预感是你的记录太短了3个字符。
您可以发布文件部分吗?