syncsort help please



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

syncsort help please

Postby smellslikeroses » Fri Mar 12, 2010 7:00 pm

I cant figure why my duplicates are elimated in the following. I want to create a count of duplicate records on key 'ACCOUNT' (which works ok) and display all records including duplicates. I'm only getting one record for each key. Please someone...
38:11,10, CLIENT NUM
48:126,15, CLIENT NAM
63:43,9, FINANCL INST
72:71,10, AMOUNT
82:X'0000001C')
SUM FIELDS=(82,4,PD)

OUTREC FIELDS=(01:01,18, CUST ACC NUM
21:19,1, CLAIM OFFC
24:20,5, CONTRACT NUM
31:25,10, CERT
43:35,3, SERVICE LINE
48:38,10, CLIENT NUM
60:48,15, CLIENT NAM
77:63,9, FINANCL INST
88:72,10, AMOUNT
100:82,4,PD,EDZ9=(Z,ZZZ,ZZZ))
SORT FIELDS=(01,18,CH,A) POSITION AFT INREC

//SYSOUT DD SYSOUT=*
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: syncsort help please

Postby smellslikeroses » Fri Mar 12, 2010 8:45 pm

cant even c&p today !!

//SORT EXEC PGM=SORT
//* PARM='CORE=120000'
//*
//SORTLIB DD DSN=SYS1.SORTLIB,DISP=SHR
//SORTIN DD DSN=ABC.DEF.DAILY.TRANSACT.MARCH,
// DISP=SHR
//*
//SORTOUT DD DSN=ABC.DEF.DAILY.REPORTS.RPT(+1),
// DISP=(NEW,CATLG,DELETE),
// UNIT=TEST,SPACE=(CYL,(1,2),RLSE),
// DCB=(LRECL=108,BLKSIZE=0,BUFNO=30,RECFM=FB)
//*
//SORTWK01 DD UNIT=TEST,
// SPACE=(CYL,(20,10),RLSE),
// DCB=BUFNO=5
//*
//*
//SYSIN DD *
INREC FIELDS=(01:52,18, ACCOUNT
19:22,1,
20:23,5,
25:28,10,
35:38,3,
38:11,10,
48:126,15,
63:43,9,
72:71,10,
82:X'0000001C')
SUM FIELDS=(82,4,PD)
OUTREC FIELDS=(01:01,18,
21:19,1,
24:20,5,
31:25,10,
43:35,3,
48:38,10,
60:48,15,
77:63,9,
88:72,10,
100:82,4,PD,EDZ9=(Z,ZZZ,ZZZ))
SORT FIELDS=(01,18,CH,A)

//SYSOUT DD SYSOUT=*
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: syncsort help please

Postby smellslikeroses » Wed Mar 17, 2010 10:00 pm

Still havent found out why duplicates are not displayed....anyone?
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: syncsort help please

Postby Alissa Margulies » Wed Mar 17, 2010 10:23 pm

The SUM statement deletes records with equal control fields and optionally sums specified numeric fields on those records. If numeric fields are to be summed, the data in the summed fields are added, the sum is placed in one of the records, and the other record is deleted. Provided arithmetic overflow does not occur, the SUM control statement produces only one record per sort key in the output data set.

Instead of coding SUM, you might want to consider coding OUTFIL SECTIONS with a TRAILER3 COUNT or a SEQNUM with RESTART.
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: syncsort help please

Postby smellslikeroses » Wed Mar 17, 2010 11:06 pm

thank you for the reply. I'm not very familiar with syncsort, I'm just trying to count the occurances records with the same key and display each record, - is there an easy way to do this?
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: syncsort help please

Postby Alissa Margulies » Thu Mar 18, 2010 12:02 am

If you show some sample input records, I can provide you with the control statements.
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: syncsort help please

Postby smellslikeroses » Thu Mar 18, 2010 12:16 am

hi, thank you!!
my jcl is uses a dd statement referencing a sequential file, sample recs like the following:
AAAB 123 lksa ABCD123
AAAC 123 lksa EFGH456
AAAD 123 lksa ABCD123
BBBE 456 kkkl EFGH456
BBBF 456 kkkl ABCD123
CCCG 789 LKDS IJKL789

Key would be 4th field, so sorted, counted file would be like:

Account Nbr Model Serial Occurs
AAAB 123 lksa ABCD123 3
AAAD 123 lksa ABCD123 3
BBBF 456 kkkl ABCD123 3
AAAC 123 lksa EFGH456 2
BBBE 456 kkkl EFGH456 2
CCCG 789 LKDS IJKL789 1
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: syncsort help please

Postby Alissa Margulies » Thu Mar 18, 2010 1:32 am

Here is a SyncSort for z/OS 1.3.2 job that will produce the count at the end of every record:
//SORT1 EXEC PGM=SORT                                             
//SORTOUT DD DSN=&&OUT,DISP=(NEW,PASS),UNIT=SYSDA,SPACE=(TRK,1)   
//SYSOUT  DD SYSOUT=*                                             
//SORTIN  DD *                                                   
AAAB 123 LKSA ABCD123                                             
AAAC 123 LKSA EFGH456                                             
AAAD 123 LKSA ABCD123                                             
BBBE 456 KKKL EFGH456                                             
BBBF 456 KKKL ABCD123                                             
CCCG 789 LKDS IJKL789                                             
//SYSIN   DD *                                                   
   SORT FIELDS=(15,7,CH,A)                                       
   OUTREC OVERLAY=(23:SEQNUM,2,ZD,RESTART=(15,7))                 
/*                                                               
//SORT2 EXEC PGM=SORT                                         
//SORTOUT DD SYSOUT=*                                         
//SYSOUT  DD SYSOUT=*                                         
//SORTIN  DD DISP=(OLD,PASS),DSN=&&OUT                       
//SYSIN   DD *                                               
  SORT FIELDS=(15,7,CH,A,23,2,ZD,D)                           
  OUTREC IFTHEN=(WHEN=GROUP,END=(23,2,ZD,EQ,1),PUSH=(23:23,2))
/*

This is the output:
BBBF 456 KKKL ABCD123 03
AAAD 123 LKSA ABCD123 03
AAAB 123 LKSA ABCD123 03
AAAC 123 LKSA EFGH456 02
BBBE 456 KKKL EFGH456 02
CCCG 789 LKDS IJKL789 01

If you want the output in the same order as specified in your last post, then modify the SORT statement in the first step (SORT1) as follows:
SORT FIELDS=(15,7,CH,A,1,4,CH,D)
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: syncsort help please

Postby Alissa Margulies » Thu Mar 18, 2010 1:43 am

If the count is not required on each record, here is an alternate solution that only passes the data once:
//SORT1 EXEC PGM=SORT                                           
//SORTOUT DD SYSOUT=*                                           
//SYSOUT  DD SYSOUT=*                                           
//SORTIN  DD *                                                   
AAAB 123 LKSA ABCD123                                           
AAAC 123 LKSA EFGH456                                           
AAAD 123 LKSA ABCD123                                           
BBBE 456 KKKL EFGH456                                           
BBBF 456 KKKL ABCD123                                           
CCCG 789 LKDS IJKL789                                           
//SYSIN   DD *                                                   
   SORT FIELDS=(15,7,CH,A,1,4,CH,A)                             
   OUTFIL SECTIONS=(15,7,                                       
     TRAILER3=(C'    COUNT FOR ',15,7,C' = ',23:COUNT=(EDIT=(IT))))
/*                                                               

This is what the output looks like:
AAAB 123 LKSA ABCD123   
AAAD 123 LKSA ABCD123   
BBBF 456 KKKL ABCD123   
    COUNT FOR ABCD123 =  3
AAAC 123 LKSA EFGH456   
BBBE 456 KKKL EFGH456   
    COUNT FOR EFGH456 =  2
CCCG 789 LKDS IJKL789   
    COUNT FOR IJKL789 =  1
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: syncsort help please

Postby smellslikeroses » Thu Mar 18, 2010 2:09 am

BLESS YOU!
I have understood the example and have applied it to my jcl, its working and I will be able to learn from it!!
Thank you very much!
smellslikeroses
 
Posts: 12
Joined: Fri Mar 12, 2010 7:34 am
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post