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

Cobol II Error: NOT A UNIQUELY DEFINED NAME


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Tue Sep 25, 2007 4:59 am
Reply with quote

Hi! i am writing a tax program but i keep getting this error could someone help me please.....

"SALE-AMOUNT" WAS NOT A UNIQUELY DEFINED NAME. THE DEFINITION TO BE USED CONTEXT. THE REFERENCE TO THE NAME WAS DISCARDED.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Sep 25, 2007 5:25 am
Reply with quote

Use a higher level reference?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Sep 25, 2007 6:14 am
Reply with quote

MANUEL LEMA wrote:
Hi! i am writing a tax program but i keep getting this error could someone help me please.....

"SALE-AMOUNT" WAS NOT A UNIQUELY DEFINED NAME. THE DEFINITION TO BE USED CONTEXT. THE REFERENCE TO THE NAME WAS DISCARDED.
You just need to change SALE-AMOUNT in one of the places that you define it or qualify the name when you use it.
Back to top
View user's profile Send private message
kbmkris

Active User


Joined: 24 Jun 2006
Posts: 101

PostPosted: Tue Sep 25, 2007 6:25 am
Reply with quote

hi Lema,

Check whether the variable SALE-AMOUNT is defined twice in your source code. If it is coded and you felt that necessary, try to put them under different group variables and while accessing that you must mention the group variable like SALE-AMOUNT of TAX-REC1 likewise.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Wed Sep 26, 2007 1:02 pm
Reply with quote

Hi Lema,

I think that might be coming because of the copybook variables.

you might have declared a variable that is used in copybook.

So at compile time you will get this message.

Check in the dump where it is showing the duplicate,there you will have your copybook expanded.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Sep 26, 2007 2:20 pm
Reply with quote

Hi MANUEL LEMA,

If you post the the definition of "SALE-AMOUNT", it'll be easier for me or some one here to answer your query.

Variable "SALE-AMOUNT" is from FD entries or declared in working-storage or from some COPYBOOK ?
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Thu Sep 27, 2007 12:34 am
Reply with quote

Anuj D. wrote:
Hi MANUEL LEMA,

If you post the the definition of "SALE-AMOUNT", it'll be easier for me or some one here to answer your query.

Variable "SALE-AMOUNT" is from FD entries or declared in working-storage or from some COPYBOOK ?


well it is declared in the working -storage section under
01 sales record w
05 sale-amount pic 9(4)v99.
then in the detail line
01 detail-line.
05 sale-amount pic zz,zz9.99
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 27, 2007 12:46 am
Reply with quote

When referring to one or the other use the next available unique higher level data name:
Move sale-amount of sales-record to sale-amount of detail-line.

Do you need a link to the explanative section in the manual?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Sep 27, 2007 12:48 am
Reply with quote

MANUEL LEMA wrote:
well it is declared in the working -storage section under
01 sales record w
05 sale-amount pic 9(4)v99.
then in the detail line
01 detail-line.
05 sale-amount pic zz,zz9.99


How is the COBOL compiler suppose to know which sale-amount you are refering to when you use that dataname.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Sep 27, 2007 10:29 am
Reply with quote

Hi MANUEL LEMA,

You have to use QUALIFIER concept to differentiate this SALES-AMOUNT to which it is referring.

If you want to use sale-amount which is part of sales-record, use it as

SALE-AMOUNT of SALES-RECORD or

if you want to use sale-amount which is part of deatil-line, use it as

SALE-AMOUNT of DETAIL-LINE.

Regards,
KSK
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Sep 27, 2007 2:47 pm
Reply with quote

Hi,

Did you get the solution for your query or still some confusion is there ?
If got the solution, please post that here; if not, we are here for further queris.
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Thu Sep 27, 2007 6:26 pm
Reply with quote

[quote="Anuj D."]Hi,

Did you get the solution for your query or still some confusion is there ?
If got the solution, please post that here; if not, we are here for further queris.[/quot

i got the solution thanks to everyone....
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Sep 27, 2007 6:54 pm
Reply with quote

You are welcome MANUEL icon_smile.gif ,

In my previous post, I requested you to post the solution as well.
Quote:
If got the solution, please post that here


If you do so, it might help to some other member of the forum in future.
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Thu Sep 27, 2007 7:07 pm
Reply with quote

Anuj D. wrote:
You are welcome MANUEL icon_smile.gif ,

In my previous post, I requested you to post the solution as well.
Quote:
If got the solution, please post that here
The solution is:
compute sales-taxes of sales-record-w * .08.
i just needed to specify wich sales-taxes i am refering to because i have sales-taxes in my program.

If you do so, it might help to some other member of the forum in future.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Oct 01, 2007 6:10 pm
Reply with quote

Thanks for posting the solution. icon_smile.gif

So you use the solution as suggested by ksk:At different 'locations' in program you use the statements for SALE-AMOUNT like
Code:
SALE-AMOUNT of DETAIL-LINE.


to make the COMPLIER to distinguish between the same element level variable-name (SALE-AMOUNT) under different group-level variables, right ? Please confirm.
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Tue Oct 02, 2007 1:27 am
Reply with quote

Anuj D. wrote:
Thanks for posting the solution. icon_smile.gif

So you use the solution as suggested by ksk:At different 'locations' in program you use the statements for SALE-AMOUNT like
Code:
SALE-AMOUNT of DETAIL-LINE.


to make the COMPLIER to distinguish between the same element level variable-name (SALE-AMOUNT) under different group-level variables, right ? Please confirm.

YES THAT'S EXACTLY WHAT I DID
Back to top
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Tue Oct 02, 2007 3:27 pm
Reply with quote

Let me confuse you some more:
in COBOL
Code:
SALE-AMOUNT OF DETAIL-LINE
and
Code:
 
SALE-AMOUNT IN DETAIL-LINE
notations are both allowed and correct.
The
Code:
:DETAIL-LINE.SALE-AMOUNT
notation is only used in embedded SQL
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Tue Oct 02, 2007 6:26 pm
Reply with quote

dr_te_z wrote:
Let me confuse you some more:
in COBOL
Code:
SALE-AMOUNT OF DETAIL-LINE
and
Code:
 
SALE-AMOUNT IN DETAIL-LINE
notations are both allowed and correct.
The
Code:
:DETAIL-LINE.SALE-AMOUNT
notaion is only used in embedded SQL

Really well i supposed that but i didn't try it and it's not confunsing...i love challenges.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Oct 02, 2007 8:19 pm
Reply with quote

I usually code all 05 or higher numbered level variables with the beginning chars of the 01 level name to avoid your problem. Eg.:
Code:

01 sales-record.
05 sr-sale-amount pic 9(4)v99.

01 detail-line.
05 dl-sale-amount pic zz,zz9.99.
Back to top
View user's profile Send private message
MANUEL LEMA
Currently Banned

New User


Joined: 23 Sep 2007
Posts: 9
Location: NY

PostPosted: Tue Oct 02, 2007 9:01 pm
Reply with quote

mmwife wrote:
I usually code all 05 or higher numbered level variables with the beginning chars of the 01 level name to avoid your problem. Eg.:
Code:

01 sales-record.
05 sr-sale-amount pic 9(4)v99.

01 detail-line.
05 dl-sale-amount pic zz,zz9.99.


yea i think that's what ill have to do from now on thanks for helping.
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

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top