Count based on condition



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

Count based on condition

Postby hugol » Wed Dec 10, 2008 12:07 am

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
hugol
 
Posts: 5
Joined: Thu Dec 04, 2008 7:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count based on condition

Postby Frank Yaeger » Wed Dec 10, 2008 12:26 am

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post