Can I count records and show the count?



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Can I count records and show the count?

Postby AllyDick » Tue Mar 03, 2020 10:58 pm

Hi

I have the following dataset:

900012 10102020   XXXXXXXX
900012 10102020   YYYYYYYY
900012 10001171   ZZZZZZZZ
900012 10001665   AAAAAAA
900012 10003388   BBBBBBB
900012 10004081   CCCCCCC
900012 10004081   DDDDDDD
900012 10004081   EFGHSKS
900012 10010182   EEEEEEEE
900012 10022113   FFFFFFFF
900012 10032859   GGGGGG
900012 10034707   HHHHHH
900012 10035022   MNONON
900012 10039532   ABCDEFG
900012 10039532   ABEDGED


Dataset characteristics are RECFM=FB LRECL=1117

Position 1 - 6 = identifier
Position 8 -16 = Account no
Position 19 - 1117 = other data

I'd like to count instances of Account no, and add that counter to the data, but show each count increment e.g.

Result is:

900012 10102020  1  XXXXXXXX
900012 10102020  2  YYYYYYYY
900012 10001171  1  ZZZZZZZZ
900012 10001665  1  AAAAAAA
900012 10003388  1  BBBBBBB
900012 10004081  1  CCCCCCC
900012 10004081  2  DDDDDDD
900012 10004081  3  EFGHSKS
900012 10010182  1  EEEEEEEE
900012 10022113  1  FFFFFFFF
900012 10032859  1 GGGGGG
900012 10034707  1 HHHHHH
900012 10035022  1 MNONON
900012 10039532  1 ABCDEFG
900012 10039532  2 ABEDGED


When I have the result, I only want to keep Account Numbers that have a count > 1, including the originals e.g

Output I would like is:

900012 10102020  1  XXXXXXXX
900012 10102020  2  YYYYYYYY
900012 10004081  1  CCCCCCC
900012 10004081  2  DDDDDDD
900012 10004081  3  EFGHSKS
900012 10039532  1 ABCDEFG
900012 10039532  2 ABEDGED


Is it possible to do this using DFSORT/ICETOOL?

I'd be very grateful for any help. The data in Positions 9 to 1119 needs to be retained for the records that are being kept
Coded for you this time
AllyDick
 
Posts: 3
Joined: Tue Mar 03, 2020 10:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can I count records and show the count?

Postby sergeyken » Wed Mar 04, 2020 12:00 am

AllyDick wrote:Is it possible to do this using DFSORT/ICETOOL?


1) Search the SORT manual(s) for: "SECTIONS=…", "COUNT", and also "IFTHEN=…", "BUILD=…"
2) Find existing examples for operations similar to yours
3) Try to adjust standard examples to your own specific needs
4) If something goes wrong, then present here (a) your code, (b) your input data sample (truncated to only critical part!), and (c) your actual results
5) Don't forget to use code tags to enclose all your samples, and code
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Can I count records and show the count?

Postby NicC » Wed Mar 04, 2020 2:28 am

You say that you want to keep the data from bytes 9 to 1119 but you say th LRECL is 1117 - clarify.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Can I count records and show the count?

Postby AllyDick » Wed Mar 04, 2020 5:15 pm

Sorry the rec length is 1119 and not 1117. Thanks
AllyDick
 
Posts: 3
Joined: Tue Mar 03, 2020 10:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can I count records and show the count?

Postby sergeyken » Wed Mar 04, 2020 6:57 pm

AllyDick wrote:Sorry the rec length is 1119 and not 1117. Thanks


The original question "count records and show the count?" is not related in any manner to the dataset attributes.

I insist: try to read SORT manual(s) and do something by your own - before asking any questions.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Can I count records and show the count?

Postby AllyDick » Wed Mar 04, 2020 9:49 pm

sergeyken wrote:
AllyDick wrote:Sorry the rec length is 1119 and not 1117. Thanks


The original question "count records and show the count?" is not related in any manner to the dataset attributes.

I insist: try to read SORT manual(s) and do something by your own - before asking any questions.


Hmm. Where are those manuals kept? I went looking under IBM Manuals but it is like a needle in a haystack.
I am under time pressure to deliver something, so I thought someone here might have a helpful piece of ICETOOL or DFSORT jcl to help me on my way. No problem doing the hard yards if necessary either.
AllyDick
 
Posts: 3
Joined: Tue Mar 03, 2020 10:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Can I count records and show the count?

Postby NicC » Thu Mar 05, 2020 2:25 am

There is a link to the IBM Manuals at the top of each page of this forum; and Googling "dfsort guide" gives you the correct manual as the first item.
Your skillset, as per your profile, includes DFSORT so you should already have the manual bookmarked or downloaded.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Can I count records and show the count?

Postby Terry Heinze » Thu Mar 05, 2020 3:16 am

When I Google "IBM Manuals", the 1st screen gives http://ibmmainframes.com/manuals.php
One of those should be what you're looking for.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post