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 one record from a VSAM file using its Primary Key

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

New User


Joined: 03 Apr 2008
Posts: 5
Location: Chennai

PostPosted: Fri Apr 04, 2008 9:07 am    Post subject: Read one record from a VSAM file using its Primary Key
Reply with quote

I want to read one record from a VSAM file using its Primary Key. Can I do that? If yes , how do we do?
Back to top
View user's profile Send private message

Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Apr 04, 2008 10:20 am    Post subject:
Reply with quote

What programming language you intend to use for reading the VSAM file?
Back to top
View user's profile Send private message
venkata.ravi

New User


Joined: 09 May 2005
Posts: 30
Location: Hyderabad

PostPosted: Fri Apr 04, 2008 10:34 am    Post subject:
Reply with quote

icon_razz.gif You will get only one record if u use primary key, not multiple records
Back to top
View user's profile Send private message
Sonal Jadhao

New User


Joined: 03 Apr 2008
Posts: 5
Location: Chennai

PostPosted: Fri Apr 04, 2008 3:09 pm    Post subject: Reply to: Read one record from a VSAM file using its Primary
Reply with quote

Using COBOL I want to Read VSAM
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 Apr 04, 2008 3:24 pm    Post subject:
Reply with quote

Yes, and ? What is stopping you ?

Are you asking for code ?

Are there no examples in any manuals ?
Back to top
View user's profile Send private message
venkata.ravi

New User


Joined: 09 May 2005
Posts: 30
Location: Hyderabad

PostPosted: Fri Apr 04, 2008 6:11 pm    Post subject: Read one record from a VSAM file
Reply with quote

Here goes:

Reading from a VSAM file:Cluster must be opened for INPUT or I-O

1)Random Read with KSDS cluster:

MOVE value TO key1.
READ file-name RECORD [INTO ws-field]
INVALID KEY do something
NOT INVALID KEY do something else
END-READ


2)Random Read with RRDS cluster:

MOVE value TO key2.
READ file-name RECORD [INTO ws-field]
INVALID KEY do something
NOT INVALID KEY do something else
END-READ

Other than above you can use START command:

Repositions the file pointer at a record other than the next logical record.
File must be opened for INPUT or I-O

START file-name
KEY IS comparison key
INVALID KEY do something
NOT INVALID KEY do something else
END-START.
Back to top
View user's profile Send private message
Sonal Jadhao

New User


Joined: 03 Apr 2008
Posts: 5
Location: Chennai

PostPosted: Sun Apr 06, 2008 12:54 am    Post subject: Reply to: Read one record from a VSAM file using its Primary
Reply with quote

Thanks Venkat.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
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 Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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