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 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
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm


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