| IBM MAINFRAME HELP FORUMS for COBOL, JCL, CICS, DB2, IMS etc... Help & Support Forums for IBM Mainframe computers Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7, CA-11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, VSAM, ISPF, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
raviputran
Joined: 05 Jul 2007
Posts: 6
Location: bangalore
|
| Posted: Tue Jul 15, 2008 11:54 am Post subject: Based Attribute |
|
|
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. --) |
|
| Back to top |
|
ashimer
Joined: 13 Feb 2004
Posts: 311
Location: Bangalore
|
| Posted: Tue Jul 15, 2008 2:37 pm Post subject: |
|
|
| 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 |
|
Garry Carroll
Joined: 08 May 2006
Posts: 132
Location: Dublin, Ireland
|
| Posted: Tue Jul 15, 2008 5:24 pm Post subject: |
|
|
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 |
|
raviputran
Joined: 05 Jul 2007
Posts: 6
Location: bangalore
|
| Posted: Wed Jul 16, 2008 11:31 am Post subject: Reply to: Based Attribute |
|
|
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 |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|