View previous topic :: View next topic
|
Author |
Message |
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Use a higher level reference? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
kbmkris
Active User
Joined: 24 Jun 2006 Posts: 101
|
|
|
|
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 |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
[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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
You are welcome MANUEL ,
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
Anuj D. wrote: |
You are welcome MANUEL ,
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Thanks for posting the solution.
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
Anuj D. wrote: |
Thanks for posting the solution.
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 |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
MANUEL LEMA Currently Banned New User
Joined: 23 Sep 2007 Posts: 9 Location: NY
|
|
|
|
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 |
|
|
|