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
 

 

VSAM file indexing query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Wed Oct 15, 2008 3:52 pm    Post subject: VSAM file indexing query
Reply with quote

I have a VSAM file indexed on 3 fields and these 3 fields constitute the primary key....If i have values to only 2 of the 3 fields in my code and the third field is unknown then can i access the VSAM using only these two keys....Please the VSAM file below:

Code:
  Primary key               Related data
-------+-----------    -------------------------------------------------
00000001ABETA     ...............................* 
00000003BBETA     ............................... 
00000004BBETA     ...............................     
00000005CBETA     ...............................
00000006CBETA     ...............................
00000009ABETA     ...............................*
00000011ABETB     ............................... 
00000013BBETB     ............................... 
00000014BBETB     ...............................     
00000015CBETB     ...............................
00000016CBETB     ...............................
00000019ABETB     ...............................

key1 : first 8 bytes (00000001)
key2 : 9th byte (A/B/C)
key3 : 10th onwards 4 bytes (BETA)


If i have only key2 & key3,
key2 = A
key3 = BETA,combined as ABETA.
Is there any technique wherein i can access all rows in the VSAM using only,
key2 = A
key3 = BETA
that is code should read only the ones i have marked with a star (*) and
it should not read sequentially till it reaches the required record.

Restrictions:
I cannot change primary key, it has to be a combination of the three keys to remain unique.
Nothing else in the data area can be defined as a Alternate index.

I am contemplating the below two approaches:
1. Creating an alternate index out of the primary key
2. Using SHORT KEY method(i.e START with GTEQ option and doing a READ NEXT.) mentioned in this topic:
http://www.ibmmainframes.com/viewtopic.php?t=34910
(please provide reference on this option.

Sorry for this long post....

Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Oct 15, 2008 4:59 pm    Post subject:
Reply with quote

Alternate index is probably the better way to go; if you don't know the first part of the key value then you basically have to read the entire file sequentially to find the matches. Reading generic keys with GTEQ only works when you shorten the key from the right, not from the left.
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Wed Oct 15, 2008 5:26 pm    Post subject:
Reply with quote

Hi Robert,

Can i then create an AIX such that it consists of key2,key3 even if key2,key3 are a part of primary key. Actually have seen that most programs use AIX's present in the data area. If i define an AIX from the primary key, i shouldn't face any problem accessing it right?

Thanks for the reply..

Can u give some reference link for the GTEQ function, feel that it can be useful to me in some other reference.....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Oct 15, 2008 5:38 pm    Post subject:
Reply with quote

As far as your first question, from the manual on defining alternate indexes:
Quote:
KEYS(length offset]64 0)
describes the alternate-key field in the base cluster's data record.


The key field of an alternate index is called an alternate key. The data record's alternate key can overlap or be contained entirely within another (alternate or prime) key field.


The manuals link at the top of the page includes the COBOL Language Reference manual, which describes START KEY >= <value>. Usually when I see GTEQ and generic key it is in reference to CICS, and these manuals are also found at the manuals link.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Oct 16, 2008 1:29 pm    Post subject:
Reply with quote

Hi Aakar,
aakar wrote:
Can u give some reference link for the GTEQ function, feel that it can be useful to me in some other reference.....
As suggested, reference is in relation with CICS, here is a reference:

http://publib.boulder.ibm.com/infocenter/cicsts/v3r1/index.jsp?topic=/com.ibm.cics.ts31.doc/dfhp3/dfhp3mn.htm

Search for GTEQ there.
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Thu Oct 16, 2008 1:32 pm    Post subject:
Reply with quote

thanks anuj
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Oct 16, 2008 1:34 pm    Post subject:
Reply with quote

Hi,

Chek this one also,

http://publib.boulder.ibm.com/infocenter/txformp/v6r0m0/index.jsp?topic=/com.ibm.cics.te.doc/erziai0098.htm

Search for GTEQ there.


Please notice in your very first post, that's been edited to add the BBcode.
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Thu Oct 16, 2008 1:47 pm    Post subject:
Reply with quote

yeah i did notice that, how was it done, it looks better now.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Oct 16, 2008 2:36 pm    Post subject: Re: VSAM file indexing query
Reply with quote

aakar wrote:
how was it done.
Using BBcode tags.

May be you didn't notice the embedded link in the previous post, hover your mouse on the text "BBcode", it'll be hilighted with a underline, it's a link, click on that. It will tell what is BBcode.
Quote:
Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Thu Oct 16, 2008 2:45 pm    Post subject:
Reply with quote

thanks that will help me make my posts look better.....
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Oct 20, 2008 8:17 am    Post subject:
Reply with quote

You're welcome.. icon_smile.gif

-Ad
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Mon Oct 20, 2008 9:08 am    Post subject:
Reply with quote

Hey anuj,
In the same file above, Can we give a short key like this, in the start command,
key1= Low values (or first position)
key2 = A
key3 = BETA

and perform READ-NEXT command. Will this ensure that only the records with these two keys get read and that other records are skipped. so only,
00000001ABETA ......
00000009ABETA ......
gets read. It becomes a performance problem if i do sequential reads searching for records with these two values till end of file.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 20, 2008 9:16 am    Post subject:
Reply with quote

Hello,

No, that will not do what you want.

How many records are in the file?
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Mon Oct 20, 2008 9:22 am    Post subject:
Reply with quote

Very large number of records(>10000) are there in the file with the same key.
if i use an AIX made out of key2 & key3 and make key1(8 byte) as primary key, then the aix runs out of length.
refer my other post in this reference:
http://ibmmainframes.com/viewtopic.php?t=35264
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 20, 2008 9:25 am    Post subject:
Reply with quote

Hello,

Not what i asked - how many total records are in the file?
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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