Inrec Outfil Outrec
Inrec Outfil Outrec
* OUTREC FIELDS PUTS 0'S IN CURRENT YEARS AND SUM PREVIOUS YEARS
OPTION ARESALL=4000K
OMIT COND=(73,01,CH,EQ,C'Y')
INREC FIELDS=(08C'0', * ENLARGE TICKET COUNT 1,10
001,02, * YTD-TICKET-CNT S9V9.
08C'0', * ENLARGE TICKET COUNT 11,10
003,02, * MTD-TICKET-CNT S9V9.
08C'0', * ENLARGE TICKET COUNT 21,10
005,02, * WTD-TICKET-CNT S9V9.
009,01, * ICAR-PR-LNE-CD X. 31,01
073,01, * 401K FLAG X(1). 32,01
074,05, * INS-CM-CMPN-CD X(6). 33,05
035,03, * ICAR-ID X(3). 38,03
039,01, * IPY-PUR-CD X. 41,01
079,10, * ICAR-PR-CD X(10). 42,10
091,01, * PROPRIETARY-SW X. 52,01
2Z, * ENLARGE AMOUNT FIELD 53,09
126,07, * YTD-IPY-AN-PREM-AM S9(11)V99 PD
2Z, * ENLARGE AMOUNT FIELD 62,09
133,07, * MTD-IPY-AN-PREM-AM S9(11)V99 PD
2Z, * ENLARGE AMOUNT FIELD 71,09
140,07, * WTD-IPY-AN-PREM-AM S9(11)V99 PD
2Z, * ENLARGE AMOUNT FIELD 80,09
147,07, * YTD-FC-PC-AMT S9(11)V99 PD
2Z, * ENLARGE AMOUNT FIELD 89,09
154,07, * MTD-FC-PC-AMT S9(11)V99 PD
2Z, * ENLARGE AMOUNT FIELD 98,09
161,07) * WTD-FC-PC-AMT S9(11)V99 PD
SORT FIELDS=(31,01,CH,A, * ICAR-PR-LNE-CD
52,01,CH,A, * PROPRIETARY-SW
38,03,CH,A, * ICAR-ID
42,10,CH,A, * ICAR-PR-CD
41,01,CH,A) * IPY-PUR-CD
SUM FIELDS=(01,10,ZD, * SUM FIELDS BASED ON INREC FIELD DEFS
11,10,ZD,
21,10,ZD,
53,09,PD,
62,09,PD,
71,09,PD,
80,09,PD,
89,09,PD,
98,09,PD)
OUTFIL FNAMES=SORTOGSP,
OUTREC=(001:1X, RPT-REC-TYP-CD X.
002:31,01, ICAR-PR-LNE-CD X.
003:52,01, PROPRIETARY-SW X.
004:38,03, ICAR-ID X(3).
007:42,10, ICAR-PR-CD X(10).
017:41,01,CHANGE=(1,
C'E',C'E',
C'R',C'E',
C'O',C'E',
C'L',C'E'),
NOMATCH=(C' '),
018:10C'0', TKT YTD
028:10C'0', TKT MTD
038:10C'0', TKT WTD
048:1X'00000000000000000C', AN PREM YTD
057:1X'00000000000000000C', AN PREM MTD
066:1X'00000000000000000C', AN PREM WTD
075:1X'00000000000000000C', PCS YTD
084:1X'00000000000000000C', PCS MTD
093:1X'00000000000000000C', PCS WTD
102:01,10, PV-YTD-TICKET-CNT S9(9)V9.
112:11,10, PV-MTD-TICKET-CNT S9(9)V9.
122:21,10, PV-WTD-TICKET-CNT S9(9)V9
132:53,09, PV-YTD-IPY-AN-PREM-AM S9(15)V99 PD
141:62,09, PV-MTD-IPY-AN-PREM-AM S9(15)V99 PD
150:71,09, PV-WTD-IPY-AN-PREM-AM S9(15)V99 PD
159:80,09, PV-YTD-FC-PC-AMT S9(15)V99 PD
168:89,09, PV-MTD-FC-PC-AMT S9(15)V99 PD
177:98,09, PV-WTD-FC-PC-AMT S9(15)V99 PD
186:31,01, PRODUCT LINE
187:6X, CARRIER ABV NAME
193:C'0000', COMPANY RANKING
197:C'0000', PRODUCT RANKING
201:30X, CARRIER NAME
231:35X, PSB RPT DESC
266:32,01, 401K FLAG
267:34X) FILL OUT TO 300
END
Set RC=12 or RC=4 if file is empty, has more than n records, etc
The following related questions have been asked by various customers:
I need to check if a data set is empty or not. If it's empty I want to skip all
other steps. Is there any way I can check for empty data sets?
I would like to skip certain steps in my job if a file is empty. This would be
easiest if a utility would generate a non-zero RC if the input file is empty.
I have several datasets that I need to sort together. How can I terminate if the
total count of records in these data sets is greater than 5000.
I have a file that always has a header and trailer record and may or may not have
data records. Is there any way to check if there are no data records in the file?
ICETOOL can easily satisfy all of these requests. You can use ICETOOL's COUNT
operator to set a return code of 12 or 4 if a specified data set is EMPTY,
NOTEMPTY, HIGHER(n), LOWER(n), EQUAL(n) or NOTEQUAL(n), where n is a specified
number of records (for example, 5000). This makes it easy to control the execution
of downstream operators or steps using JCL facilities like IF or COND. If you use
the RC4 operand, ICETOOL sets RC=4; otherwise it sets RC=12.
For example, in the following ICETOOL job, the EMPTY operand of COUNT is used to
stop STEP2 from being executed if the IN data set is empty. ICETOOL sets RC=12 if
the IN data set is empty, or RC=0 if the IN data set is not empty. ICETOOL only
reads one record to determine if the data set is empty or not empty, regardless of
how many records there are in the data set.
In this next example, the HIGHER(5000) operand of COUNT is used to skip a SORT
operation if the count of records in three data sets is greater than 5000. ICETOOL
sets RC=12 if the CONCAT data sets have a total record count greater than 5000, or
a RC=0 if the total record count is less than or equal to 5000. MODE STOP (the
default) tells ICETOOL not to execute the SORT operation if the COUNT operation
sets RC=12.
With SUM FIELDS=NONE and EQUALS in effect, DFSORT eliminates "duplicate records" by
writing the first record with each key to the SORTOUT data set and deleting
subsequent records with each key. A competitive product offers an XSUM operand that
allows the deleted duplicate records to be written to an XSORTSUM data set. While
DFSORT does not support the XSUM operand, DFSORT does provide the equivalent
function and a lot more with the SELECT operator of ICETOOL.
SELECT lets you put the records that are selected in the TO data set and the
records that are not selected in the DISCARD data set. So an ICETOOL SELECT job to
do the XSUM function might look like this:
J03 RECORD 1
M72 RECORD 1
M72 RECORD 2
J03 RECORD 2
A52 RECORD 1
M72 RECORD 3
A52 RECORD 1
J03 RECORD 1
M72 RECORD 1
and XSORTSUM would contain the following records:
J03 RECORD 2
M72 RECORD 2
M72 RECORD 3
But SELECT can do much more than that. Besides FIRST, it also lets you use ALLDUPS,
NODUPS, HIGHER(x), LOWER(y), EQUAL(v), LAST, FIRSTDUP and LASTDUP. And you can use
TO(outdd) alone, DISCARD(savedd) alone, or TO(outdd) and DISCARD(savedd) together,
for any of these operands. So you can create data sets with just the selected
records, just non-selected records, or with both the selected records and non-
selected records, for all of these cases.