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.
Copy & Sum the records
-
- Global moderator
- Posts: 369
- Joined: Tue Feb 26, 2008 11:15 pm
- Skillset: Syncsort MFX for z/OS
- Referer: Dick Scherrer
- Location: USA
- Contact:
Re: Copy & Sum the records
akanchu,
Try this SyncSort for z/OS 1.3 job:
Try this SyncSort for z/OS 1.3 job:
Code: Select all
//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)
/*
-
- Posts: 36
- Joined: Fri Jan 23, 2009 3:11 am
- Skillset: All Mainframe - JCL ; COBOL;
- Referer: ONline search
Re: Copy & Sum the records
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
Am I missing something ? I do not want all the header records to be copied.. just one (first one).
Please help.
Thanks in advance.
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
Code: Select all
//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.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Copy & Sum the records
Hello,
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)?
You need to help yourself. . . Do not post "it didn't work".Please help.
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.
d.sch.
-
- Posts: 36
- Joined: Fri Jan 23, 2009 3:11 am
- Skillset: All Mainframe - JCL ; COBOL;
- Referer: ONline search
Re: Copy & Sum the records
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.
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.
-
- Global moderator
- Posts: 369
- Joined: Tue Feb 26, 2008 11:15 pm
- Skillset: Syncsort MFX for z/OS
- Referer: Dick Scherrer
- Location: USA
- Contact:
Re: Copy & Sum the records
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.
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.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Copy & Sum the records
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.

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.
d.sch.
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Insert records from File1 between records of File2
by Daouchiche » Wed Nov 10, 2021 6:37 am » in DFSORT/ICETOOL/ICEGENER - 6
- 2344
-
by sergeyken
View the latest post
Thu Nov 11, 2021 12:43 am
-
-
- 12
- 3928
-
by RalphEagle
View the latest post
Fri Jul 30, 2021 1:00 pm
-
- 4
- 6241
-
by steve-myers
View the latest post
Sat May 15, 2021 1:58 am
-
-
How can I copy message queue files (LGMSG,SHMSG) in V9R1
by futohomok » Thu Jul 27, 2023 5:54 pm » in IMS DB/DC - 6
- 2079
-
by futohomok
View the latest post
Thu Aug 03, 2023 1:21 pm
-
-
-
Copy partial record after a string in a record using SORT.
by Esmayeelhusen » Thu May 04, 2023 3:03 pm » in DFSORT/ICETOOL/ICEGENER - 16
- 4270
-
by Esmayeelhusen
View the latest post
Mon May 22, 2023 3:50 pm
-