copy first occurence only



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

copy first occurence only

Postby ranga_subham » Wed Jul 07, 2010 6:30 pm

Hi,

I have an input file (LRECL=100,RECFM=FB) as shown below:

record 2010
record 2008
record 2007
record 2010
record 2007
record 2008
record 2010
record 2009
..
..
..
..
record 2008
record 2007


I want to copy only the first occurence of "record 2007" to output.

Please help me with the SORT card.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: copy first occurence only

Postby Alissa Margulies » Wed Jul 07, 2010 8:02 pm

Here is a SyncSort for z/OS job that will produce your requested output:
//SORT1 EXEC PGM=SORT                     
//SORTIN  DD *                             
RECORD 2010 1                             
RECORD 2008 2                             
RECORD 2007 3                             
RECORD 2010 4                             
RECORD 2007 5                             
RECORD 2008 6                             
RECORD 2010 7                             
RECORD 2009 8                             
//SORTOUT DD SYSOUT=*                     
//SYSOUT  DD SYSOUT=*                     
//SYSIN   DD *                             
   INCLUDE COND=(1,11,CH,EQ,C'RECORD 2007')
   SORT FIELDS=COPY,STOPAFT=1       
/*
(I added an extra field in the input data just to make it easier to identify the record included in the output...)

The output produced from the above sort step is:
RECORD 2007 3
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: copy first occurence only

Postby ranga_subham » Wed Jul 07, 2010 8:13 pm

Thanks a lot.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post