>In my specific case, there is a COPY structure populated in the outermost p=
>rogram level that is passed in CALL statements to nested COMMON subprograms=
> (which can also CALL each other) and all the COMMON subprograms use the sa=
>me COPY structure to define their LINKAGE parameter. I just did not and do=
> not understand why the compiler cannot use the "local" LINKAGE section def=
>inition in the nested COMMON subprograms.
>
>There are only two levels of nesting here, outermost and then each COMMON s=
>ubprogram at the same level below that.
>
>This works flawlessly when subprograms are not nested but separately compil=
>ed as stand-alone units, so I do not see why it is different in a nested ve=
>rsion. It makes no sense.
>
>Is there a way to tell the compiler that a structure at the OUTERMOST level=
> is NOT to be shared with nested programs? That would solve the particular=
> problem that I have, I think.
I tested this out myself, and I was able to refer to a data item X1 in
a nested program even though X1 was also defined in the containing program.
I was thinking that names in containing programs are automatically GLOBAL,
but they are not. Are you sure the name in the containing program is
not GLOBAL?
This worked for me:
WORKING-STORAGE SECTION.
1 X1 PIC X(8) VALUE 'SUB1'.
PROCEDURE DIVISION.
MOVE 'SUB1' To X1.
ID DIVISION.
PROGRAM-ID. SUB1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
1 X1 PIC 9.
PROCEDURE DIVISION.
Compute X1 = 5.
With X1 being non-unique...I wonder why it did not work for you?
Cheers,
TomR >> COBOL is the Language of the Future! <<
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN