View previous topic :: View next topic
|
Author |
Message |
ashok4u_it
New User
Joined: 12 Mar 2008 Posts: 53 Location: Chennai
|
|
|
|
Hi all,
I am in need to use the same copybook in same program. When we go ahead in using same copybook in same program, we will get "<Variable> was not a uniquely defined name" error message.
To overcome this issue, we are suppossed to specify the FD name of the respective field explicitly as follow.
MOVE BUSI-ACCT-EXP-DTE OF DCOM2-FILE TO
WS-BUSI-ACCT-EXP-DTE
But, I am facing some problem for the variable with subscript as shown
below.
MOVE BUSI-BUS-INDICT-DSC(1) OF DCOM2-FILE TO
WS-BUSI-BUS-INDICT-DSC1
"BUSI-BUS-INDICT-DSC" 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.
Can anyone please help me out to resolve this issue in COBOL.
Thanks in Advance,
Ashok Kumar.K |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Please paste the declaration of the copybook as well as your FDs. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
any COBOL ref has the proper syntax
we don't need copybook defs or FD defs. this is purely a syntax problem. |
|
Back to top |
|
|
ashok4u_it
New User
Joined: 12 Mar 2008 Posts: 53 Location: Chennai
|
|
|
|
This is my FD section.
Code: |
FILE SECTION.
FD DCOM1-FILE
RECORDING MODE IS V
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
COPY BERWDHSS.
FD DCOM2-FILE
RECORDING MODE IS V
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
COPY BERWDHSS. |
and my working storage section
Code: |
WORKING-STORAGE SECTION.
01 WS-DCORP-REC.
05 WS-BUSI-BUS-INDICT-DSC1 PIC X(10) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES.
05 WS-BUSI-BUS-INDICT-DSC2 PIC X(10) VALUE SPACES.
05 FILLER PIC X(01) VALUE SPACES. |
and the core logic part is
Code: |
MOVE BUSI-BUS-INDICT-DSC(1) OF DCOM2-FILE TO
WS-BUSI-BUS-INDICT-DSC1
MOVE BUSI-BUS-INDICT-DSC(2) OF DCOM2-FILE TO
WS-BUSI-BUS-INDICT-DSC2 |
Let me know for any further information.
Regards
Ashok Kumar.K
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
we only need you to use the link that I gave, so that you will see the proper syntax. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
You haven't pasted the copybook declaration. I assume its starting from 01 level.
If you want to use the same copybook multiple times in one program, it should not start from 01 level. Change your copybook and declare another variable at 01 level before including your copybook. |
|
Back to top |
|
|
ashok4u_it
New User
Joined: 12 Mar 2008 Posts: 53 Location: Chennai
|
|
|
|
Sorry for saying this. Its a production copybook. I am not suppossed to change this copybook. I dont have permission to change it.
Is there anyother way to solve the issue with this constraints.
Thanks
Ashok Kumar.K |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Contrary to Bharath's statement, the copy book is allowed to be at the 01 level, but if so the 01 level must not be referenced in the program. Section 1.8.1.1 Qualification in the COBOL Language Reference manual states
Quote: |
In any hierarchy, the data-name associated with the highest level must be unique if it is referenced, and cannot be qualified. |
We do need to see the copy book definition in the program -- at least the first few lines within each FD.
And we're not talking about changing the copy book, we need to see what it looks like. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
try this:
MOVE BUSI-BUS-INDICT-DSC OF DCOM2-FILE(1) TO |
|
Back to top |
|
|
ashok4u_it
New User
Joined: 12 Mar 2008 Posts: 53 Location: Chennai
|
|
|
|
Hi all,
I got a solution for this issue. Instead of coding that way, the code should be like this.
MOVE BUSI-BUS-INDICT-DSC OF DCOM2-FILE (1) TO
WS-BUSI-BUS-INDICT-DSC1
MOVE BUSI-BUS-INDICT-DSC OF DCOM2-FILE (2) TO
WS-BUSI-BUS-INDICT-DSC2
Thanks for all your efforts.
Ashok Kumar.K |
|
Back to top |
|
|
ashok4u_it
New User
Joined: 12 Mar 2008 Posts: 53 Location: Chennai
|
|
|
|
sorry dbzTHEdinosauer!
I havent checked your post.
Thanks for your effort.
Ashok Kumar.K |
|
Back to top |
|
|
|