OCCUR Operator
Displays the value occurrences (OCCUR Operator)
OCCUR operator displays each unique occurrence and how many times they occur for the coded numeric/character fields in output list file. 1 to 10 ON fields can be coded if the resulting list file line length does not exceed the limit specified by the WIDTH operand or 8192 bytes.
Syntax -
Required Operands
- FROM - specifies ddname of the input file. It is mandatory when FROM operand is coded.
- LIST - specifies the list dataset ddname to be created by ICETOOL LIST operation. A listdd DD statement should be provided.
- ON (p,l,f) - specifies the field(s) used for validation.
- p - gives the starting position of field.
- l - gives the length of the field. The field should not be beyond position 32752 or the end of the record.
- f - gives the format of the data. The valid formats are PD(Signed Packed decimal - 1 to 16 bytes) and ZD (Signed Zoned decimal - 1 to 31 bytes).
Optional Operands
- TITLE, PAGE, DATE, DATENS, YDDD, YDDDNS, TIME and TIMENS - Specifies the elements in the title lines at the top of each page. Each title string can consist of up to three individual strings. A string can be 1 to 50 characters.
- TLEFT - Specifies title strings are left-justified for each other.
- TFIRST - Specifies the title lines are only printed on the first page.
- NOCC - Suppresses carriage control characters.
- HEADER - Specifies one, two, or three lines heading to be printed for the corresponding ON the field. A heading string can be 1 to 50 characters.
- NOHEADER - Suppresses the heading line.
- LINES - Specifies the number of lines per page. n can be 10 to 999.
- BLANK and PLUS - forces the column widths to be dynamically adjusted as needed. It suppresses leading zeros for numeric fields.
- ALLDUPS, NODUPS – Limits the count values to those occurrences that meet the given criteria. 'x', 'y', and 'v' values are mandatory. 'n' value should be positive, and 'n' can be 1 to 15 decimal digits.
- HIGHER (x), LOWER (y), EQUAL (v), NOTEQUAL (w) - Sets RC=0 if the record count satisfies the given condition. Sets RC=12 (or RC=8 when RC8 is specified, or RC=4 when RC4 is specified) if the record count is higher than x. x, y, v, and w should be specified as n, +n, or -n where n can be 1 to 31 digits. x, y, v and w values can be in between 0 to 562949953421310.
- VSAMTYPE - specifies the record format for a VSAM input file. It should be either F (fixed-length) or V (variable-length) record processing.
- WIDTH (n) - Specifies the record length and LRECL for the file. n value range from 121 to 8192.
- LONGLINE - Specifies the calculated line length to be a maximum of 8191 bytes.
- INDENT - Specifies the number of blanks used to indent the report. Overrides the default value 0. 'n' can range from 0 to 50.
- BETWEEN - Specifies the number of blanks used between the data columns. Overrides the default value of 3. 'n' can range from 0 to 50.
- TBETWEEN - Specifies the number of blanks used between title elements Overrides the default value of 8. 'n' can be from 0 to 50.
- UZERO - Causes -0 to be treated as unsigned, that is, as 0.
- LISTSDB - specifies to ICETOOL that the BLKSIZE should select as the system-determined optimum block size for the LIST file in the same way as for installation option SDBMSG=YES.
- LISTNOSDB - specifies to ICETOOL that the BLKSIZE should select as the system-determined optimum block size for the LIST file in the same way as for installation option SDBMSG=NO.
Example -
Scenario - Display the number of employees based on the country code(two characters from the 60th column).
INPUT - MATEPK.INPUT.PSFILE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
001 PAWAN MAINFRAME JPM AP IN
002 SRINIVAS TESTING ORACLE TG IN
003 SRIDHAR SAS CG OR US
004 VENKATESH ABAP CSC CA US
005 RAVI HADOOP CTS FL US
006 PRASAD HR INFOSYS MI US
007 RAJA TESTING IBM CA US
JCL -
----+----1----+----2----+----3----+----4----+----5----+
...
//STEP01 EXEC PGM=ICETOOL
//INDD DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD DD DSN=MATEPK.OUTPUT.PSFILEO,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN DD *
OCCUR FROM(INDD) LIST(OUTDD) -
TITLE('EMPLOYEES COUNT: COUNTRY LEVEL') -
ON(60,2,CH) ON(VALCNT)
/*
...
OUTPUT - MATEPK.OUTPUT.PSFILEO
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
EMPLOYEES COUNT: COUNTRY LEVEL
(60,2,CH) VALUE COUNT
IN 000000000000002
US 000000000000005