Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Dynamic structure based on pointer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
shameer007

New User


Joined: 20 Apr 2006
Posts: 13

PostPosted: Sat Feb 09, 2008 11:50 pm    Post subject: Dynamic structure based on pointer
Reply with quote

How to declare a Dynamic structure based on a pointer?
Back to top
View user's profile Send private message
References
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 3168
Location: italy

PostPosted: Sun Feb 10, 2008 12:58 am    Post subject: Reply to: Dynamic structure based on pointer
Reply with quote

The "unneeded" Dynamic adjective You used makes Your question difficult to understand icon_confused.gif


Code:

dcl var1 char(....)
dcl var2 char(....)
dcl ptr  ptr ;
dcl 01 struct1 based(ptr) ,
    02 ......
    02 ......
    02 ...... ;
dcl 01 struct2 based(ptr) ,
    02 ......
    02 ......   
    02 ...... ;

ptr = addr(var1) ;
/* now the variable var1 is being mapped according to stucts struct1  and struct2 
   and You can use in the same way variables declared in struct1 and struct2 */

ptr = addr(var2);
/* same thing now for var2
   but, remember You have lost addressability to var1 */
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1