This is an Enterprise COBOL V6.2 question. I am not sure if this is a compiler
issue or a programmer misunderstanding issue.
I have a COBOL subroutine which has multiple nested programs within it. The
general structure is as follows (it's actually far more complicated with COPY
members and such, but this shows the basic issue). Note carefully that the
INSIDE1 subroutine is declared COMMON because other nested subroutines (not
shown here) may also CALL it besides the CALL from the top-level program:
ID DIVISION.
PROGRAM-ID. SUBMAIN.
. . . . .
WORKING-STORAGE SECTION.
01 RECORD-NAME.
05 SUBSECTION-NAME.
10 SUBSECTION-VAR PIC X.
PROCEDURE DIVISION.
. . . . .
CALL "INSIDE1" USING RECORD-NAME.
. . . . .
ID DIVISION.
PROGRAM-ID. INSIDE1 COMMON.
. . . . .
WORKING-STORAGE SECTION.
01 WS-AREA.
05 WS-SUBSECTION-NAME PIC X.
LINKAGE SECTION.
01 RECORD-NAME.
05 SUBSECTION-NAME.
10 SUBSECTION-VAR PIC X.
. . . . .
PROCEDURE DIVISION USING RECORD-NAME.
. . . . .
MOVE SUBSECTION-NAME TO WS-SUBSECTION-NAME.
. . . . .
EXIT PROGRAM.
END-PROGRAM INSIDE1.
END-PROGRAM SUBMAIN.
The MOVE statement in the nested subroutine INSIDE1 gets this COBOL error:
25779 IGYPS0037-S "SUBSECTION-NAME" 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.
The V6.2 Language Reference Manual on page 60 says this about using identical
names in nested programs:
"Identical names
When programs are directly or indirectly contained within other programs, each
program can use identical
user-defined words to name resources.
A program references the resources that program describes rather than the
same-named resources
described in another program, even if the names are different types of
user-defined words."
Is that language in the manual telling me that I may have a compiler bug here,
or am I misunderstanding the language in the manual and have to code the names
used in the nested subroutine differently (e.g., by using a unique prefix for
all the common data names or at least for the top-level name)?
TIA for any assistance you can provide.
Peter
--
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN