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
 

 

Copy only 9 records into another dataset using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copy only 9 records into another dataset using sort
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: 171
Location: Bangalore

PostPosted: Wed Apr 09, 2008 5:08 pm    Post subject: Reply to: copy using sort
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    Post subject: i dont know the number of records
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 09, 2008 8:11 pm    Post subject:
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 Moderator


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

PostPosted: Wed Apr 09, 2008 9:19 pm    Post subject:
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:

http://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    Post subject: Thanks Frank
Reply with quote

It worked............
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 Aug 12, 2008 11:49 pm    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us