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

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 ?
abkumarch
 
Posts: 21
Joined: Tue Oct 30, 2007 3:14 am
Has thanked: 0 time
Been thanked: 0 time

Re: Whats the output of this REDEFINES

 

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.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

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....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post