MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

same Element Variable defined twice

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
nbdtrjk1
Beginner


Joined: 12 Apr 2007
Posts: 76
Topics: 41

PostPosted: Tue Nov 27, 2007 2:56 am    Post subject: same Element Variable defined twice Reply with quote

Code:
ID DIVISION.                                       
PROGRAM-ID. TEST2.                                 
ENVIRONMENT DIVISION.                               
DATA DIVISION.                                     
WORKING-STORAGE SECTION.                           
01 WS-AML.                                         
   05                PIC XX.                       
   05                PIC XX.                       
   05 ACCT-GRP       OCCURS 4 TIMES.               
      10 ACCT-TYPE-C PIC X.                         
   05 SDA-GRP.                                     
      10 ACCT-GRP    OCCURS 4 TIMES.               
         15 ACCT-TYPE-C PIC X.                     
PROCEDURE DIVISION.                                 
MAIN-PARA.                                         
        MOVE SPACES TO ACCT-TYPE-C OF SDA-GRP(1).   
        MOVE SPACES TO ACCT-TYPE-C OF WS-AML(1).   
        STOP RUN.                                   



The Mention Variable is production Copybook variable. I don't want to change anything in that copybook.

In Production non of the program is using this variale ACCT-TYPE-C. that's why i am not getting any issues in Production.

But now we got a New initiative to move some values to this variable ACCT-TYPE-C


The above code i am getting error saying that "ACCT-TYPE-C OF WS-AML" was not a uniquely defined name"


Please help me out how to resolve this issue without changing copybook
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Nov 27, 2007 3:06 am    Post subject: Reply with quote

nbdtrjk1,

You would need to change the name of one of the occurrences in the program.
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Nov 27, 2007 5:45 am    Post subject: Reply with quote

try
Code:

05 any-new-name.
      10  ACCT-GRP       OCCURS 4 TIMES.               
           15 ACCT-TYPE-C PIC X.                         
05 SDA-GRP.                                     
      10 ACCT-GRP    OCCURS 4 TIMES.               
         15 ACCT-TYPE-C PIC X.   

then your qualification would be
in acct-grp in sda-grp
and
in acct-grp in any-new-name in

essentially, you need to insure duplicate reference names are of the same level.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
nbdtrjk1
Beginner


Joined: 12 Apr 2007
Posts: 76
Topics: 41

PostPosted: Tue Nov 27, 2007 6:17 am    Post subject: Reply with quote

Code:
01 WS-AML.                                         
   05                PIC XX.                       
   05                PIC XX.                       
   05 ACCT-GRP       OCCURS 4 TIMES.               
      10 ACCT-TYPE-C PIC X.                         
   05 SDA-GRP.                                     
      10 ACCT-GRP    OCCURS 4 TIMES.               
         15 ACCT-TYPE-C PIC X.


Highlighted one is a copybook variable. I don't want to change the Copybook. My question is without changing the copybook how to acheive the task?
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Tue Nov 27, 2007 6:50 am    Post subject: Reply with quote

nbdtrjk1,

Quote:

Highlighted one is a copybook variable. I don't want to change the Copybook. My question is without changing the copybook how to acheive the task?


AFAIK there seems to be no way to this without changing the copybook.

But out of the box, hope there should be some solution... Rolling Eyes
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Nov 27, 2007 7:43 am    Post subject: Reply with quote

1. I fail to see a 'highlighted' one.

2. If the copybook is designed poorly, change-it.

3. If what you have added is causing a problem, change what you added.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Nov 27, 2007 7:53 am    Post subject: Reply with quote

nbdtrjk1,

First of all let me know why do you want to achieve without changing the copy book.
Back to top
View user's profile Send private message Send e-mail
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Nov 27, 2007 9:29 am    Post subject: Reply with quote

You can't use qualification to make the reference to the ACCT-TYPE-C variable unique for the first item defined. As you've seen, the compiler cannot resolve the ACCT-TYPE-C OF WS-AML reference to a single variable because there are 2 variables that satisfy that qualificaion.

Code:
Duplication of data-names must not occur in those places where the data-name cannot be made unique by qualification.


The only thing I can think of to get around this without changing the copybook(s), is to redefine the area so that you can reference the first instance of ACCT-TYPE-C using a unique name. You could use the same variable names in the redefined area and qualify those if that makes more sense for your program. The problem is that you'll need to use this technique in all the programs that you now want to reference this field. This is a short term solution. The better long term solution has already been posted by dbzTHEdinosaur.

Code:

01 WS-AML.                             
   05                PIC XX.           
   05                PIC XX.           
   05 ACCT-GRP       OCCURS 4 TIMES.   
      10 ACCT-TYPE-C PIC X.             
   05 SDA-GRP.                         
      10 ACCT-GRP    OCCURS 4 TIMES.   
         15 ACCT-TYPE-C PIC X.         
                                       
01 NEW-WS-AML REDEFINES WS-AML.         
   05                PIC X(04).         
   05 NEW-ACCT-GRP   OCCURS 4 TIMES.   
      10 NEW-ACCT-TYPE-C PIC X.         
   05                PIC X(04).         



                                                 
    MOVE SPACES TO ACCT-TYPE-C OF SDA-GRP (1)     
    MOVE SPACES TO NEW-ACCT-TYPE-C (1)           
                                                 
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group