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
 

 

Redefines clause

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

New User


Joined: 23 Mar 2005
Posts: 10
Location: Noida

PostPosted: Wed May 11, 2005 6:28 pm    Post subject: Redefines clause
Reply with quote

please look at following example:

01 SAMPLE.
02 REC-1.
05 A PIC X(3).
05 B PIC X(6).
02 REC-2 REDEFINES REC-1.
05 C PIC X(6).
05 D PIC X(3).

We perform the following move on this.
MOVE C TO B.

Please let me know the value of B after this MOVE statement.

(assuming A is abc and B is defghi)
Back to top
View user's profile Send private message

notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Wed May 11, 2005 6:32 pm    Post subject:
Reply with quote

Dear Richa,

I think we can't Move the value since it is in redifines clause.

We'll get a compilation error as Value overlap or something related to that, coz i came accross that a loong time back so can't able to comeup with the exact message.

If anything knows about that please let me know also correct me if Iam wrong.

Regards
Tanden
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed May 11, 2005 6:33 pm    Post subject: Re: Redefines clause
Reply with quote

Why not test this yourself and post your results?
Back to top
View user's profile Send private message
richa.setia

New User


Joined: 23 Mar 2005
Posts: 10
Location: Noida

PostPosted: Wed May 11, 2005 6:35 pm    Post subject:
Reply with quote

Hi superk,

I dont have mainframe access as i m currently on Float :-)
It wud be really nice if u test it and let us know.
Back to top
View user's profile Send private message
Ashutosh Shrinet

New User


Joined: 22 Aug 2004
Posts: 10
Location: New Delhi

PostPosted: Thu May 12, 2005 6:04 pm    Post subject: Re: Redefines clause
Reply with quote

Hi Richa,
u can move var c value to var b. it will move normally. when u display var b it will show the value of var c. but remember u can't use value clause with rediefines. rec-2 can't contain value clause.
Back to top
View user's profile Send private message
maverick05

New User


Joined: 14 Apr 2005
Posts: 54
Location: Earth

PostPosted: Thu May 12, 2005 8:37 pm    Post subject: Re: Redefines clause
Reply with quote

Hi richa,

B contains abcabc after the move statement due to the overlap move u have used.

Thanks

venkat
Back to top
View user's profile Send private message
David P

Active User


Joined: 11 Apr 2005
Posts: 106
Location: Cincinnati Ohio

PostPosted: Fri May 13, 2005 9:48 am    Post subject:
Reply with quote

Hi Venkat,
I believe after the move the variables will have the values as

A - abc
B - abcdef
C - abcabc
D - def

Please correct me if I am wrong.
regards,
David.
Back to top
View user's profile Send private message
maverick05

New User


Joined: 14 Apr 2005
Posts: 54
Location: Earth

PostPosted: Fri May 13, 2005 9:58 am    Post subject: Re: Redefines clause
Reply with quote

Hi David,

What u said is correct only for the first one.i.e A
Here you should consider dynamic move from character to character.So consider the case C moving to B.First a from C will replace d in B.This immediately results in d of C being replaced by a of B.

After the move statement,these are the values

A---abc
B---abcabc
C---abcabc
D---abc

Hope u understand.Plz let me know if not.

Thanks
Venkat
Back to top
View user's profile Send private message
David P

Active User


Joined: 11 Apr 2005
Posts: 106
Location: Cincinnati Ohio

PostPosted: Fri May 13, 2005 10:37 am    Post subject:
Reply with quote

Hi Venkat,

I got it, thanks for your quick response.

regards,
David.
Back to top
View user's profile Send private message
nave

New User


Joined: 16 May 2005
Posts: 10
Location: bangalore,india

PostPosted: Mon May 16, 2005 6:11 pm    Post subject:
Reply with quote

hi richa
i think answer your question.B = abcdef
Back to top
View user's profile Send private message
nave

New User


Joined: 16 May 2005
Posts: 10
Location: bangalore,india

PostPosted: Mon May 16, 2005 6:18 pm    Post subject:
Reply with quote

nave wrote:
hi richa
i think this will answer your question.B = abcdef
Back to top
View user's profile Send private message
gvt460

New User


Joined: 04 Mar 2005
Posts: 23

PostPosted: Sun May 22, 2005 1:27 pm    Post subject: Re: Redefines clause
Reply with quote

haii venkat
practically u r answer is correct.
then how it will work theoritically?
plz let me know.
if u have any manuals on this provide me.
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 Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts 3-D Table with nested DEPENDING ON Cl... VivekKhanna COBOL Programming 5 Sat Aug 08, 2015 11:18 pm
No new posts when=group clause: question about the... tuxama DFSORT/ICETOOL 2 Thu Mar 26, 2015 12:51 pm
No new posts Another redefines in COBOL RahulG31 COBOL Programming 1 Fri Mar 20, 2015 4:09 am


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