IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PL/I - redefines problem


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anadhamohan

New User


Joined: 27 Sep 2005
Posts: 25
Location: india

PostPosted: Fri Jan 16, 2009 7:31 pm
Reply with quote

I have a program where

DCL 01 A PIC 'ZZZZZZ9' INIT ((13)0);


DCL 01 A_CHAR (13) CHAR (07)
DEF A(13);

at the time of compilation it throws an error saying the redefined variable doesn't fit with the based variable. Could anyone help me with this problem.

Thanks in advance,
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jan 16, 2009 9:17 pm
Reply with quote

I would prefer to use based addressing for this.

Code:
DCL 01 A PIC 'ZZZZZZ9' INIT ((13)0);

DCL 01 A_CHAR (13) CHAR (07) BASED(ADDR(A(1));


You want the first byte of the based variable to be aligned with the 1st byte of the first element in the array. To me, it looks like you're positioning A_CHAR on the 13th element, so it extends past the end of the array.

Garry.
Back to top
View user's profile Send private message
anadhamohan

New User


Joined: 27 Sep 2005
Posts: 25
Location: india

PostPosted: Mon Jan 19, 2009 4:06 pm
Reply with quote

Thanks Garry, It worked for me.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Jan 19, 2009 4:47 pm
Reply with quote

Glad to have been able to help. Thanks for letting us know.

Garry.
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Tue Feb 17, 2009 12:17 pm
Reply with quote

DEF can be used ONLY to redefine data types of exactly the same attributes.... in the problem we have PIC and CHAR, which are different. Hence the error.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top