嘿所有,我还有一个任务要在COBOL完成本季度,我就出去了。问题是我在ACCEPT SCREEN-IMAGE命令中遇到语法错误,该程序需要有用户输入。我不明白我做错了什么,所以我被卡住了。我相信其他一切都是正确的,所以一旦弄清楚我就完成了。这是代码:
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.
任何和所有帮助将不胜感激。
答案 0 :(得分:2)
@Gabe与许多人认为的相反,一段时间(句号)并不是结束COBOL声明的唯一方法。
Move A To B
Move C To D
在逻辑上等同于
Move A To B.
Move C To D.
它松鼠的地方
If A = B
Move C To D
Add 1 To E.
如果我在D之后放一段时间,1将无条件地添加到E中。 COBOL 85标准为许多语句添加了显式范围终止符,因此我们可以更容易地在视觉上解析构造
If A = B
Move C To D
Add 1 To E
End-If
现在,如果我在D之后放一段时间,我将收到编译错误。我现在知道的大多数COBOL程序员现在使用显式范围终止符,并且只使用句点结束段落名称和段落,否则将它们从程序部门中删除。
答案 1 :(得分:2)
也许您需要屏幕上的一些输入和/或更新字段才能ACCEPT
它?我认为输入字段的描述中有TO
个词组,更新字段中有USING
个词组。我在屏幕描述中看到的唯一内容是文字和FROM
短语。基本上,没有ACCEPT
!