IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Redefines clause


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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

Global Moderator


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

PostPosted: Wed May 11, 2005 6:33 pm
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
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
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
No new posts NOT IN clause in COBOL pgm COBOL Programming 8
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
No new posts usage of CASE in WHERE clause DB2 10
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
Search our Forums:

Back to Top