View previous topic :: View next topic
|
Author |
Message |
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
How do you do that outside CICS?
O. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
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.
Please help me. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
I'm still interested in how this was done outside of CICS.
d |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Earl Haigh
Active User
Joined: 25 Jul 2006 Posts: 475
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
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 . THanks for all your replies |
|
Back to top |
|
|
|