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

Syncsort - Adding totals in trailer for selected records


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

New User


Joined: 23 Jun 2010
Posts: 5
Location: Hyderabad

PostPosted: Wed Jun 23, 2010 4:13 pm
Reply with quote

This is my post on this forum. Please excuse if anything wrong with this query or the information provided is insufficient

I have the following data in my input file:

21111500/
300000000036701010000083047500/
40000000003670101000090853008001010100000200001/
50000000001/
300000000041644910000083206100/
40000000004164491000000642330001010100001200001/
50000000001/
600000000020166253600/
21112000/
300000000041644910000083208000/
40000000004164491000000642336601010100000600002/
40000000004454641000000142009701010100000400002/
50000000002/
300000000044346410000083208500/
40000000004434641000000255003901010100000800002/
50000000001/
600000000030249625100/

I need to create a trailer in this file which should have count of total number of records (ex: 17 in the above case) and total of fields between positions 28 and 37.
However, the totals should be calculated only for records starting with 4 in the first column (ex: 0415878700 in the above case).
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jun 23, 2010 4:22 pm
Reply with quote

Which program / utility do you propose to accomplish this request.

If it is your sort product then read on. If it is not your sort product you need to tell us exactly what it is that you will want to use to do this.

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT and the topic will be moved to the DFSORT forum by one of the moderators. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and the topic will remain in the JCL forum. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
Vinay Pandey

New User


Joined: 23 Jun 2010
Posts: 5
Location: Hyderabad

PostPosted: Wed Jun 23, 2010 5:01 pm
Reply with quote

I use SYNCHSORT itself
Back to top
View user's profile Send private message
Vinay Pandey

New User


Joined: 23 Jun 2010
Posts: 5
Location: Hyderabad

PostPosted: Wed Jun 23, 2010 5:36 pm
Reply with quote

SYNCSORT FOR Z/OS 1.3.2.2R

to be specific
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jun 28, 2010 3:59 pm
Reply with quote

Vinay Pandey,

You can achieve this using your sort product, but I wonder how you got the Total as 0415878700 icon_rolleyes.gif
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Jun 28, 2010 8:35 pm
Reply with quote

Here is a SyncSort for z/OS job that will produce your requested output. However, please note that as Arun pointed out, the TOTAL for columns 28-27 is not what you had specified.
Code:
//SORT1 EXEC PGM=SORT 
//SYSOUT  DD SYSOUT=* 
//SORTOUT DD SYSOUT=*                         
//SORTIN  DD *                                   
21111500/                                       
300000000036701010000083047500/                 
40000000003670101000090853008001010100000200001/
50000000001/                                   
300000000041644910000083206100/                 
40000000004164491000000642330001010100001200001/
50000000001/                                   
600000000020166253600/                         
21112000/                                       
300000000041644910000083208000/                 
40000000004164491000000642336601010100000600002/
40000000004454641000000142009701010100000400002/
50000000002/                                   
300000000044346410000083208500/                 
40000000004434641000000255003901010100000800002/
50000000001/                                   
600000000030249625100/                                             
//SYSIN   DD *                                             
 SORT FIELDS=COPY                                         
 OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'4'),OVERLAY=(81:28,10)),
        IFTHEN=(WHEN=NONE,OVERLAY=(81:C'0000000000'))     
 OUTFIL REMOVECC,                         
        TRAILER1=(1:'RECORD COUNT:',1X,                   
        COUNT=(EDIT=(IIT)),28:'TOTAL:',TOT=(81,10,ZD)), 
        OUTREC=(1,80)                                     
/*         


Here is the output produced from the above jobstream:
Code:
21111500/                                       
300000000036701010000083047500/                 
40000000003670101000090853008001010100000200001/
50000000001/                                     
300000000041644910000083206100/                 
40000000004164491000000642330001010100001200001/
50000000001/                                     
600000000020166253600/                           
21112000/                                       
300000000041644910000083208000/                 
40000000004164491000000642336601010100000600002/
40000000004454641000000142009701010100000400002/
50000000002/                                     
300000000044346410000083208500/                 
40000000004434641000000255003901010100000800002/
50000000001/                                     
600000000030249625100/                           
RECORD COUNT:  17          TOTAL:     8820505050
Back to top
View user's profile Send private message
Vinay Pandey

New User


Joined: 23 Jun 2010
Posts: 5
Location: Hyderabad

PostPosted: Tue Jun 29, 2010 1:20 pm
Reply with quote

Thanks Alissa and Arun.

The solution provided above has worked fine for me.

Also apologize for putting incorrect data in earlier post.

thanks again.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top