Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Reading a KSDS sequentially with alternate key

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

New User


Joined: 23 Jun 2008
Posts: 15
Location: bangalore

PostPosted: Wed Aug 12, 2009 9:53 pm    Post subject: Reading a KSDS sequentially with alternate key
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Aug 12, 2009 10:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Aug 13, 2009 11:30 am    Post subject:
Reply with quote

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
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 opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Need help in reading and validating a... ABINAYATHULASI COBOL Programming 8 Tue Apr 18, 2017 11:42 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Reading selected volumes of a multi-v... RickBig JCL & VSAM 6 Wed Jul 13, 2016 7:26 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us