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
 

 

Redefine the redefine variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Redefine the redefine variable
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: 8593
Location: Back in jolly old England

PostPosted: Wed Apr 28, 2010 11:38 am    Post subject:
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    Post subject:
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    Post subject: Re: Redefine the redefine variable
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am


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