Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Getting Ambiguous identifier error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dileepv

New User


Joined: 03 Nov 2005
Posts: 2
Location: Hyderabad,AP,India

PostPosted: Tue Jun 09, 2015 1:26 am    Post subject: Getting Ambiguous identifier error
Reply with quote

Hello, I am new to this great forum. I am facing a strange problem..

I have a variable defined 3 times as below.

Code:
01 I-DATA.
    05 GROUP-01.
        07 DATA-01 PIC X(10).
        07 DATA-02 PIC X(10).
    05 GROUP-2.
        07 CUST-ID  PIC X(10).              --> 1st CUST-ID
        07 S-I-DAT.
             09 AD-DAT.
                 15 AT-DAT-01.
                     17 CUST-ID PIC X(10).  --> 2nd CUST-ID
                 15 AT-DAT-02.
                     17 CUST-ID PIC X(10).  --> 3rd CUST-ID


While I am referring to 1st CUST-ID, I am getting Ambiguous identifier error. Could you please help me resolving this. Am I defining it incorrectly ?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Jun 09, 2015 2:49 am    Post subject: Reply to: Getting Ambiguous identifier though its correct. Please see
Reply with quote

Why would you want to do that? Just define different names, what's the problem? You're confused, and you are coding it. Think about how the next people along are going to feel.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Jun 09, 2015 6:00 am    Post subject: Reply to: Getting Ambiguous identifier though its correct. Please see
Reply with quote

If you have COBOL V5.2 you can use compiler option QUALIFY(EXTEND) (new in V5.2) to reference your first non-unique item.

Although IBM have added this, I don't know why. Perhaps you can explain why you have that type of structure? Ah. XML-related?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Tue Jun 09, 2015 8:14 am    Post subject:
Reply with quote

Quote:
Am I defining it incorrectly ?
Yes. When you have multiple variables with the same name in COBOL, each much be uniquely identifiable through qualification. Your structure does not allow the first CUST-ID to be uniquely identified -- CUST-ID OF GROUP-2 identifies all three CUST-ID variables. You need an 06 level variable before and after the 07 CUST-ID (with different names for each 06 level) to be able to uniquely qualify the first CUST-ID.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Jun 09, 2015 12:16 pm    Post subject: Reply to: Getting Ambiguous identifier though its correct. Please see
Reply with quote

Robert's way will work (you qualify with the first new 06-level data-name), because the duplicate names are no longer in the same vertical hierarchy, but I suspect it won't work for you as you are generating XML from it (that's still a guess).

Continuing with the guess, my suggestion of not using non-unique names won't do you either.

Which leaves you with using V5.2 (fine if you already have it installed, and the means to use QUALIFY(EXTEND)) or REDEFINES of the 01-level, which is a bit clunky.

You need to explain why you've got those duplicates, and how you want to use them.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm
No new posts IDMS/DC-COBOL program - SNAP error wh... rakeshsekar1987 IDMS/ADSO 5 Tue Sep 13, 2016 8:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us