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
 

 

Read VSAM file in CICS using non-primary key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Read VSAM file in CICS using non-primary key
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: 2360
Location: Israel

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

How do you do that outside CICS?

O.
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: Tue Apr 29, 2008 8:41 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Apr 30, 2008 7:42 am    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 30, 2008 7:43 pm    Post subject:
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

Site Director


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

PostPosted: Thu May 01, 2008 4:53 am    Post subject: Reply to: Read VSAM file in CICS using non-primary key
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: 2150
Location: At my coffee table

PostPosted: Thu May 01, 2008 6:03 am    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Fri May 02, 2008 8:07 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 5 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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