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

read ksds record with partial key


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dalib123

New User


Joined: 14 Oct 2008
Posts: 7
Location: india

PostPosted: Fri Oct 17, 2008 5:03 pm
Reply with quote

Please suggest a suitable method to read a VSAM KSDS file using partial key.
The key is of 40 bytes, and I have only data upto 7 byes.
with the help of this 7 byte I have to read the data(from 40 byte key file).

thanks
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 17, 2008 5:06 pm
Reply with quote

What does it say in the manuals, and what have you tried yourself and what errors did you receive.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 17, 2008 5:06 pm
Reply with quote

Which language? CICS or batch? Can we assume the 7 bytes you have are the first 7 bytes of the key? What research have you done already? What isn't working that you need help with?
Back to top
View user's profile Send private message
dalib123

New User


Joined: 14 Oct 2008
Posts: 7
Location: india

PostPosted: Fri Oct 17, 2008 5:09 pm
Reply with quote

hi robert

It is batch one and it is first 7 bytes of the key(40 bytes)
of the key7 bytes
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 17, 2008 5:16 pm
Reply with quote

Use COBOL, move the 7 bytes to the key field, and do a START KEY GE then do READ NEXT. You'll need to check the key returned against your 7 bytes since START KEY GE may return a record with a different key if there's none that have the same first 7 bytes in the file. Since you're looking at just a piece of the key, be aware there could be multiple records in the file with the same first 7 bytes and code for the possibility.
Back to top
View user's profile Send private message
dalib123

New User


Joined: 14 Oct 2008
Posts: 7
Location: india

PostPosted: Mon Oct 20, 2008 11:05 am
Reply with quote

file structure for file BCA is


01 SVMBCA-BUS-CAT-ACTIVITY-RECORD.
03 BCA-KEY1.
05 BCA-LFI PIC X(1).
05 BCA-SUB-NO PIC X(7).
05 BCA-KEY2.
07 BCA-A-LFI PIC X(1).
07 BCA-BUS-CAT PIC X(2).
03 BCA-PERCENT PIC 9(3).
03 BCA-D-CR PIC 9(7) COMP-3.
03 BCA-D-UPD PIC 9(7) COMP-3.
03 BCA-UPD-SEQ PIC 9(3) COMP-3.
03 FILLER PIC X(11).

For read this with partial key



ZB-READ-BCA-FILE SECTION.
ZB000-ENTRY.

MOVE SUB-LFI TO BCA-LFI.
MOVE SUB-SUB-NO TO BCA-SUB-NO.
START BCA-FILE KEY IS GREATER OR EQUAL BCA-KEY1.
READ BCA-FILE

AT END SET WF-BCA-FILE-END TO TRUE
NOT AT END ADD +1 TO WW-BCA-READ
END-READ.
DISPLAY "BCA" ,SVMBCA-BUS-CAT-ACTIVITY-RECORD.


its displaying only value passed through SUB-LFI and BCA-SUB-NO only
not the whole record.
Back to top
View user's profile Send private message
aakar

New User


Joined: 08 Apr 2008
Posts: 36
Location: mumbai

PostPosted: Tue Oct 21, 2008 8:22 am
Reply with quote

From the code it seems that that Key length(key1 + key2) is 14 bytes & remaining 26 bytes is the value you are retreiving.

Can you try again just before START, give Low values to the remaning portion of the key BCA-KEY2? This should position the pointer where you want.

Also, Are you trying to read all records which are having 1st seven bytes of key value as what you have? If so then just a suggestion, AIX will be a good option.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 21, 2008 8:51 am
Reply with quote

You do a READ but don't say that SVMBCA-BUS-CAT-ACTIVITY-RECORD is the 01 in the FD; if this structure is in WORKING-STORAGE it will only reflect what you moved into it unless you do a READ INTO SVMBCA-BUS-CAT-ACTIVITY-RECORD.

aakar: note the level numbers. The key is all of the fields provided (plus a few more, I assume since the provided values only add up to 35 bytes). Also, AIX is overkill in this case -- START KEY IS GE will work fine for the first 7 bytes of the primary key.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 21, 2008 8:55 am
Reply with quote

Also, I would initialize the BCA-KEY2 value to LOW-VALUES since you otherwise do not know what the values in this part of the key are being set to (possibly already set to LOW-VALUES depending on LE storage settings, but possibly not). You very well could wind up not returning a key record due to the BCA-KEY2 fields being not matched even though the first two fields had matches.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top