Whats the output of this REDEFINES

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
abkumarch
Posts: 21
Joined: Tue Oct 30, 2007 3:14 am
Skillset: cobol,jcl,vsam, db2
Referer: google

Whats the output of this REDEFINES

Postby abkumarch » Thu Nov 08, 2007 1:15 am

01 A pic S9(3) COMP3
01 B REDEFINES A pic S9(6) COMP

Pd.

MOVE 100 TO B.
DISPLAY B ?

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Whats the output of this REDEFINES

Postby dick scherrer » Thu Nov 08, 2007 2:09 am

Hello,

As i asked to your other topic, what happens when you try this?
Hope this helps,
d.sch.

CICS Guy
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am

Re: Whats the output of this REDEFINES

Postby CICS Guy » Thu Nov 08, 2007 4:02 am

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....