Counting records using ICETOOL



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

Counting records using ICETOOL

Postby Aaron Chessell » Wed Aug 13, 2008 10:18 am

Hi guys,

Is there an easy/quick way to use ICETOOL to get a count of the number of records in a file that meet a given criteria. Note: This is on my 38 million record file.

eg.

AAAA20080101
BBBB20080201
CCCC20080301
CCCC20080315
DDDD20080331
EEEE20080401

I need to know the number of records where the value of the field at positions 5 to 12 is >= 20080301 and <= 20080331 (inclusive). In this example the count would be 3.

The data is currently sorted by the first 4 bytes.

Cheers,
Aaron
Aaron Chessell
 
Posts: 13
Joined: Tue Jul 22, 2008 4:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Counting records using ICETOOL

Postby Frank Yaeger » Wed Aug 13, 2008 9:58 pm

If you just want the count in a message, you can use a DFSORT/ICETOOL job like this:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//TOOLIN DD *
COUNT FROM(IN) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(5,8,CH,GE,C'20080301',AND,5,8,CH,LE,C'20080331')
/*


The count will be displayed in //TOOLMSG as follows:

ICE628I 0 RECORD COUNT:  000000000000003 


If you want something else, be more specific about what you want.
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

Re: Counting records using ICETOOL

Postby Aaron Chessell » Thu Aug 14, 2008 3:06 am

Thanks Frank, that is exactly what I am after.

Cheers,
Aaron
Aaron Chessell
 
Posts: 13
Joined: Tue Jul 22, 2008 4:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Counting records using ICETOOL

Postby xsclh » Sat Aug 16, 2008 10:19 pm

How can I write the count to a datset? I want to perform multiple counts based on different conditions on the same input file. It would be easier to work with the results if they were written to a file.

Thanks!
xsclh
 
Posts: 1
Joined: Sat Aug 16, 2008 10:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Counting records using ICETOOL

Postby dick scherrer » Sat Aug 16, 2008 11:05 pm

Hello and welceom to the forums,

How can I write the count to a datset?

If you assign the //TOOLMSG DD to a dataset rather than SYSOUT, the count (along with the other info) will be put in a dataset with no change to your sort control statements.

If you want something else, you might look at creating a trailer recor that contains the count.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Counting records using ICETOOL

Postby Frank Yaeger » Mon Aug 18, 2008 9:33 pm

How can I write the count to a datset? I want to perform multiple counts based on different conditions on the same input file. It would be easier to work with the results if they were written to a file.


You need to clarify what you mean by "perform multiple counts on different conditions". That's different then the single count the OP asked for so it would probably have a different solution.

Please show an example of your input records and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of your input file. Give the starting position, length and format of each relevant field.
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