View previous topic :: View next topic
|
Author |
Message |
sivareddy123
New User
Joined: 14 Jan 2015 Posts: 11 Location: India
|
|
|
|
Please give me solution(OUT PUT ) for the below
01 A PIC X(5) Value 'ABC12'
01 B REDEFINE A PIC X(4).
PROCEDURE DIVISION.
MOVE 56 TO B.
DISPLAY A .
DISPLAY B.
OUT PUT : ????????????????????????????
Thanks in advance |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
A:
B:
Edit to include B. I thought you knew what B contained as you'd just MOVEd 56 to it. |
|
Back to top |
|
|
sivareddy123
New User
Joined: 14 Jan 2015 Posts: 11 Location: India
|
|
|
|
Do you mean A value is 56 B value is 2 ? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Why not code it up and run it? When you code it code your DISPLAYs in the following manner:
Code: |
DISPLAY 'n >' n '<'. |
where n is your variable. That way you will see any blanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Do you mean A value is 56 B value is 2 ? |
No, the value of A is 5 6 blank blank 2, while the value of B is 5 6 blank blank. Since there is a REDEFINE, the variables share the same memory (A has 5 bytes and B has 4 bytes, so the first 4 bytes of A will ALWAYS have the same value as B). |
|
Back to top |
|
|
|