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
 

 

Need sample to explain the usage of BASED

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

New User


Joined: 06 Jul 2007
Posts: 59
Location: home

PostPosted: Thu Oct 25, 2007 11:35 am    Post subject: Need sample to explain the usage of BASED
Reply with quote

Hi everybody here,
I am confused about the usage of BASED, please consider the following code:

Code:
DCL 1 DERIVED_AREA BASED(ADDR(DERIVED_STMT)) CHAR(4300);


I know DERIVED_AREA and DERIVED_STMT use the same memeroy area,
but could some friends here tell me :

Now that there is DERIVED_STMT as variable to proceed,why there is DERIVED_AREA ,what is DERIVED_AREA used for?

could someone here give me a sample to explain the usage of BASED?
Many thanks...
Back to top
View user's profile Send private message

Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Oct 25, 2007 12:08 pm    Post subject:
Reply with quote

Hi,
Consider a file read example.
A file can contain different record types. Based on certain indicator in the record, you will decide what record type it is.

DCL DERIVED_STMT CHAR(4300);

DCL 1 REC1 BASED(ADDR(DERIVED_STMT)),
record layout here.

DCL 1 REC2 BASED(ADDR(DERIVED_STMT)),
record layout here.

etc.

You will always read the file into DERIVED_STMT. But based on some particular field you will decide to which record type it belongs to and accordingly you will try to access the contents of the record.

Hope it helps.
Back to top
View user's profile Send private message
ruodeer

New User


Joined: 06 Jul 2007
Posts: 59
Location: home

PostPosted: Thu Oct 25, 2007 2:55 pm    Post subject:
Reply with quote

Hi ,Srihari.
thanks for your reply.
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Mon Dec 03, 2007 6:28 pm    Post subject:
Reply with quote

Let me help you in a simpler way.

if I say :

DCL X
DCL A BASED B

here the B should be a pointer variable and should be assigned a value like : B = ADDR(X)

now A shares the same storage of X, no matter A and X are same or different base and scales... B is a pointer which relates both....

Just like using DEFINE, but the difference is that, when you use DEFINE, you can relate two variables only if they are of same base and scale.
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 Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am
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


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