Copy & Sum the records



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

Copy & Sum the records

Postby akanchu » Mon Apr 27, 2009 11:37 pm

I have a file that has mulitple header records and their subsequent transaction records.

I am trying to copy the file, but only sum the count in the headers and create only 1 Header record.


<key> <date><time> <count>
file looks like
HeaderHome 04272009113000 0000002
Record1
Record2
HeaderHome 04272009113200 0000001
Record1
HeaderHome 04272009113500 0000003
Record1
Record2
Record3


Result should be

HeaderHome 04272009113000 0000006
Record1
Record2
Record1
Record1
Record2
Record3


I was able to addup the counts, but could not get the trans records copied using SYNCSORT.
I am trying to use the the IFTHEN to apply the merge or the sum only on the key (HeaderHome) but no breakthru.

Any suggestions?

Thanks in advance.
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Copy & Sum the records

Postby Alissa Margulies » Tue Apr 28, 2009 1:15 am

akanchu,

Try this SyncSort for z/OS 1.3 job:

//SORT1 EXEC PGM=SORT 
//SYSOUT  DD SYSOUT=*   
//SORTIN  DD *                                             
HEADERHOME 04272009113000 0000002                         
RECORD1                                                   
RECORD2                                                   
HEADERHOME 04272009113200 0000001                         
RECORD1                                                   
HEADERHOME 04272009113500 0000003                         
RECORD1                                                   
RECORD2                                                   
RECORD3                                                   
//SORTOUT DD SYSOUT=*
//SYSIN   DD *                                               
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
         IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(81:8C'0'))   
   SORT FIELDS=(81,8,CH,A)                                   
   DUPKEYS SUM=(27,7,ZD)                                     
   OUTREC FIELDS=(1,80)                                     
/*                                                         
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 & Sum the records

Postby akanchu » Tue Apr 28, 2009 8:24 am

Hi Alissa,
Thanks for the reply.
I am not sure if I am missing anything. Here are the problems I am facing.
(a) We have SYNCSORT, which did not recognize DUPKEYS, so could not use that with SYNCSORT.
(b) I tried the same code with ICETOOL, but did not work, it just gave the same data as output. No difference, no total.

this is what it looks like
//STEP01   EXEC PGM=ICETOOL                         
//INPT     DD *                                     
HEADERHOME 04272009113000 0000001                   
RECORD1                                             
RECORD2                                             
HEADERHOME 04272009113200 0000001                   
RECORD1                                             
HEADERHOME 04272009113500 0000003                   
RECORD1                                             
RECORD2                                             
RECORD3                                             
/*                                                 
//OUPT     DD SYSOUT=*
//SYSOUT   DD SYSOUT=*                                               
//SYSPRINT DD SYSOUT=*                                               
//SYSUDUMP DD SYSOUT=*                                               
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//TOOLIN DD *                                                         
    COPY FROM(INPT) TO(OUPT) USING(CTL1)                             
/*                                                                   
//CTL1CNTL DD *                                                       
   INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),                 
         IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(81:8C'0'))           
   SORT FIELDS=(81,8,CH,A)                                           
   DUPKEYS SUM=(27,7,ZD)                                             
   OUTREC FIELDS=(1,80)                                               
/*                                                                   

Am I missing something ? I do not want all the header records to be copied.. just one (first one).

Please help.

Thanks in advance.
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Copy & Sum the records

Postby dick scherrer » Tue Apr 28, 2009 8:41 am

Hello,

Please help.
You need to help yourself. . . Do not post "it didn't work".

We cannot help unless you provide the proper info. When something does not work correctly or terminates with some error, you need to post all of the informational messages (including the message ids) from the problem run.

Why did you use icetool when the posted solution uses sort? When someone from the vendor offers a solution, it is best to work the solution they provided. . .

Did you notice that Alissa mentions release 1.3. Is your sort product current (this is also in the informational output from the sort)?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Copy & Sum the records

Postby akanchu » Tue Apr 28, 2009 6:53 pm

This may sound a little weird.

When I do a jj with the SORT, it gives me the following error :
DSS11051E UNRECOGNIZED 'SORT' KEYWORD 'DUPKEYS'

so I switched to ICETOOL, to see if that takes it. It did recognize it.
But then did not get the right result.

After reading Dick's mail, I went ahead to submit the JCL with the SORT and IT WORKED.. not sure why it gives the JCL error.

Thanks to both of you.
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Copy & Sum the records

Postby Alissa Margulies » Tue Apr 28, 2009 8:29 pm

akanchu,

JCL checkers typically are not kept up-to-date with the current features and functions of the SORT utilities. This is quite a common problem. Just as you had done here, in the future I would recommend simply just running the actual test sort jobs to see what results you get.
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 & Sum the records

Postby dick scherrer » Wed Apr 29, 2009 1:44 am

Good to hear it is working - thanks for letting us know :)

As Alissa mentions, different jcl checkers fall way behind - quite regularly.

There is also the liklihood that the jcl checkers will not implement all of the variations supported all of the software providers.

To check jcl syntax and not actually run a job, you could include TYPRUN=SCAN on the JOB statement and submit this.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post