View previous topic :: View next topic
|
Author |
Message |
rohan kumar panda
New User
Joined: 14 Sep 2007 Posts: 3 Location: india
|
|
|
|
if i declared two group having some same data types name for example
01 GP1
02 X PIC 9(4).
02 Y PIC 9(4).
02 Z PIC 9(2).
01 GP2
02 X PIC 9(4).
02 Y PIC 9(4).
How can I assign some value of GP1 variable as the variables name of two groups are same |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
rohan,
Quote: |
How can I assign some value of GP1 variable as the variables name of two groups are same |
Your req is not clear. Post some more info. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
lancelot
New User
Joined: 21 Sep 2005 Posts: 1 Location: beijing china
|
|
|
|
try corr with move statement. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
rohan kumar panda wrote: |
if i declared two group having some same data types name for example
01 GP1
02 X PIC 9(4).
02 Y PIC 9(4).
02 Z PIC 9(2).
01 GP2
02 X PIC 9(4).
02 Y PIC 9(4).
How can I assign some value of GP1 variable as the variables name of two groups are same |
If you are trying to populate GP1 variable, then since variable names are same u can use GROUP qualifier .. eg
MOVE X OF GP2 TO X OF GP1
MOVE Y OF GP2 TO Y OF GP1... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello rohan kumar panda and welcome to the forums,
It is usually not good to use the same elementary field names for fields within different groups. Many places will not permit this.
It makes coding more tedious and can cause problems for years. If the program is many thousand lines and there are one or 2 "moves" that refer to the wrong qualified field name, it may go undetected for a long time.
I'd suggest working to eliminate this rather than find ways to exploit it. It is another of the things you can do that should not be done. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
If you cannot change the copybook, please do not use 'move corresponding'. It is dangerous if someone changes the copybook and does not change your code. If you do not change the elementary item names, I would suggest that you use:
move x of GP1 to x of GP2
move y of GP1 to y of GP2 |
|
Back to top |
|
|
|