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
 

 

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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts VSAM RLS=NRI while doing IDCAMS sheersh JCL & VSAM 1 Tue Mar 07, 2017 1:55 pm
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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