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
 

 

Want to retrieve 1st 100 records and last 500 records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: hi
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Sep 30, 2008 1:10 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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    Post subject:
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    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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
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 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