z/OS DFSORT Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


COUNT operator

z/OS DFSORT Application Programming Guide
SC23-6878-00

Read syntax diagramSkip visual syntax diagram
>>-COUNT--FROM(indd)--+-------------+--+-------------+---------->
                      '-USING(xxxx)-'  '-VSAMTYPE(x)-'   

>--+-----------------+--+------+--+-------------+--+--------+--->
   +-LOCALE(name)----+  +-RC4--+  +-EMPTY-------+  +-SUB(q)-+   
   +-LOCALE(CURRENT)-+  +-RC8--+  +-NOTEMPTY----+  '-ADD(r)-'   
   '-LOCALE(NONE)----'  '-RC12-'  +-HIGHER(x)---+               
                                  +-LOWER(y)----+               
                                  +-EQUAL(v)----+               
                                  '-NOTEQUAL(w)-'               

>--+----------------+--+----------------+----------------------->
   '-WRITE(countdd)-'  '-TEXT('string')-'   

>--+---------------------+--+----------+-----------------------><
   +-DIGITS(d)-----------+  '-WIDTH(n)-'   
   '-EDCOUNT(formatting)-'                 

Prints a message containing the count of records in a data set. Can also be used to subtract a value from the count or add a value to the count, to create an output data set containing text and the count, or to set RC=12, RC=8, RC=4, or RC=0 based on meeting criteria for the number of records in a data set.

DFSORT is called to copy the indd data set to ICETOOL's E35 user exit. The DFSORT control statements in xxxxCNTL are used if USING(xxxx) is specified. You can use a DFSORT INCLUDE or OMIT statement in the xxxxCNTL data set to count a subset of the input records.

If an INCLUDE or OMIT statement is specified in the xxxxCNTL data set, the active locale's collating rules affect INCLUDE and OMIT processing as explained in the "Cultural Environment Considerations" discussion in INCLUDE control statement.

If EMPTY, NOTEMPTY, HIGHER(x), LOWER(y), EQUAL(v) or NOTEQUAL(w) is not specified, ICETOOL prints a message containing the record count as determined by its E35 user exit.

If EMPTY, NOTEMPTY, HIGHER(x), LOWER(y), EQUAL(v) or NOTEQUAL(w) is specified, ICETOOL checks the record count as determined by its E35 user exit against the specified criteria. If the criteria is met (for example, HIGHER(20) is specified and the record count is 21 or more), ICETOOL sets the following return code for the COUNT operator:
  • RC=12 if RC12 is specified, or by default if RC8 and RC4 are not specified
  • RC=8 if RC8 is specified
  • RC=4 if RC4 is specified

If the criteria is not met (for example, HIGHER(20) is specified and the record count is 20 or less), ICETOOL sets RC=0 for the COUNT operator. ICETOOL uses DFSORT's STOPAFT option to process the minimum number of records required to determine whether or not the criteria is met.

Note: Be sure to check the messages in TOOLMSG when you initially set up any COUNT operators with criteria to make sure that RC=12 is not issued because of syntax errors.

If SUB(q) is specified, ICETOOL subtracts q from the count, but does not reduce the count below 0. If ADD(r) is specified, ICETOOL adds r to the count. SUB(q) and ADD(r) are especially useful for dealing with data sets that contain header and trailer records.

If WRITE(countdd) is specified, ICETOOL writes a record containing the count in the countdd data set. TEXT('string') can be used to insert a string before the count in the output record. DIGITS(n) or EDCOUNT(formatting) can be used to change the appearance of the count in the output record. WIDTH(n) can be used to change the length of the output record.

You must not supply your own DFSORT MODS statement because it would override the MODS statement passed by ICETOOL for this operator.

Note: The record count is also printed for the DISPLAY, OCCUR, RANGE, SELECT, STATS, UNIQUE, and VERIFY operators.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014