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

Last occurrence into output using SYSNSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Thu Jun 25, 2009 2:26 pm
Reply with quote

Please see my requirement.

input file:

A01 Record 1
A02 Record 2
A02 Record 3
A03 Record 4
A03 Record 5
A03 Record 6
A03 Record 7

Output file:

A01 Record 1
A02 Record 3
A03 Record 7

Please help me how to do this using SYNCSORT.

Thank you.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Jun 25, 2009 9:43 pm
Reply with quote

Here is a SyncSort for z/OS job that will produce your requested output if your data is already in sorted order:
Code:
//STEP1 EXEC  PGM=SORT                   
//SYSOUT  DD  SYSOUT=*                   
//SORTOUT DD  SYSOUT=*                   
//SORTIN  DD  *                         
A01 RECORD 1                               
A02 RECORD 2                               
A02 RECORD 3                               
A03 RECORD 4                               
A03 RECORD 5                               
A03 RECORD 6                               
A03 RECORD 7                               
//SYSIN   DD  *                         
   SORT FIELDS=COPY
   OUTFIL REMOVECC,NODETAIL,               
   SECTIONS=(1,3,TRAILER3=(1,80)) 
/*       

If it is not pre-sorted based on the key field (1,3), then change the sort statement to:
Code:
SORT FIELDS=(1,3,CH,A),EQUALS
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Mon Jun 29, 2009 6:40 pm
Reply with quote

Thank you!
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
No new posts XL C Trace Preprocessor Output All Other Mainframe Topics 3
Search our Forums:

Back to Top