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

Redefine the redefine variable


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aripallig

New User


Joined: 05 Jul 2005
Posts: 23
Location: india

PostPosted: Wed Apr 28, 2010 11:30 am
Reply with quote

Hi,
Is it possible to redefine a redefined variable ??
Please provide a example if you have to my understanding.

Thanks.
Girish
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Apr 28, 2010 11:38 am
Reply with quote

What have you tried yourself and what were the results that caused you a problem ?

Should this topic be moved to the Interview / Homework forum ?
Back to top
View user's profile Send private message
aripallig

New User


Joined: 05 Jul 2005
Posts: 23
Location: india

PostPosted: Wed Apr 28, 2010 11:40 am
Reply with quote

expat wrote:
What have you tried yourself and what were the results that caused you a problem ?

Should this topic be moved to the Interview / Homework forum ?



Hi,

This is asked in the interview.

Regards,
Girish
Back to top
View user's profile Send private message
aripallig

New User


Joined: 05 Jul 2005
Posts: 23
Location: india

PostPosted: Wed Apr 28, 2010 1:26 pm
Reply with quote

Hi All,

My question was not clear enough to understand it correctly.

Here i am putting it again.

01 var-1
01 var-2 redefines var-1
01 var-3 redefnies var-2

could this be possible to code.

Thanks,
Girish
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 28, 2010 2:06 pm
Reply with quote

Quote:

Here i am putting it again.

01 var-1
01 var-2 redefines var-1
01 var-3 redefnies var-2

could this be possible to code.(sic)


you have again shown that you have no intention of looking/reading a manual.

NO, the above is incorrect.
not because of the redefine keyword,
but because your 01 level definitions do not conform to proper syntax.
at some point in a data definition of a structure,
you have to provide a pic clause.

and start using the Preview button and correct your poor spelling.
Back to top
View user's profile Send private message
Bang_1

New User


Joined: 08 May 2009
Posts: 39
Location: Bangalore

PostPosted: Wed Apr 28, 2010 2:09 pm
Reply with quote

Yes you can redefine like that..

Here is the example --

WORKING-STORAGE SECTION.
01 WS-VAR-1.
02 WS-VAR-1-F1 PIC X(1) VALUE 'A'.
02 WS-VAR-1-F2 PIC 9(3) VALUE 123.
01 WS-VAR-2 REDEFINES WS-VAR-1.
02 WS-VAR-2-F1 PIC X(2).
02 WS-VAR-2-F2 PIC 9(2).
01 WS-VAR-3 REDEFINES WS-VAR-2.
02 WS-VAR-3-F1 PIC X(3).
02 WS-VAR-3-F2 PIC 9(1).
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY WS-VAR-1.
DISPLAY WS-VAR-2.
DISPLAY WS-VAR-3.


Sysout has the below results -
A123
A123
A123
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 28, 2010 2:38 pm
Reply with quote

This is a link to the manual explaining REDEFINES clause
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top