Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Based Attribute

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Based Attribute
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    Post subject:
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

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Jul 15, 2008 5:24 pm    Post subject:
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    Post subject: Reply to: Based Attribute
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us