Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us