cobol编译器错误消息是否还有其他原因?
"TBBNR" was not a uniquely defined name.
The definition to be used could not be determined from the context.
The reference to the name was discarded.
与多次定义变量相比?
我有一个小的数组,我想从中打印相关条目:
01 TABINHALTBRNR.
05 FILLER PIC X(11) VALUE '77917982 02'.
05 FILLER PIC X(11) VALUE '01000046 09'.
05 FILLER PIC X(11) VALUE '29029435 10'.
05 FILLER PIC X(11) VALUE '39808565 11'.
05 FILLER PIC X(11) VALUE '44826590 12'.
05 FILLER PIC X(11) VALUE '34216875 13'.
05 FILLER PIC X(11) VALUE '87119697 15'.
05 FILLER PIC X(11) VALUE '54301143 16'.
05 FILLER PIC X(11) VALUE '55419988 17'.
05 FILLER PIC X(11) VALUE '72302437 18'.
05 FILLER PIC X(11) VALUE '81116613 21'.
05 FILLER PIC X(11) VALUE '62207726 24'.
05 FILLER PIC X(11) VALUE '01000024 25'.
05 FILLER PIC X(11) VALUE '26109788 28'.
05 FILLER PIC X(11) VALUE '90209055 70'.
05 FILLER PIC X(11) VALUE '98503184 71'.
05 FILLER PIC X(11) VALUE '98094032 80'.
05 FILLER PIC X(11) VALUE '66667777 99'.
01 TABBRNR REDEFINES TABINHALTBRNR.
05 FILLER OCCURS 18.
10 TBBNR PIC X(8).
10 FILLER PIC X(1).
10 TBRNR PIC X(2).
但是在这里,当我实际上试图使用数组中的变量时,却遇到了上面提到的错误:
PERFORM VARYING IX FROM 1 BY 1 UNTIL IX > 25
END-PERFORM
IF IX < 26
MOVE TBBNR(IX) TO DSME-BBNREP
END-IF
现在我的问题是,如果我在数组以外的任何地方定义了 TBBNR ,解决方案将显而易见,但实际上我的代码中没有在其他地方定义它!那么还会有其他原因导致此错误吗?
答案 0 :(得分:2)
我尝试编译您显示的代码,并且在编译过程中确实出现以下错误。
IGYDS1266-E The name "TBBNR" was used for an item that was not defined as a data-name. References to this name may be
resolved incorrectly.
IGYPS0037-S "TBBNR" was not a uniquely defined name. The definition to be used could not be determined from the context.
The reference to the name was discarded.
然后,我通过以下消息获取了IGYDS1266
代码。
Because the field and the PROGRAM-ID have the same
name, the following compile error occurs. In the
program output, the following error message is printed
all on one line.
IGYDS1266-E The name xxxxxxxx was used for an
item that was not defined as a data-name.
References to this name may be resolved
incorrectly.
User response: Follow these steps:
1. Make either of the following changes:
- Modify the value of the Program Name that is specified for the flow in the generation properties
file.
- Rename and Refactor the field in the message.
2. Rerun the Generate Runtime Code wizard.
我从第一步走了第二个点,将TBBNR重命名为TUB。重命名后,编译器未引发错误。
代码:
IDENTIFICATION DIVISION.
PROGRAM-ID. TBBNR.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TABINHALTBRNR.
05 FILLER PIC X(11) VALUE '77917982 02'.
05 FILLER PIC X(11) VALUE '01000046 09'.
05 FILLER PIC X(11) VALUE '29029435 10'.
05 FILLER PIC X(11) VALUE '39808565 11'.
05 FILLER PIC X(11) VALUE '44826590 12'.
05 FILLER PIC X(11) VALUE '34216875 13'.
05 FILLER PIC X(11) VALUE '87119697 15'.
05 FILLER PIC X(11) VALUE '54301143 16'.
05 FILLER PIC X(11) VALUE '55419988 17'.
05 FILLER PIC X(11) VALUE '72302437 18'.
05 FILLER PIC X(11) VALUE '81116613 21'.
05 FILLER PIC X(11) VALUE '62207726 24'.
05 FILLER PIC X(11) VALUE '01000024 25'.
05 FILLER PIC X(11) VALUE '26109788 28'.
05 FILLER PIC X(11) VALUE '90209055 70'.
05 FILLER PIC X(11) VALUE '98503184 71'.
05 FILLER PIC X(11) VALUE '98094032 80'.
05 FILLER PIC X(11) VALUE '66667777 99'.
01 TABBRNR REDEFINES TABINHALTBRNR.
05 TABLE1 OCCURS 18.
10 TUB PIC X(8).
10 FILLER PIC X(1).
10 TBRNR PIC X(2).
01 WS-HOLD PIC X(11).
01 IX PIC 9(2).
PROCEDURE DIVISION.
PERFORM VARYING IX FROM 1 BY 1 UNTIL IX > 25
END-PERFORM.
IF IX < 26
MOVE TUB(IX) TO WS-HOLD
DISPLAY WS-HOLD
END-IF.
DISPLAY 'HELLO'
STOP RUN.
输出:
********************************* TOP OF DATA **********************************
HELLO
******************************** BOTTOM OF DATA ********************************
答案 1 :(得分:0)
赋予PROGRAM-ID的值是定义的名称,因此不能在其他地方使用。对于文件句柄也是如此。
生成一个编译列表,并在其中搜索应该重复的已定义名称-您会发现它是正确的。