开发者

Having trouble with my lines in COBOL

开发者 https://www.devze.com 2023-01-29 03:10 出处:网络
I am having a little issue I cannot solve. My lines are showing up wrong on my output. For example I have a line that is suppose to show up like this:

I am having a little issue I cannot solve. My lines are showing up wrong on my output. For example I have a line that is suppose to show up like this:

123-45-6789 J S Doe Second Yr Programming 88 266 3.02

but instead is showing up like this:

123-45-6789 J S Doe Second Yr Programming 88 266

3.02

Anyone know how to fix this. I have never encountered this problem before.

Here are is the storage area for the lines

   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.

and here is the code to write it out

   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.


There are a couple of possible explanations for the line break.

The first explanation to eliminate is line wrapping caused by whatever device you are displaying output on. Based on the DETAIL-LINE record layout you have provided, the wrap occurs at column 72. Suspicious. Does your output device (eg. screen, or file) wrap lines at column 72

The next possible explanation involves some non-SPACE character, such as a line feed, stored in BLANK-H-OUT. This may have happened through any number of programming goofs elsewhere in the program. Unchecked out of bounds array/table references are often the source of this sort of thing. Working this out will take some real debugging.


Are you writing to a 72 character wide file? My hunch is that your record is 3 characters too short.

Can you post your File Section?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号