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
 

 

Assign a value to a group

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

New User


Joined: 14 Sep 2007
Posts: 3
Location: india

PostPosted: Fri Sep 14, 2007 2:45 pm    Post subject: Assign a value to a group
Reply with quote

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
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Sep 14, 2007 2:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Fri Sep 14, 2007 2:54 pm    Post subject:
Reply with quote

Reading is a good skill to learn..... icon_rolleyes.gif
Qualification
Back to top
View user's profile Send private message
lancelot

New User


Joined: 21 Sep 2005
Posts: 1
Location: beijing china

PostPosted: Fri Sep 14, 2007 5:44 pm    Post subject: Reply to: Assign a value to a group
Reply with quote

try corr with move statement.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Sep 14, 2007 5:51 pm    Post subject: Reply to: Assign a value to a group
Reply with quote

You can use MOVE with CORRESPONDING

[url]
http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol4.doc/tpbeg14.htm[/url]

Please post few more details.
Back to top
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Fri Sep 14, 2007 6:04 pm    Post subject: Re: Assign a value to a group
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 14, 2007 6:25 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Fri Sep 14, 2007 9:42 pm    Post subject:
Reply with quote

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
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 4 Wed Mar 22, 2017 7:46 am


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