Page 1 of 1

Can I count records and show the count?

PostPosted: Tue Mar 03, 2020 10:58 pm
by AllyDick
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

Re: Can I count records and show the count?

PostPosted: Wed Mar 04, 2020 12:00 am
by sergeyken
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

Re: Can I count records and show the count?

PostPosted: Wed Mar 04, 2020 2:28 am
by NicC
You say that you want to keep the data from bytes 9 to 1119 but you say th LRECL is 1117 - clarify.

Re: Can I count records and show the count?

PostPosted: Wed Mar 04, 2020 5:15 pm
by AllyDick
Sorry the rec length is 1119 and not 1117. Thanks

Re: Can I count records and show the count?

PostPosted: Wed Mar 04, 2020 6:57 pm
by sergeyken
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.

Re: Can I count records and show the count?

PostPosted: Wed Mar 04, 2020 9:49 pm
by AllyDick
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.

Re: Can I count records and show the count?

PostPosted: Thu Mar 05, 2020 2:25 am
by NicC
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.

Re: Can I count records and show the count?

PostPosted: Thu Mar 05, 2020 3:16 am
by Terry Heinze
When I Google "IBM Manuals", the 1st screen gives http://ibmmainframes.com/manuals.php
One of those should be what you're looking for.