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

Selecting a particular record from VSAM file


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

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Tue Nov 27, 2012 8:53 pm
Reply with quote

Hi ,
I have to select a particular record from a VSAM file.I used IDCAMS utility
REPRO command with FROMKEY and TOKEY parameters.but actually the key having length of 8.but my desired record having key length 6.

I want to pick only my record with key length 6.I dont need any records having keylength more than 6 and same first 6 letters as my key.

For example. I want to select only the record with key MYKEYY.
I dont want to select records with key MYKEYY1 or MYKEYY2


Please Help.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Nov 27, 2012 9:04 pm
Reply with quote

When MYKEYY was added, with what was the key field padded?
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Tue Nov 27, 2012 9:10 pm
Reply with quote

In my output file it is padded with spaces. its like
Code:
"MYKEYY  "
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 Nov 27, 2012 9:20 pm
Reply with quote

Quote:
REPRO command with FROMKEY and TOKEY parameters.but actually the key having length of 8.but my desired record having key length 6.

I want to pick only my record with key length 6.I dont need any records having keylength more than 6 and same first 6 letters as my key.
You need to learn about VSAM files. If the key is defined as 8 bytes, the key is 8 bytes -- period. You may have a 6-byte key with 2 spaces (or low values or high values or some other collating sequence characters) on the end, but the key is still 8 bytes.

If your REPRO specifies
Code:
FROMKEY('MYKEYY  ') TOKEY('MYKEYY  ')
you will get, at most, 1 record output -- as long as you're not attempting to use an alternate index key that allow duplicates.
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 1:01 am
Reply with quote

Thanks for the explanation Robert.its working now when i gave within quotes.
thank you !!!!!!
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: Wed Nov 28, 2012 1:38 am
Reply with quote

A quick test indicates that using FROMKEY and TOKEY without quote marks to delimit the key causes REPRO to use the provided key as a generic key and thus you got extra records in your output.
Back to top
View user's profile Send private message
Vinodh S

New User


Joined: 12 Apr 2012
Posts: 28
Location: LA, California

PostPosted: Thu Nov 29, 2012 12:29 pm
Reply with quote

Robert

very helpful. Thanks icon_smile.gif
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top