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

Copy only 9 records into another dataset using sort


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

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Wed Apr 09, 2008 5:07 pm
Reply with quote

Hi
i have 10 records in a dataset. I want to copy only 9 records into another dataset. How i can do this in JCL.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Wed Apr 09, 2008 5:08 pm
Reply with quote

use
Code:
STOPAFT=9
Back to top
View user's profile Send private message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Wed Apr 09, 2008 7:12 pm
Reply with quote

Hi thanks for the quick reply.
My file is too big ... some millinons of records. I dont know the total number of records. So in this case how i can procedd.

or i can put my problem in this way.

I have some number of records in my file. I need to remove the last record. That is my requirement.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 09, 2008 8:11 pm
Reply with quote

In the inrec, add a sequence number.
Sort decending on the sequence number.
In outrec, skip 1.
Resort ascending on the sequence number.
In outrec, drop the sequence number.

You can skip the sequence number if there is a valid set of sort keys already in the record.
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: Wed Apr 09, 2008 9:19 pm
Reply with quote

srkumar422,

Is there some way to identify the last record (e.g. 'TRL' in positions 1-3) or can it only be identified as the last record in the file. If the former, you can use an OMIT statement. If the latter, you can use the technique described in the "Keep the last n records" Smart DFSORT Trick at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Thu Apr 10, 2008 11:43 am
Reply with quote

It worked............
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 Aug 12, 2008 11:49 pm
Reply with quote

If there's no way to identify the last record (or even if there is), you can use DFSORT's new SUBSET operator available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to do this kind of thing 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) REMOVE INPUT TRAILER
/*


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 How to split large record length file... DFSORT/ICETOOL 10
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
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 JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top