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

what is the value of WS-VAR1 and WS-VAR2


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

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Mon Sep 10, 2007 7:46 pm
Reply with quote

In the example below
05 WS-VAR1 PIC X(5)
05 WS-VAR2 REDEFINES WA-VAR1 PIC 9(5).
PROCEDURE DIVISION
MOVE 'ABCDE' TO WS-VAR1.
Now what is the value of WS-VAR1 and WS-VAR2
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Sep 10, 2007 8:02 pm
Reply with quote

Both will be populated with ABCDE.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 10, 2007 8:09 pm
Reply with quote

Hello,

Please try it on your system. After the MOVE, issue a DISPLAY of both fields.

Post back here if you do not understand what you see in the output.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 10, 2007 8:23 pm
Reply with quote

Hi,

Did you try?..No?
ah..then..will not tell you the answer directly, instead will give some other example, then you'll tell us what should be there in VAR1 & VAR2. icon_smile.gif

Now Read:
Code:
 05  FIELDA  PIC X(09)  VALUE 'ABCDEFGHI'.                           
     05  FIELDB  REDEFINES FIELDA.                                       
         10  FIELDX  PIC S9(5) COMP-3.                                   
         10  FIELDY  PIC X(6).                                           
     05  FIELDC  REDEFINES FIELDA  PIC X(5).                             
         88  FIELDC-IS-SPACES  VALUE SPACES.                             
     05  FIELDD  PIC S9(3) COMP-3 VALUE 0.                               

FIELDA is redefined by FIELDB (which contains two subordinate items named FIELDX and FIELDY). Redefinition for FIELDB ends with FIELDC(which is at the same level as FIELDB). FIELDB is the same length (9 bytes) as FIELDA but provides a different storage format.

FIELDA is also redefined by FIELDC, which references FIELDA as the item
being redefined (i.e., the first item defining this storage area). Redefinition for FIELDC ends with FIELDD (which is at the same level asFIELDC). FIELDC provides an alternative format which (at 5 bytes) is shorter than the area being redefined.

FIELDA contains a VALUE clause which indicates the initial value for the storage area. Although FIELDB and FIELDC cannot contain VALUE clauses that would change the initial value specified by FIELDA's VALUE clause, note that FIELDC does contain a level-88 item which contains a
VALUE clause.

All descriptions for a redefined area are always in effect. And although the different descriptions share a common storage area, they are treated by the compiler (and at execution time) according to their data format and type and as if they were occupying separate storage areas.

P.S.: Am I looking like icon_evil.gif... icon_smile.gif
Back to top
View user's profile Send private message
raviprasath_kp
Warnings : 1

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Tue Sep 11, 2007 11:53 am
Reply with quote

THANKS FOR YOUR REPLY

RIGHT NOW I DON'T HAVE SYSTEM OTHER WISE I WILL TRY MY SELF

SP PLEASE TELL ME WHAT IS THE ANSWER

THANKS IN ADVANCE icon_evil.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Sep 18, 2007 5:07 pm
Reply with quote

Quote:
PLEASE TELL ME WHAT IS THE ANSWER


Quote:
Both will be populated with ABCDE.
Back to top
View user's profile Send private message
raviprasath_kp
Warnings : 1

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Thu Oct 04, 2007 12:39 pm
Reply with quote

thanks
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Oct 06, 2007 8:24 pm
Reply with quote

Hi Ravi,

The real value of knowing the ans to your ques is knowing WHY they both contain ABCDE.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sun Oct 07, 2007 9:09 am
Reply with quote

Jack,

Quote:
The real value of knowing the ans to your ques is knowing WHY they both contain ABCDE.

Like most of the forum population (though this may be rude but sadly this is the TRUE), Ravi HAVE NOT gone through any manual before posting. If he had, I believe he would not have posted this at first place.
Back to top
View user's profile Send private message
raviprasath_kp
Warnings : 1

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Sun Oct 07, 2007 10:46 pm
Reply with quote

thanks for your comment,before posting i searched but i want to confirm
thats the reason

the thinks will be change day by day
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Oct 08, 2007 10:28 am
Reply with quote

Ravi,

Quote:
thanks for your comment,before posting i searched but i want to confirm
thats the reason

Its great to hear you did some SEARCH work before posting.
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 PARSE to get the value acording to th... CLIST & REXX 4
No new posts Meaning of 'Move high values to var1' COBOL Programming 21
No new posts in cobol aphanumeric compare for var1... COBOL Programming 6
No new posts What is L'VAR1 in MVC OUTREC(L'VAR1),... PL/I & Assembler 2
No new posts sort var2 in ESDS without changing va... DFSORT/ICETOOL 4
Search our Forums:

Back to Top