Page 1 of 1

Counting records using ICETOOL

PostPosted: Wed Aug 13, 2008 10:18 am
by Aaron Chessell
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

Re: Counting records using ICETOOL

PostPosted: Wed Aug 13, 2008 9:58 pm
by Frank Yaeger
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.

Re: Counting records using ICETOOL

PostPosted: Thu Aug 14, 2008 3:06 am
by Aaron Chessell
Thanks Frank, that is exactly what I am after.

Cheers,
Aaron

Re: Counting records using ICETOOL

PostPosted: Sat Aug 16, 2008 10:19 pm
by xsclh
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!

Re: Counting records using ICETOOL

PostPosted: Sat Aug 16, 2008 11:05 pm
by dick scherrer
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.

Re: Counting records using ICETOOL

PostPosted: Mon Aug 18, 2008 9:33 pm
by Frank Yaeger
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.