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 ksds record with partial key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: read ksds record with partial key
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: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 17, 2008 5:06 pm    Post subject:
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Fri Oct 17, 2008 5:06 pm    Post subject:
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    Post subject:
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Fri Oct 17, 2008 5:16 pm    Post subject:
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    Post subject:
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    Post subject:
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 21, 2008 8:51 am    Post subject:
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 21, 2008 8:55 am    Post subject:
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    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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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