Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
IDCAMS to read last 10 records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue Feb 06, 2007 10:47 am    Post subject: IDCAMS to read last 10 records
Reply with quote

Hi,

Is it possible to use IDCAMS to read only the last 10 records of a VSAM file. If so, how ?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Feb 06, 2007 2:53 pm    Post subject:
Reply with quote

As far as I know, it is posible, but only if you can identify which record is the 10th from the end.....
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue Feb 06, 2007 5:35 pm    Post subject:
Reply with quote

can u tel me how to do that, in case i know which is the 10th from the last??
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Feb 06, 2007 5:46 pm    Post subject:
Reply with quote

REPRO has FROMKEY, FROMADDRESS, FROMNUMBER, SKIP and TOKEY, TOADDRESS, TONUMBER, COUNT. These allow you to start and stop pretty much anywhere you want.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Feb 08, 2007 8:25 am    Post subject:
Reply with quote

Hi Raak,

If you have access to FileAid you can use this:
.
Code:
***********************************************************************           
To get highest 10 recs  in a VSAM file
***********************************************************************
         
//COPYKEY EXEC PGM=FILEAID
//DD01     DD  DSN=YOUR.VSAM.FILE
//DD01O    DD  DSN=file.contains.high.key
//SYSIN    DD  *
$$DD01 COPYBACK OUT=10
/*
//*
//NEXT    EXEC PGM=....
//HIGHKEY DD DSN=file.contains.high.key
//etc....

***********************************************************************           
To get 3rd highest key in a VSAM file
***********************************************************************           
//COPYREC  EXEC PGM=FILEAID
//DD01     DD  DSN=input.dsn,DISP=SHR
//DD01O    DD  DSN=output.dsn,DISP=SHR
//SYSIN    DD  *
$$DD01 COPYBACK SELECT=3,OUT=1
//SYSPRINT DD  SYSOUT=A
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 10 Thu Feb 22, 2018 5:37 pm
No new posts how to add the amount for duplicate r... SRUTHI DRAVIDAMANI COBOL Programming 6 Wed Feb 21, 2018 7:21 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 15 Fri Feb 09, 2018 10:38 pm
No new posts Why is SORT rearranging records that ... cschablow DFSORT/ICETOOL 4 Wed Jan 24, 2018 10:14 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us