Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
what is the value of WS-VAR1 and WS-VAR2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: what is the value of WS-VAR1 and WS-VAR2
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: 1288
Location: Chennai, India

PostPosted: Mon Sep 10, 2007 8:02 pm    Post subject: Reply to: what is the value of WS-VAR1 and WS-VAR2
Reply with quote

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

Site Director


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

PostPosted: Mon Sep 10, 2007 8:09 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Sep 10, 2007 8:23 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Tue Sep 18, 2007 5:07 pm    Post subject:
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    Post subject: Reply to: what is the value of WS-VAR1 and WS-VAR2
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Sun Oct 07, 2007 9:09 am    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Oct 08, 2007 10:28 am    Post subject:
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    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 PARSE to get the value acording to th... vasan_4u CLIST & REXX 4 Fri Feb 01, 2008 3:46 am
No new posts Meaning of 'Move high values to var1' ofer71 COBOL Programming 21 Tue Jan 29, 2008 2:27 pm
No new posts in cobol aphanumeric compare for var1... p_gandhi COBOL Programming 6 Thu May 03, 2007 10:40 pm
No new posts What is L'VAR1 in MVC OUTREC(L'VAR1),... aravindanrkumar PL/I & Assembler 2 Thu Mar 01, 2007 5:53 pm
No new posts sort var2 in ESDS without changing va... murmohk1 DFSORT/ICETOOL 4 Mon Dec 04, 2006 4:21 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us