gpt4 book ai didi

compiler-errors - “Not a uniquely defined name”什么时候只有一个定义?

转载 作者:行者123 更新时间:2023-12-02 10:51:13 26 4
gpt4 key购买 nike

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 ,则解决方案将很明显,但实际上我的代码中没有在其他地方定义它!那么是否可能有其他原因导致此错误?

最佳答案

我尝试编译您显示的代码,并且在编译期间确实出现以下错误。

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 ********************************

关于compiler-errors - “Not a uniquely defined name”什么时候只有一个定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52292017/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com