To get the number of records SORTed at a control/break level



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

To get the number of records SORTed at a control/break level

Postby mats_001 » Wed Jul 04, 2012 11:30 pm

Hi All,

I am a new user to IBM Mainframe user group. I am also new to the SYNCSORT utility. I would really appreciate if anybody in the group can provide some guidance/advise for the below situation.

I have to create an O/P file with the sorted/data.

The input file contains Region code, Area code and the sales amount for the region.

I have to sort the file the sum up the sales amount on a area code basis. My O/P file should contain the Area code, the summed up sales amount for the area and the number of records (count) sorted in area level. The sales amount is in the packed decimal format.

Ex:
Input file
AREA1 REGION1 100.00
AREA3 REGION1 400.00
AREA2 REGION2 100.00
AREA3 REGION1 300.00
AREA1 REGION2 200.00
AREA3 REGION1 100.00

I am using OUTREC option to display only the required data in the O/P file

The sort card that I have used is,

SORT FIELDS=(1,5,CH,A,6,7,CH,A)
SUM FILEDS=(15,6,PD) - sales data is in the packed decimal format
OUTREC FIELDS=(1:1,5,1X,15,6,COUNT)

The required O/P is (Area code, the Summed up sales amount, and the number of records that belongs to that area code). I used the COUNT parameter in the SORT card. But I got message that it an invalid parameter for SYNCSORT

The required O/P file (after SORT) is as follows:

AREA1 300.00 2
AREA2 100.00 1
AREA3 800.00 3

I would really appreciate if anybody in the group can suggest the SORT card (for SYNCSORT) to achieve this requirement.

Thanks
Mat
mats_001
 
Posts: 3
Joined: Tue Jul 03, 2012 4:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: To get the number of records SORTed at a control/break level

 

Re: To get the number of records SORTed at a control/break l

Postby BillyBoyo » Wed Jul 04, 2012 11:47 pm

Firstly, there is a seperate Syncsort forum here. Where you posted is for DFSORT.

Perhaps look in your documentation for "reporting" options.

If you want it as an exercise, try the effect of adding a field containing the value one to the end of your record (assuming it is fixed-length) and extend the SUM to do that field as well.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: To get the number of records SORTed at a control/break l

Postby mats_001 » Thu Jul 05, 2012 7:20 am

Thanks BillyBoyo. I appreciare your guidance in giving the name of the correct discussion forum. I will re-post the query in the Syncsort forum.

Infact I tried the option of adding an extra field to each record (by using the INREC option) and tried to SUM up that field. Unfortunately it did not give me the expected result.

Thanks
Mat
mats_001
 
Posts: 3
Joined: Tue Jul 03, 2012 4:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: To get the number of records SORTed at a control/break l

Postby dick scherrer » Thu Jul 05, 2012 9:08 am

Hello,

Suggest you look into generating a Trailer for each group. I believe there are examples in this part of the forum.

Unfortunately it did not give me the expected result.
What result did it give? Did you use the exact same cose as you posted originally? If not, post the code that matches the unexpected result. Please use the "Code" tag as this will preserve alignment and improve readability. There is a Preview function so you can see your post as it will appear to the forum. When you are satisfied with the post, Submit.

And: Do NOT post the same question multiple times. I suspect this was to get your topic into the correct part of the forum. Someone had already done this :) I've deleted the duplicate.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: To get the number of records SORTed at a control/break l

Postby mats_001 » Fri Jul 06, 2012 3:58 am

Hello Sherrer,

Thanks a lot for removing the duplicate posting.

Today I explored more with the INREC parameters and finally I was able to get the record count at a control break of the SORT.

For every record I added a static value and included that parameter also in the SUM option and it worked.

Please find the SORT card that I have used:

INREC FIELDS=(1,70,C'0000001')
SORT FIELDS=(1,5,CH,A,6,7,CH,A)
SUM FIELDS=(13,5,PD,71,7,ZD)
OUTREC FIELDS=(1:1,5, 1X,13,5,1X,71,7)

I/P file:
Input file
AREA1 REGION1 100.00
AREA3 REGION1 400.00
AREA2 REGION2 100.00
AREA3 REGION1 300.00
AREA1 REGION2 200.00
AREA3 REGION1 100.00

O/P file:

AREA1 100.00 0000001
AREA1 200.00 0000002
AREA2 100.00 0000001
AREA3 800.00 0000003

Thanks a lot for your help.
Regards
Mat
mats_001
 
Posts: 3
Joined: Tue Jul 03, 2012 4:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: To get the number of records SORTed at a control/break l

Postby dick scherrer » Fri Jul 06, 2012 6:52 am

Good to hear you found a solution - thank you for letting us know :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post