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
 

 

Difference between Based and define in PL1.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
saubhik

New User


Joined: 21 Sep 2007
Posts: 35
Location: kolkata

PostPosted: Wed Jun 25, 2008 12:43 pm    Post subject: Difference between Based and define in PL1.
Reply with quote

Difference between Based and define in PL1.
Back to top
View user's profile Send private message

Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Wed Jun 25, 2008 1:01 pm    Post subject:
Reply with quote

You can use the DEFINED attribute to overlay variable storage,
but DEFINED overlay the storage permanently.

When based variables are overlaid with a locator reference, the association can be changed at any time in the program by assigning a new value to the locator variable.

Thanks,
Sri Hari G.
Back to top
View user's profile Send private message
saubhik

New User


Joined: 21 Sep 2007
Posts: 35
Location: kolkata

PostPosted: Wed Jun 25, 2008 2:24 pm    Post subject: Reply to: Difference between Based and define in PL1.
Reply with quote

It would be great if you can give some example.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


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

PostPosted: Wed Jun 25, 2008 2:52 pm    Post subject:
Reply with quote

Here's a couple of samples.

The first code snippet shows use of DEFINED where the record-area is a variable within the program. RECORD_AREA1 and the DEFINED variable are in a fixed location.

Code:
   DCL    RECORD_AREA1         CHAR(80) INIT(' ');
   DCL R1_DEFINED_BYTE_10    CHAR(10) DEF RECORD_AREA1;

    READ FILE (FILE1) INTO(RECORD_AREA1);



whereas the second snippet shows overlaying (redefining) on a relocatable . The READ SET statement relocates the structure to the record in the I/O buffer. The BASED(ADDR(FIELD1)) is also relocated. This cannot be done with DEFINED.

Code:
 DCL    1  RECORD_AREA2    BASED(PTR2),
          3   FIELD1           CHAR(10),
          3   FIELD2           CHAR(70);

  DCL  R2_OVERLAY   CHAR(10)  BASED(ADDR(FIELD1));

    READ FILE(FILE2) SET(PTR2);


Regards,
Garry.
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 Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am


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