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

Read VSAM file in CICS using non-primary key


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aham

New User


Joined: 24 Oct 2007
Posts: 42
Location: chennai

PostPosted: Tue Apr 29, 2008 5:26 pm
Reply with quote

Hi! I am new to CICS. As far as I learnt from materials available for CICS, KSDS file cannot be read in CICS using fields other than primary key/Alternate key. But my requirement is I have to read the KSDS VSAM file in CICS using non-unique key. Is there any way I can achieve this ?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Apr 29, 2008 6:26 pm
Reply with quote

How do you do that outside CICS?

O.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Apr 29, 2008 8:41 pm
Reply with quote

Hello,

As long as you are using a key, it should not matter that the key is not unique.

Possibly i misunderstand the question . . .
Back to top
View user's profile Send private message
Aham

New User


Joined: 24 Oct 2007
Posts: 42
Location: chennai

PostPosted: Wed Apr 30, 2008 7:26 am
Reply with quote

I have mentioned it wrong. Its just a field(not a defined key) in the VSAM that I wanted to use to read and get the first occurence of the primary key.

In Non-CICS COBOL, I will have copybook. I wil refer to the Field varible and the give the value for which I want the first occurence of Primary key. I dont know how to do that using CICS.

To state my requirement with example :

My VSAM has layout something similar to the one below:
Code:

----+----1..................7----+----8
AAAAAA..............................123
BBBBBB..............................234
CCCCCC..............................123
DDDDDD..............................223
EEEEEE..............................134
FFFFFF..............................134
GGGGGG..............................123



Here 1 to 6 is the primary key. 78 to 80 is the field of my concern. Here for every distinct value of this field in positions 78 to 80, I want the first occurence of Primary key (i.e pos 1 to 6). I don't know how to acheive this in CICS


i.e When my input is 123 , I should read the VSAM and fetch the primary key corresponding to the first occurence of this field which is AAAAAA. similarly for 134 it is EEEEEE.


Hope I am a bit more clear than in the last post. icon_smile.gif
Please help me.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Apr 30, 2008 7:42 am
Reply with quote

Hello,

Quote:
Here for every distinct value of this field in positions 78 to 80, I want the first occurence of Primary key (i.e pos 1 to 6). I don't know how to acheive this in CICS
How are you doing this outside of CICS?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 30, 2008 7:43 pm
Reply with quote

Aham wrote:
Here 1 to 6 is the primary key. 78 to 80 is the field of my concern. Here for every distinct value of this field in positions 78 to 80, I want the first occurence of Primary key (i.e pos 1 to 6). I don't know how to acheive this in CICS.
As far as I know, you can't guarantee the order of data within an alternate key (78 - 80) and you can't have non-contiguous keys with VSAM.......
Unless you want to setup an additional vsam KSDS file with just the alt and prime key in the ordet you want and use that for pointers to the primary vsam keyed file, no can do.........
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu May 01, 2008 4:53 am
Reply with quote

I'm still interested in how this was done outside of CICS.

d
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu May 01, 2008 6:03 am
Reply with quote

Maybe the file was originally loaded sequentially and accessed with minimal buffers in batch while the multilple buffers in CICS just grab the most conveniant.....
Like I said, you can't trust it without trying to trick it....
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Fri May 02, 2008 7:50 pm
Reply with quote

unless you build an alternate index , you will need to read the file
sequentially.

There is no other way..

Batch or CICS, vsam is vsam.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri May 02, 2008 8:07 pm
Reply with quote

Earl Haigh wrote:
unless you build an alternate index
My bad, I'd just assumed tht he had an alternate key on the second field.....
Even so, VSAM does not allow non-contigious keys, alternate or otherwise....
Back to top
View user's profile Send private message
Aham

New User


Joined: 24 Oct 2007
Posts: 42
Location: chennai

PostPosted: Fri May 02, 2008 9:40 pm
Reply with quote

Hi all ! I thought I am new to CICS. Not so. I am a bit worthless with VSAM that is what I learnt from this question of mine icon_lol.gif . THanks for all your replies
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top