IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VSAM - Use of DEFINE PATH vs. DEFINE ALTERNATEINDEX


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abhi Nature

New User


Joined: 14 Dec 2011
Posts: 17
Location: India

PostPosted: Wed Aug 19, 2015 4:35 pm
Reply with quote

Hello,

'DEFINE ALTERNATEINDEX' creates and relates the alternate index to the cluster. So why is it necessary to 'DEFINE PATH' which does the same (relates)?

Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 19, 2015 5:16 pm
Reply with quote

Perhaps you can provide links to the documentation which shows they are the same?
Back to top
View user's profile Send private message
Abhi Nature

New User


Joined: 14 Dec 2011
Posts: 17
Location: India

PostPosted: Wed Aug 19, 2015 5:37 pm
Reply with quote

Syntax for 'DEFINE ALTERNATEINDEX'
DEFINE
ALTERNATEINDEX
(NAME(entryname)
RELATE(entryname)
.
.
Other parameters.
Creates and relates (to base cluster) the alternate index.

Syntax 'DEFINE PATH'
DEFINE
PATH
(NAME(entryname)
PATHENTRY(entryname)
.
.
Other parameters.

If 'DEFINE ALTERNATEINDEX' creates and relates the alternate index to the base cluster, what is the use of 'DEFINE PATH'?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Wed Aug 19, 2015 5:43 pm
Reply with quote

Perhaps you should read the fine manual and find out for yourself.
Back to top
View user's profile Send private message
Abhi Nature

New User


Joined: 14 Dec 2011
Posts: 17
Location: India

PostPosted: Wed Aug 19, 2015 5:54 pm
Reply with quote

I did read the manual before posting the question. But I don't think it answers the question.

I do understand that 'DEFINE PATH' is there due a reason, but I was wondering why would a PATH be required if we have already related it to the cluster during creation of alternate index.

In my opinion, the RELATE parameter (while creating alternate index) should already create PATH.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Wed Aug 19, 2015 6:09 pm
Reply with quote

Abhi Nature wrote:
I do understand that 'DEFINE PATH' is there due a reason, but I was wondering why would a PATH be required if we have already related it to the cluster during creation of alternate index.


Because DEFINE ALTERNATEINDEX indicates what cluster the alternate index is to be built from, but does not actually create a logical relationship between the base cluster and the index (if you access the alternate index directly, you will get data from the index, not the cluster). DEFINE PATH does create that relationship; you can access the path as if it were a KSDS with the alternate index as its primary.

Quote:
In my opinion, the RELATE parameter (while creating alternate index) should already create PATH.


:shrug: Take the matter up with IBM. My own opinion is that the RELATE parameter does not have anything to do, even by implication, with creating paths.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Aug 19, 2015 6:10 pm
Reply with quote

The RELATE in the alternate index definition gives IDCAMS the base cluster data from which the data for the alternate index is read. Once the build of the alternate index is done, it exists INDEPENDENTLY of the base cluster -- the alternate index has a DATA component and an INDEX component just like the base cluster.

The DEFINE PATH establishes the connection between the alternate index and the base cluster. The DEFINE ALTERNATEINDEX does not do this -- it merely reads the data to build the index. If you refer to the alternate index with a DD statement, you get the alternate index -- and only the alternate index. If you refer to the PATH on the DD statement, the system opens both the alternate index AND the base cluster (since they are related via the PATH).
Back to top
View user's profile Send private message
Abhi Nature

New User


Joined: 14 Dec 2011
Posts: 17
Location: India

PostPosted: Wed Aug 19, 2015 6:32 pm
Reply with quote

Okay. To conclude...
PATH is there due to one way in which VSAM was designed. There could have been another approach whereby PATH could have been avoided (like creating the path in first few bytes of the alternate index). But obviously PATH would be the most efficient way to use the alternate index (since IBM chose it).

Thanks everyone for your time and help.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 19, 2015 6:42 pm
Reply with quote

Fine Manual wrote:
The DEFINE PATH command defines a path directly over a base cluster or over an alternate index and its related base cluster.


How would the DEFine of the alternate index do the first part?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Aug 19, 2015 7:13 pm
Reply with quote

for all You might want to know, see here
www.redbooks.ibm.com/abstracts/sg246105.html?Open
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Aug 19, 2015 7:28 pm
Reply with quote

Quote:
Syntax for 'DEFINE ALTERNATEINDEX'
Code:
DEFINE
ALTERNATEINDEX
(NAME(entryname)
RELATE(entryname)



the general logical construct for things like that is ( usually )
( just forget about the quirks of idcam parenthetization )
DEFINE <the type of the entity> <name of the entity> <a list of the attributes of the entity >
and for an alternate index the attribute list contains/is the name of the base cluster

would it have been clearer if instead of RELATE the keyword would have been
Code:
DEFINE
ALTERNATEINDEX
(NAME(entryname)
BASECLUSTERNAME(entryname)

?
Back to top
View user's profile Send private message
Abhi Nature

New User


Joined: 14 Dec 2011
Posts: 17
Location: India

PostPosted: Wed Aug 19, 2015 7:50 pm
Reply with quote

I agree that the important thing is what the parameter holds rather than what its name suggests. Instead of RELATE it could have been BASECLUSTER, but in either case 'DEFINE ALTERNATEINDEX' relates base cluster with its alternate index, or so it seems. If it does, then why 'DEFINE PATH' is needed, there was the confusion.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Aug 19, 2015 9:41 pm
Reply with quote

the current design is to have the AIX and the BASE CLUSTER processing unbundled as much as possible,

for example
I have had a few times the need to process the AIX by itself,
quite a few IBM and non-IBM products have the same need

if the design had been the way You are proposing there would be no way to do what I outlined

anyway read and meditate on the redbook for which I posted the link.
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 590
Location: London

PostPosted: Tue Sep 08, 2015 3:13 am
Reply with quote

It is simple and logical..

The Base cluster is defined with a KEY to access the records, e.g looking from position 0 for a length of 8. You cannot have more than one key specified for the base cluster.

The AIX is defined with a different KEY to the base cluster, e.g. from position 10 for a length of 6, but the RELATE to the base cluster means you're looking at the same records in the base cluster.

You then do a BUILDINDEX which copies all the AIX key parts of the records in the base cluster into the AIX.

You then define the PATH which is a different name to the Base cluster and relate it to the AIX using the PATHENTRY.

Now, when you specify the PATH name to access the Base cluster, it uses the KEYS in the AIX to access the records in the base cluster.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts BPXBATCH SFTP to remote path having s... All Other Mainframe Topics 6
No new posts VSAM LISTCAT INFORMATION JCL & VSAM 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts SET PATH in View DDL DB2 2
Search our Forums:

Back to Top