IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reg:- Using FD name explictly


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashok4u_it

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Wed Jul 15, 2009 6:40 pm
Reply with quote

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
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Jul 15, 2009 6:43 pm
Reply with quote

Please paste the declaration of the copybook as well as your FDs.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 15, 2009 7:03 pm
Reply with quote

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
View user's profile Send private message
ashok4u_it

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Wed Jul 15, 2009 7:04 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 15, 2009 7:07 pm
Reply with quote

we only need you to use the link that I gave, so that you will see the proper syntax.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Jul 15, 2009 7:16 pm
Reply with quote

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
View user's profile Send private message
ashok4u_it

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Wed Jul 15, 2009 7:32 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jul 15, 2009 7:34 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 15, 2009 7:56 pm
Reply with quote

try this:
MOVE BUSI-BUS-INDICT-DSC OF DCOM2-FILE(1) TO
Back to top
View user's profile Send private message
ashok4u_it

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Wed Jul 15, 2009 8:01 pm
Reply with quote

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
View user's profile Send private message
ashok4u_it

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Wed Jul 15, 2009 8:05 pm
Reply with quote

sorry dbzTHEdinosauer!

I havent checked your post.

Thanks for your effort.
Ashok Kumar.K
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Search our Forums:

Back to Top