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

Read VSAM file using partial key


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Fri May 21, 2010 3:21 pm
Reply with quote

Hi,

Please suggest a suitable method to read a VSAM KSDS file using partial key.
The key is of 24 bytes, and I have only data upto first 8 bytes.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 21, 2010 3:39 pm
Reply with quote

To name a few :

idcams
sas
easytrev
sort ?
Back to top
View user's profile Send private message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Fri May 21, 2010 3:42 pm
Reply with quote

Hi,

Please suggest a suitable method to read a VSAM KSDS file using partial key through cobol batch program.
The key is of 24 bytes, and I have only data upto first 8 bytes.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 21, 2010 3:43 pm
Reply with quote

Oh, yes and cobol of course.

I suggest to explore the cobol manual(s), that good enough?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri May 21, 2010 3:54 pm
Reply with quote

You obviously did not search the forum, otherwise you would have found THIS topic.
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 May 21, 2010 4:44 pm
Reply with quote

There is a manual link at the top of the page. Click on it, find the COBOL Language Environment manual, and read up on the START verb.
Back to top
View user's profile Send private message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Fri May 21, 2010 5:46 pm
Reply with quote

I have the code as :
in FILE CONTROL.

SELECT FILE1 ASSIGN TO FILE1
ORGANIZATION IS INDEXED
ACCESS IS DYNAMIC
RECORD KEY IS RECORD-KEY1
FILE STATUS IS WS-FILE1-STAT.

in working storage

01 RECORD-KEY1
05 CF-TYPE PIC X(01)
05 CF-SK PIC 9(07)
05 CF-SK-NO PIX X(9)
05 CF-P-NUMBER PIC 9(007) COMP-3
05 CF-LI-NUMBER PIC 9(003).


In PROCEDURE DIVISION:
MOVE 'S' TO CF-TYPE .
MOVE 0000018 TO CF-SK.
START FILE1
KEY GREATER THAN OR EQUAL TO RECORD-KEY1
READ FILE1

When i move the full key value to the key files it is working
but I have moved the values to first two fileds then by using the START i am trying to read record from same KSDS file. It throw file status 23. matching record not found.
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 May 21, 2010 5:50 pm
Reply with quote

1. What did you initialize the other fields of your RECORD-KEY1 to?
2. What was the file status for the START?
3. Why are you not using the VSAM file status extension?
4. Are you using a READ or READ NEXT in your program?

Depending upon your answers to these questions, a file status 23 could be the expected result of your code.
Back to top
View user's profile Send private message
abhishek.sun

New User


Joined: 22 Aug 2008
Posts: 2
Location: Gurgaon

PostPosted: Mon May 24, 2010 10:53 am
Reply with quote

I do agree with Robert.

Move LOW VALUES to rest of the key fields, prior to starting the file:

CF-SK-NO
CF-P-NUMBER
CF-LI-NUMBER

I think that should work.

~Abhi
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top