2

我是 Fujitsu COBOL 3.0 软件的新手。我尝试执行一个简单的程序。代码和错误如下。程序中的所有内容似乎都是正确的。谁能帮我吗?在这个软件中是否要遵循任何预标准?

示例 cobol 程序是:

IDENTIFICATION DIVISION.
PROGRAM-ID.  ShortestProgram.

PROCEDURE DIVISION.
DisplayPrompt.
    DISPLAY "I did it".
   STOP RUN. 
--------------------------------------------------------------------------------------
** DIAGNOSTIC MESSAGE ** (NOPRGMID)
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 0: JMN1102I-S  IDENTIFICATION DIVISION HEADER IS MISSING. HEADER ASSUMED TO BE CODED.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 1: JMN1019I-W  INDICATOR AREA MUST CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 1: JMN1005I-W  CHARACTER STRING 'DENTIFICATION' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 1: JMN1356I-W  INVALID WORD 'DENTIFICATION' IS SPECIFIED IN IDENTIFICATION DIVISION. IGNORED UNTIL NEXT PARAGRAPH OR DIVISION.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 2: JMN1019I-W  INDICATOR AREA MUST CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 2: JMN1005I-W  CHARACTER STRING 'ROGRAM-ID' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 4: JMN1019I-W  INDICATOR AREA MUST CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 4: JMN1005I-W  CHARACTER STRING 'ROCEDURE' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 6: JMN1004I-W  RESERVED WORD 'DISPLAY' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 7: JMN1104I-S  PROGRAM-ID PARAGRAPH IS MISSING. PROGRAM-NAME GENERATED BY SYSTEM.
C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 7: JMN1004I-W  RESERVED WORD 'STOP' MUST START IN AREA B. ASSUMED TO START IN AREA B.
STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1
4

3 回答 3

2

Shift everything over 7 columns so that IDENTIFICATION DIVISION starts in column 8 and all subsequent lines began in column 8 or greater.

There's also a compiler switch (can't remember off the top of my head) that allows you to start in col 1

于 2009-03-29T20:43:09.823 回答
2

警告(指区域 B)似乎建议您的代码应该从每行的第二列开始。这就是为什么它找到例如“DENTIFICATION”而不是“IDENTIFICATION”的原因。

我从未在 COBOL 中开发过,但我隐约记得第一列必须为空白,或者 * 表示注释:警告消息似乎表明 / - 和 D 也是有效值。

更新:谷歌建议 COBOL 编译器忽略前 6 列,并且第 7 列具有特殊意义(D 表示调试,* 表示注释,...)。尽管行为可能是特定于编译器的。所以我怀疑你的问题是你的代码从第 7 列开始,它应该是第 8 列。

于 2009-03-29T17:58:55.240 回答
0

Taking a WAG (wild-ass guess) here. Haven't cobol'd since my last year of college.

Your error message says, at the bottom,

STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1

Okay, so I figure you have some warnings (possibly CODE=W), and one or more errors that are actually causing your program to fail.

So, scanning the error message, I see lots of W-s, and one line with an S:

C:\FSC\PCOBOL32\samples\SAMPLE6\SAMPLE7.COB 7: JMN1104I-S PROGRAM-ID PARAGRAPH IS MISSING. PROGRAM-NAME GENERATED BY SYSTEM.

So it seems you're missing your Program-ID paragraph. Looking at your program, I do see a n identification division, which has a program-id.

I can conclude four things from this:
1) Your identification division paragraph is malformed
2) As Neil said, you aren't running your snippet, but a sample that does not have an ID paragraph. Open sample7.cob and see
3) Some other issue is causing the error, but it is being hidden or misinterpreted as an ID paragraph error

于 2009-03-29T17:26:56.457 回答