View previous topic :: View next topic
|
Author |
Message |
raviprasath_kp Warnings : 1 New User
Joined: 20 Feb 2005 Posts: 65 Location: chennai
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Both will be populated with ABCDE. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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.
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 ... |
|
Back to top |
|
|
raviprasath_kp Warnings : 1 New User
Joined: 20 Feb 2005 Posts: 65 Location: chennai
|
|
|
|
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 |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Quote: |
PLEASE TELL ME WHAT IS THE ANSWER |
Quote: |
Both will be populated with ABCDE. |
|
|
Back to top |
|
|
raviprasath_kp Warnings : 1 New User
Joined: 20 Feb 2005 Posts: 65 Location: chennai
|
|
|
|
thanks |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Ravi,
The real value of knowing the ans to your ques is knowing WHY they both contain ABCDE. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
raviprasath_kp Warnings : 1 New User
Joined: 20 Feb 2005 Posts: 65 Location: chennai
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
|