开发者

Making a Screen (COBOL)

Hey all, I got one more assignment to complete for the quarter in COBOL and I am out. The thing is I am getting a syntax error at the ACCEPT SCREEN-IMAGE command and this program needs to have user input. I don't see what I am doing wrong so I am stuck. I believe that everything else is put in right so once this is figured out I am done. Here is the code:

SCREEN SECTION.
   01  SCREEN-IMAGE.
       05  BLANK SCREEN
           BACKGROUND-COLOR 0
           FOREGROUND-COLOR 15.
       05  LINE 02  COLUMN 02  PIC X(8)
               FROM CURRENT-TIME.
       05  LINE 02  COLUMN 26  PIC X(28)
               FROM TITLE-LINE
               FOREGROUND-COLOR 09.
       05  LINE 02  COLUMN 40  PIC X(8)
               FROM DATE-TODAY.
       05  LINE 05  COLUMN 02
               VALUE 'FUNCTION CODE:'
               FOREGROUND-COLOR 09.
       05  LINE 05  COLUMN 12  PIC X(3)
               FROM CODE-SCREEN AUTO.
       05  LINE 05  COLUMN 17
               VALUE '<ADD, CHG, DEL, INQ, END>'.
       05  LINE 09  COLUMN 17
               VALUE 'REP CODE:'
               FOREGROUND-COLOR 09.
开发者_运维百科       05  LINE 09  COLUMN 29  PIC X(3)
               FROM REP-SCREEN AUTO.
       05  LINE 11  COLUMN 17
               VALUE 'NAME:'
               FOREGROUND-COLOR 09.
       05  LINE 11  COLUMN 29  PIC X(3)
               FROM NAME-SCREEN AUTO.
       05  LINE 13  COLUMN 17
               VALUE 'DISTRICT:'
               FOREGROUND-COLOR 09.
       05  LINE 13  COLUMN 29  PIC X(3)
               FROM DIST-SCREEN AUTO.
       05  LINE 15  COLUMN 17
               VALUE 'COMMISSION RATE:'
               FOREGROUND-COLOR 09.
       05  LINE 15  COLUMN 29  PIC X(3)
               FROM COM-SCREEN AUTO.
       05  LINE 17  COLUMN 17
               VALUE 'DATE ADDED:'
               FOREGROUND-COLOR 09.
       05  LINE 17  COLUMN 29  PIC X(10)
               FROM ADD-DATE.
       05  LINE 19  COLUMN 17
               VALUE 'DATE CHANGED:'
               FOREGROUND-COLOR 09.
       05  LINE 19  COLUMN 29  PIC X(3)
               FROM CHANGE-DATE.
       05  LINE 24  COLUMN 17  PIC X(29)
               FROM ERROR-DISPLAY.

   PROCEDURE DIVISION.
   100-MAIN.
       OPEN I-O   REP-MASTER-FILE
       CALL 'DATETIME' USING DATE-TIME-PASS-AREA
       MOVE DATE-MMDDYY-SLASHES TO DATE-TODAY
       MOVE TIME-HHMMSSXX-COLONS TO CURRENT-TIME
       PERFORM UNTIL CODE-SCREEN = 'END' OR 'end'
           DISPLAY SCREEN-IMAGE
           ACCEPT SCREEN-IMAGE
           MOVE 0 TO ERROR-COUNT
           PERFORM 150-CHECK-COM
           PERFORM 140-CHECK-DIST
           PERFORM 130-CHECK-NAME
           PERFORM 120-CHECK-REP
           PERFORM 110-CHECK-CODE
           IF ERROR-COUNT = 0
               PERFORM 200-PROCESS-ONE-RECORD
           END-IF
       END-PERFORM

       CLOSE REP-MASTER-FILE
       STOP RUN.

Any and all help will be appreciated.


@Gabe Contrary to what many people believe, a period (full stop) is not the only way to end a statement in COBOL.

Move A To B
Move C To D

is logically equivalent to

Move A To B.
Move C To D.

Where it gets squirrelly is

If A = B
    Move C To D
    Add 1 To E.

If I put a period after the D, 1 will be added to E unconditionally. The COBOL 85 standard added explicit scope terminators to many statements, so we got the more easily visually parsed construct

If A = B
    Move C To D
    Add 1 To E
End-If

Now if I put a period after the D I will get a compile error. Most COBOL programmers I know now use explicit scope terminators and only end paragraph names and paragraphs with a period, otherwise banishing them from the Procedure Division.


Maybe you need a few input and/or update fields on your screen in order to ACCEPT it? I think input fields have a TO phrase in their descriptions and update fields have a USING phrase. The only thing I see in your screen description are literals and FROM phrases. Basically, nothing to ACCEPT!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜