|
|
| Author |
Message |
Sonal Jadhao
New User
Joined: 03 Apr 2008 Posts: 4 Location: Chennai
|
|
|
|
| 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 |
|
 |
References
|
Posted: Fri Apr 04, 2008 9:07 am Post subject: Re: Read one record from a VSAM file using its Primary Key |
 |
|
|
 |
Devzee
Senior Member
Joined: 20 Jan 2007 Posts: 714 Location: Hollywood
|
|
|
|
| What programming language you intend to use for reading the VSAM file? |
|
| Back to top |
|
 |
venkata.ravi
New User
Joined: 09 May 2005 Posts: 4 Location: Hyderabad
|
|
|
|
You will get only one record if u use primary key, not multiple records |
|
| Back to top |
|
 |
Sonal Jadhao
New User
Joined: 03 Apr 2008 Posts: 4 Location: Chennai
|
|
|
|
| Using COBOL I want to Read VSAM |
|
| Back to top |
|
 |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 2448 Location: Brussels once more ...
|
|
|
|
Yes, and ? What is stopping you ?
Are you asking for code ?
Are there no examples in any manuals ? |
|
| Back to top |
|
 |
venkata.ravi
New User
Joined: 09 May 2005 Posts: 4 Location: Hyderabad
|
|
|
|
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 |
|
 |
Sonal Jadhao
New User
Joined: 03 Apr 2008 Posts: 4 Location: Chennai
|
|
|
|
| Thanks Venkat. |
|
| Back to top |
|
 |
|
|