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
 
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 add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 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