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
 

 

Selecting a particular record from VSAM file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Selecting a particular record from VSAM file
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: 1772
Location: Bloomington, IL

PostPosted: Tue Nov 27, 2012 9:04 pm    Post subject:
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    Post subject:
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: 8132
Location: East Dubuque, Illinois, USA

PostPosted: Tue Nov 27, 2012 9:20 pm    Post subject:
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    Post subject:
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: 8132
Location: East Dubuque, Illinois, USA

PostPosted: Wed Nov 28, 2012 1:38 am    Post subject:
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: 30
Location: LA, California

PostPosted: Thu Nov 29, 2012 12:29 pm    Post subject:
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    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 Match two files using multiple keys a... santoshks1987 SYNCSORT 10 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm


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