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

Syncsort - Exclude headers from sort


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

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Fri Aug 20, 2010 4:24 pm
Reply with quote

I have the input file as shown below.
Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819162049104521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002
20100819082111204551301027525277401      AO22280773857002


RECFM=FB, LRECL=1000

Output file should be
Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002


There are many headers, In this case only 2 Headers I'm giving. The duplicates only within one header. Header record should not be considered in the sorting criteria.

Thanks,
S1522

I cleaned up this topic so S1522 can start over from the beginning and ask for a proper Syncsort solution.-Kevin.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4651
Location: Raleigh, NC, USA

PostPosted: Fri Aug 27, 2010 5:56 am
Reply with quote

S1522, we're going to start this one over. I've cleaned up all of the information that's not relevant since you have Syncsort. Could you please post what release of the product you have so Alissa can provide you with a working solution that's compatible?
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Fri Aug 27, 2010 8:26 am
Reply with quote

Hi Kevin,

Code:
SYNCSORT FOR Z/OS  1.3.0.0R


I have this release of the syncsort.

Thanks,
Subbu.
Back to top
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Fri Aug 27, 2010 12:15 pm
Reply with quote

Hi Subbu,

Is there any particular key field for the records within the Header reocord?

Since it seems to be the entire record itself as duplicate.
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Fri Aug 27, 2010 5:56 pm
Reply with quote

Hi Alex,

Below is the sort criteria.

Code:

  SORT FIELDS=(20,3,CH,A,23,13,CH,A)
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Tue Aug 31, 2010 8:07 pm
Reply with quote

Could you please help me on this?

I have the input file as shown below.
RECFM=FB, LRECL=1000
Code:


20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819162049104521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002
20100819082111204551301027525277401      AO22280773857002


Output file should be

Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002



I have the release given below:
Code:

 SYNCSORT FOR Z/OS  1.3.0.0R


The sort criteria given below.

Code:

 SORT FIELDS=(20,3,CH,A,23,13,CH,A)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 01, 2010 7:32 am
Reply with quote

Hi,

can the headers be duplicate. ie. is each header unique ?


Gerry
Back to top
View user's profile Send private message
venkatesh83be

New User


Joined: 10 Aug 2009
Posts: 12
Location: Chennai

PostPosted: Wed Sep 01, 2010 7:54 am
Reply with quote

Did u use "sum fields=none" to remove duplicates....
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Sep 02, 2010 2:30 am
Reply with quote

It appears that the records are already in sorted order. If this is true, then here are the SyncSort for z/OS control statements that will produce the requested output:
Code:
//SYSIN DD *                             
  SORT FIELDS=COPY                         
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(20,16,
    TRAILER3=(1,200,201,200,401,200,601,200,801,200))                   
/*   
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Tue Sep 14, 2010 9:24 pm
Reply with quote

Hi Alissa,
This is working but it is getting the last record of the detail if there are any duplicates in detail.

How could I get the 1st record of the detail if there are any duplicates in detail.

Example :

Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819162049104521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002
20100819082111204551301027525277401      AO22280773857002



CURRENT OUPUT
Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049104521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082111204551301027525277401      AO22280773857002


OUTPUT should be
Code:

20100819HEADER 045213004260 00001650N                   
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                   
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002


Please help me.

Thanks in advance!
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Sep 14, 2010 11:26 pm
Reply with quote

subbu1522,
Quote:
This is working but it is getting the last record of the detail if there are any duplicates in detail.
I don't have Syncsort but just throwing out something. Try to use HEADER3 instead of TRAILER3 and see if that works.

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

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Wed Sep 15, 2010 12:34 am
Reply with quote

I have verified and using the below sort. The Header record is also considered in the SORT. in my case the HEADER records should not be considered in the SORT.

Code:

//SYSIN DD *                             
  SORT FIELDS=COPY                         
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(20,16,
    TRAILER3=(1,200,201,200,401,200,601,200,801,200))                   
/*


Please help me.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Sep 15, 2010 2:41 am
Reply with quote

subbu1522 wrote:
Hi Alissa,
This is working but it is getting the last record of the detail if there are any duplicates in detail.

How could I get the 1st record of the detail if there are any duplicates in detail.

Here is a SyncSort for z/OS job that should give you the requested output:
Code:
//SORT1 EXEC PGM=SORT                                     
//SORTOUT DD SYSOUT=*                                     
//SYSOUT  DD SYSOUT=*                                     
//SORTIN  DD *                                           
20100819HEADER 045213004260 00001650N                     
20100819120019904521300435900015001      LJ12315973641002
20100819162049204521300498000327101      KR12919753700002
20100819162049104521300498000327101      KR12919753700002
20100819HEADER 045513010260 99911705}                     
20100819153648104551301027523153502      AO62281263154002
20100819082817304551301027525277401      AO22280773857002
20100819082111204551301027525277401      AO22280773857002
//SYSIN DD *                                             
  SORT FIELDS=COPY                                       
  OUTREC OVERLAY=(1001:SEQNUM,1,ZD,RESTART=(20,16))         
  OUTFIL INCLUDE=(1001,1,ZD,EQ,1),BUILD=(1,1000)             
/*                                                       
Back to top
View user's profile Send private message
subbu1522

New User


Joined: 11 Sep 2008
Posts: 29
Location: USA

PostPosted: Wed Sep 15, 2010 6:34 pm
Reply with quote

Hi Alissa,

I am getting the same problem by using the code you have suggested.

Header record is considered in the sort criteria. One of the HEADER record got deleted while writing to output.

HEADER record will have a word HEADER in the record (Pos 9-14) and it should not be considered in the sort criteria.

Thanks,
Subbu.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Sep 15, 2010 8:49 pm
Reply with quote

Try changing the OUTFIL statement as follows:
Code:
OUTFIL INCLUDE=(1001,1,ZD,EQ,1,OR,9,6,CH,EQ,C'HEADER'),
  BUILD=(1,1000) 
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 WER999A - UNSUCCESSFUL SORT 8ED U Ab... SYNCSORT 5
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts SORT deletes the SORTOUT file DFSORT/ICETOOL 8
No new posts Creating CSV file from Variable recs ... DFSORT/ICETOOL 11
No new posts Need suggestion on a sort card DFSORT/ICETOOL 10
Search our Forums:

Back to Top