View previous topic :: View next topic
|
Author |
Message |
anadhamohan
New User
Joined: 27 Sep 2005 Posts: 25 Location: india
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
anadhamohan
New User
Joined: 27 Sep 2005 Posts: 25 Location: india
|
|
|
|
Thanks Garry, It worked for me. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Glad to have been able to help. Thanks for letting us know.
Garry. |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
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 |
|
|
|