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

Based Attribute


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

New User


Joined: 05 Jul 2007
Posts: 13
Location: bangalore

PostPosted: Tue Jul 15, 2008 11:54 am
Reply with quote

Hi all,

Is it allowed in PL/I?

DECLARE ARRAY_A(10) PIC '(4)X';

DECLARE P POINTER;

DECLARE ARRAY_B(10) PIC '(4)9' BASED(P);

P = ADDR(ARRAY_A);

I used this and found ARRAY_B is not having any values.

Thanks in advance. icon_cool.gif
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Jul 15, 2008 2:37 pm
Reply with quote

This is allowed in PL/1 ... but here your ARRAY_A does not have any value then how will it get reflected in ARRAY_B ?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Tue Jul 15, 2008 5:24 pm
Reply with quote

Lest it jump up to bite some day, it's better to be more specific in overlay of arrays:

Code:
P = ADDR(ARRAY_A);


is not as safe as
Code:
P = ADDR(ARRAY_A(1));


Otherwise, code optimization may result in incorrect positioning.


Regards,
Garry.
Back to top
View user's profile Send private message
raviputran

New User


Joined: 05 Jul 2007
Posts: 13
Location: bangalore

PostPosted: Wed Jul 16, 2008 11:31 am
Reply with quote

Hi all,

Thanks for the response. I got that solved.

Problem:

DECLARE ARRAY_A(10) PIC '(4)X';

DECLARE P POINTER;

DECLARE ARRAY_B(10) PIC '(4)9' BASED(P);

P = ADDR(ARRAY_A);

I was passing values to ARRAY_A based on some condition. However it
was not getting reflected in ARRAY_B. I just used another pointer to point
the alphanumeric to char and pointed that char to numeric. Then it went right.

DECLARE ARRAY_A(10) PIC '(4)X';

DECLARE ARRAY_B(10) CHAR(04) BASED(P);

DECLARE ARRAY_C(10) PIC '(4)9' BASED(Q);

DECLARE P POINTER;

P = ADDR(ARRAY_A);

DECLARE Q POINTER;

Q= ADDR(ARRAY_B);


Now the changes I made in ARRAY_A got reflected in ARRAY_C which was
my requirement.
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 To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
No new posts Mass JCL release via IDZ tool(eclipse... CA Products 1
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
Search our Forums:

Back to Top