Page 1 of 1

Whats the output of this REDEFINES

PostPosted: Thu Nov 08, 2007 1:15 am
by abkumarch
01 A pic S9(3) COMP3
01 B REDEFINES A pic S9(6) COMP

Pd.

MOVE 100 TO B.
DISPLAY B ?

Re: Whats the output of this REDEFINES

PostPosted: Thu Nov 08, 2007 2:09 am
by dick scherrer
Hello,

As i asked to your other topic, what happens when you try this?

Re: Whats the output of this REDEFINES

PostPosted: Thu Nov 08, 2007 4:02 am
by CICS Guy
abkumarch wrote:01 A pic S9(3) COMP3
01 B REDEFINES A pic S9(6) COMP
MOVE 100 TO B.
DISPLAY B ?
Kinda got a problem, IIRC, 9(6) comp will occupy 4 bytes, while 9(3) comp3 will occupy 2 bytes, and I think COBOL gets really upset with a larger data area redefining a smaller one (he's OK with smaller redefining larger)....
So assuming you meant the other direction (or COBOL allowed it), A probably would contain an invalid low values....