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

Want to retrieve 1st 100 records and last 500 records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
s.siraj

New User


Joined: 17 Sep 2005
Posts: 1
Location: bangalore

PostPosted: Sat Sep 17, 2005 6:25 pm
Reply with quote

i am having 1000 records and i want to retrieve 1st 100 records and last 500 records how to do

plz send the ans immed
Back to top
View user's profile Send private message
anandkulkarni1

New User


Joined: 19 Sep 2005
Posts: 5

PostPosted: Mon Sep 19, 2005 9:51 am
Reply with quote

hi s.siraj,

one option i can suggest using cobol pgm is you can keep one counter during reading it from the file and u can break the counter once it reaches the 100th record.
you can do in the same for last 500 records also but only thing you should know total no of records exists in your file.

other than that you have use some ibm tools,..

thanks

anand.
Back to top
View user's profile Send private message
Puneet

New User


Joined: 27 Jun 2005
Posts: 9
Location: Chennai

PostPosted: Mon Sep 19, 2005 10:16 am
Reply with quote

Please see the Previous threads . The topic has already been discussed.
Thanks,
Puneet
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Sep 30, 2008 1:10 am
Reply with quote

You can now do this kind of thing quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:
 
 //S1  EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                           
//DFSMSG    DD  SYSOUT=*                                           
//IN DD DSN=...  input file                                       
//OUT DD DSN=...  output file         
//TOOLIN DD *                                                     
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST(100) LAST(500)
/*     


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Sep 30, 2008 1:01 pm
Reply with quote

If your site do not have version mentioned by Frank
Use below logic...
(Note: it is taking first 2 and last 2 recs)
Code:

//IN  DD *                                                   
1SKDSLDKSLS L 4                                               
2SDKLADALKS T 4                                               
3SDKLADALKS T 2                                               
4SKDSLDKSLS T 1                                               
5SKDSLDKSLS T 3                                               
6SKDSLDKSLS L 3                                               
7BCDEFGHIJK T 4                                               
8BCDEFGHIJK L 8                                               
9BCDEFGHIJK L 8                                               
/*                                                           
//OUT  DD  SYSOUT=*                                           
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,10),RLSE)
//TOOLIN   DD *                                                         
  COPY FROM(IN) TO(T1) USING(CTL1)                                     
  COPY FROM(IN) USING(CTL2)                                             
  COPY FROM(IN) TO(T1) USING(TMP1)                                     
  COPY FROM(T1) TO(OUT)                                                 
/*                                                                     
//TMP1CNTL  DD DSN=&&TMP1,DISP=(NEW,PASS),SPACE=(CYL,(1,10),RLSE)       
//CTL1CNTL DD *                                                         
  OPTION COPY                                                           
  OUTFIL FNAMES=T1,STARTREC=1,ENDREC=2                                 
/*                                                                     
//CTL2CNTL DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTFIL FNAMES=TMP1CNTL,REMOVECC,NODETAIL,                             
  TRAILER2=('  OUTFIL FNAMES=T1,STARTREC=',COUNT-1=(M11,LENGTH=8),','),
  TRAILER1=('  ENDREC=',COUNT=(M11,LENGTH=8))   
/*                                             

Output will be
Code:

1SKDSLDKSLS L 4
2SDKLADALKS T 4
8BCDEFGHIJK L 8
9BCDEFGHIJK L 8
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
Search our Forums:

Back to Top