View previous topic :: View next topic
|
Author |
Message |
meen
New User
Joined: 23 Jun 2008 Posts: 15 Location: bangalore
|
|
|
|
Hi
I have a KSDS file with alternate key ALT-KEY (21 bytes) as:
ALtkey-part1 x(5)
ALtkey-part2 X(4)
ALtkey-part3 x(12)
Now on screen user can enter :
First three digits of ALtkey-part1 and ALtkey-part2
Suppose user has entered ABC__ and DEFG
And In file we have records e.g ABC__DEFG09864754765, ABCXYZDEFG09864754875, ABCMNODEFG09864754765 etc...
Currently I am passing
ABC to ALTKEY-PART1(1:3)
SPaces to ALTKEY-PART1(4:2)
DEFG to ALtkey-Part2
I am browsing as:
EXEC CICS
STARTBR FILE('file name')
RIDFLD(ALT-KEY)
GTEQ
RESP(WS-RESP)
END-EXEC.
and Read Next until ALTKEY-PART1(1:3) or ALtkey-Part2 changes
EXEC CICS READNEXT
DATASET (file name')
INTO (file-RECORD)
RIDFLD (ALT-KEY)
RESP (WS-RESP)
END-EXEC.
But using this command I am getting only those records e.g ABC__DEFG09864754765 and not ABCMNODEFG09864754765.
Pls suggest how to browse and read the file so that i get all the records whose first three digits of ALtKey part 1 + ALtkey-Part2 are matching... the last two digits of ALtkey part1 in fetched records can be anything spaces or some value.! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You are getting exactly what you asked for. The records that match ABC<space><space> in your ALTKEY-PART1 are the only ones to be retrieved with your browse. If you want all matches, you'll need to do a generic key read on just the first 3 bytes of the key, then look at the ALTKEY-PART2 for matching fields. CICS does not allow wild card matching so there's no other way to find all matching ALTKEY-PART1 records. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
So I'm picky this morning ..............
How can you read the file sequentially using an alternate key, surely to read it sequentially you would use the primary key as the records are stored in the order of the primary key. |
|
Back to top |
|
|
|