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

IDCAMS to read last 10 records


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Feb 06, 2007 2:53 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Feb 06, 2007 5:46 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
Search our Forums:

Back to Top