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

copying a particular set of records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Thu Jan 05, 2006 9:25 pm
Reply with quote

I want to copy first 11 records and the last records from a sequential file.
Is there a direct method in sort other than using icetool.
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: Thu Jan 05, 2006 9:37 pm
Reply with quote

Quote:
want to copy first 11 records and the last records from a sequential file.


The "last records"? How many of the "last records"?

Quote:
Is there a direct method in sort other than using icetool.


Why "other than using icetool"?
Back to top
View user's profile Send private message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Thu Jan 05, 2006 9:41 pm
Reply with quote

not records, its just the last record. Its the trailer record.
Frank Yaeger wrote:
Quote:
want to copy first 11 records and the last records from a sequential file.


The "last records"? How many of the "last records"?

Quote:
Is there a direct method in sort other than using icetool.


Why "other than using icetool"?
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: Thu Jan 05, 2006 11:10 pm
Reply with quote

Getting the first 11 records is easy (STOPAFT=11 or ENDREC=11). To get the last record, you can use the method shown in the"Keep the last n records" Smart DFSORT Trick at:

Use [URL] BBCode for External Links

If you don't want to use ICETOOL for some reason, you can use two SORT steps instead of the two SORT operators.

There's also a trick for getting the last n records using COUNT-n with COPYs that's more efficient but if you don't want to use ICETOOL, you probably don't want to use COUNT-n from the Dec, 2004 DFSORT PTF either.
Back to top
View user's profile Send private message
Gautam512

Active User


Joined: 05 Oct 2005
Posts: 308
Location: Vizag / US

PostPosted: Thu Jan 05, 2006 11:30 pm
Reply with quote

This can be done by a small rexx program....

Can be more specific requirements

Thanks,
Gau
Back to top
View user's profile Send private message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Fri Jan 06, 2006 12:10 am
Reply with quote

I am not good in rexx...
and I need to do this by a sort job...
I have an input file with millions of records.....
i just want to copy the first 10 records and the last one record into another file.
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: Thu Sep 25, 2008 3:14 am
Reply with quote

Quote:
i just want to copy the first 10 records and the last one record into another file.


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(10) LAST
/*     


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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


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 Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top