View previous topic :: View next topic
|
Author |
Message |
aripallig
New User
Joined: 05 Jul 2005 Posts: 23 Location: india
|
|
|
|
Hi,
Is it possible to redefine a redefined variable ??
Please provide a example if you have to my understanding.
Thanks.
Girish |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
aripallig
New User
Joined: 05 Jul 2005 Posts: 23 Location: india
|
|
|
|
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 |
|
|
aripallig
New User
Joined: 05 Jul 2005 Posts: 23 Location: india
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bang_1
New User
Joined: 08 May 2009 Posts: 39 Location: Bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
|