Alternate Index and ESDS.

Virtual Storage Access method - ESDS, KSDS, RRDS & LDS. Basic direct access method, Basic sequential -, Queued sequential -, Basic partitioned -, Indexed sequential -, Object - access method.
Post Reply
Anup Apte
Registered Member
Posts: 22
Joined: Mon Aug 12, 2013 11:39 am
India

Alternate Index and ESDS.

Post by Anup Apte »

Hi

Mostly I've worked with KSDS and AIX, however, I came to kwno that we can create AIX on ESDS also. I'm confused ESDS does not have any INDEX then how it supports AIX?

Thanks
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1900
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Alternate Index and ESDS.

Post by Robert Sample »

Physically, an alternate index is a complete different pair of files than the base cluster. There is no requirement to have an index before you can have an alternate index. I've never used an ESDS with an alternate index, so I'm not sure of the advantages.
dick scherrer
Former Team Member
Posts: 62
Joined: Wed Aug 07, 2013 6:43 pm

Re: Alternate Index and ESDS.

Post by dick scherrer »

Possibly to provide the ability to directly access info rather than having to find it serially.

For example - read all info for a particular account or department or whatever.
Hope this helps,
d
dick scherrer
Former Team Member
Posts: 62
Joined: Wed Aug 07, 2013 6:43 pm

Re: Alternate Index and ESDS.

Post by dick scherrer »

Follow on:

Cannot recall the last time i was a trainee :lol:

d
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Alternate Index and ESDS.

Post by Anuj Dhawan »

I've an odd habit to take people to their past since the time I happened to be in U.S. during Halloween...:P
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Alternate Index and ESDS.

Post by Anuj Dhawan »

And I'm sure, you'll not be "this" for so long...:)

And yes, Welcome to the Forums, it's nice to see you here! :)

Regards,
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
ApexNC
Registered Member
Posts: 10
Joined: Sun Dec 08, 2013 7:03 pm
Contact:

Re: Alternate Index and ESDS.

Post by ApexNC »

Here is a complete example (code, JCL and data) using an Alternate Index with ESDS. A fixed-length ESDS base cluster is created, then loaded with 80-byte records having an 8-byte "key" (sequence number) in position 1, then an alternate index is built, keyed on that sequence number and pointing to the corresponding ESDS RBA. You can then read the ESDS directly, or use the Path to read exactly the same records, just as if it were a KSDS:

Code: Select all

 // EXEC PGM=IDCAMS 
 //SYSPRINT DD SYSOUT=* 
 //SYSIN DD * 
 DEFINE CLUSTER (NAME(VSAM.ESDS) RECSZ (80 80) TRK (1) NONINDEXED) 
 REPRO INFILE (INFILE) OUTDATASET (VSAM.ESDS) 
 DEFINE AIX (NAME (VSAM.RBAKEYS) RELATE (VSAM.ESDS) KEYS (8 0) - 
 RECSZ (17 17) TRK (1) UNIQUEKEY UPGRADE) 
 BLDINDEX INDATASET (VSAM.ESDS) OUTDATASET (VSAM.RBAKEYS) 
 DEFINE PATH (NAME (VSAM.KSDS) PATHENTRY (VSAM.RBAKEYS)) 
 /* 
 //INFILE DD * 
 00000100 THIS IS THE FIRST RECORD 
 00000200 THIS IS THE SECOND RECORD 
 00000300 THIS IS THE THIRD RECORD 
 etc. 
 /*
Here is the sample COBOL code:

Code: Select all

IDENTIFICATION DIVISION. 
PROGRAM-ID. SAMPLE. 
ENVIRONMENT DIVISION. 
INPUT-OUTPUT SECTION. 
FILE-CONTROL. 
 SELECT KSDS ASSIGN KSDS 
  ORGANIZATION INDEXED RECORD KEY IS RECORD-KEY. 
 SELECT ESDS ASSIGN AS-ESDS 
  ORGANIZATION SEQUENTIAL. 
DATA DIVISION. 
FILE SECTION. 
FD KSDS. 
01 KSDS-RECORD. 
 05 RECORD-KEY PIC X(8). 
 05 FILLER PIC X(72). 
FD ESDS. 
01 ESDS-RECORD PIC X(80). 
WORKING-STORAGE SECTION. 
01 FILLER PIC X. 
 88 NOT-EOF VALUE 'N'. 
 88 EOF VALUE 'Y'. 
PROCEDURE DIVISION. 
 OPEN INPUT ESDS SET NOT-EOF TO TRUE 
 PERFORM UNTIL EOF READ ESDS 
  AT END SET EOF TO TRUE CLOSE ESDS 
  NOT AT END DISPLAY ESDS-RECORD END-READ END-PERFORM 
 CLOSE ESDS 
 OPEN INPUT KSDS SET NOT-EOF TO TRUE 
 PERFORM UNTIL EOF READ KSDS 
  AT END SET EOF TO TRUE CLOSE KSDS 
  NOT AT END DISPLAY KSDS-RECORD END-READ END-PERFORM 
 CLOSE ESDS 
 GOBACK.
And the JCL:

Code: Select all

 // EXEC PGM=SAMPLE 
 //SYSOUT DD SYSOUT=* 
 //ESDS DD DISP=SHR,DSN=VSAM.ESDS <- Base Cluster 
 //KSDS DD DISP=SHR,DSN=VSAM.KSDS <- Path (to the RBAKEYS Alt Index)
http://www.jaymoseley.com/hercules/vstutor/vstutor.htm - Not having much experience with Alternate Indices, I found the section of Jay Moseley's VSAM Tutorial on the subject (near the bottom) to be very helpful. The trickiest part for me was understanding the Record Size for the Alternate Index. With unique keys (as in this example) the AIX records are fixed length. The record size of 17 (for this example) was then calculated as follows (a+b+c):

(a) 5 bytes for control information
(b) Key length (8 bytes in this case)
(c) RBA length (4 bytes)
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Alternate Index and ESDS.

Post by Anuj Dhawan »

Hi ApexNC,

Welcome to the Forum and Thanks for posting in the detailed explanation, appreciate it.

Request you to please use BBcode Tags by enclosing the "your code" inside the

Code: Select all

 Tags, like this: (// Please remove the space after code ]):

[quote][code ]
// your code
[/code ] [/quote]

I've edited your post to add the Code Tags... :). Hope it looks fine, the way you wanted to convey it.

Regards,
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
ApexNC
Registered Member
Posts: 10
Joined: Sun Dec 08, 2013 7:03 pm
Contact:

Re: Alternate Index and ESDS.

Post by ApexNC »

Thanks, looks great! I should mention that this is a copy of something I posted to LinkedIn, which is the reason for the leading "_" characters. LinkedIn removes leading spaces so you lose all indentation without them. If this site preserves leading spaces, those could be removed.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Alternate Index and ESDS.

Post by Anuj Dhawan »

ApexNC wrote:this is a copy of something I posted to LinkedIn, which is the reason for the leading "_" characters. LinkedIn removes leading spaces so you lose all indentation without them. If this site preserves leading spaces, those could be removed.
Have done the editing, took a bit but I think it looks neat now.

Thanks,
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anup Apte
Registered Member
Posts: 22
Joined: Mon Aug 12, 2013 11:39 am
India

Re: Alternate Index and ESDS.

Post by Anup Apte »

Thanks ApexNC and Enrico - this is a great help and gives me a direction.

Much appreciate your inputs... :)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SMS & VSAM and BDAM, BSAM, QSAM, BPAM, ISAM, OAM.”