Page 1 of 1

Count based on condition

PostPosted: Wed Dec 10, 2008 12:07 am
by hugol
hi, i want to know how many records i have depending on a condition, and put the results on an output file , like a report, ex:
FB
record length= 50, the important field here is (31,2,CH)

----+----1----+----2----+----3----+----4----+----5
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX770001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX770001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX800001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX800001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX900001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX910001-01-01XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX-XX-XX910001-01-01XXXXXXXX


output, FB, record length, 42

----+----1----+----2----+----3----+----4--
          77     80     90     91     92 
CLIENTS 000002 000002 000001 000002 000000

Re: Count based on condition

PostPosted: Wed Dec 10, 2008 12:26 am
by Frank Yaeger
You can use a DFSORT/ICETOOL job like the following. Modify as needed.

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=... input file
//RPT DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(IN) LIST(RPT) BLANK -
 HEADER('Account') ON(31,2,CH) -
 HEADER('Clients') ON(VALCNT)
/*


RPT would have:

Account           Clients     
-------   ---------------     
77                      2     
80                      2     
90                      1     
91                      2     


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/servers/storage/supp ... tmpub.html