ICETOOL学习笔记

ICETOOL Usage

General ICETOOL Job Format
//EXAMP JOB ...
//TOOL EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=A
//DFSMSG DD SYSOUT=A
//TOOLIN DD *
COPY, COUNT, DISPLAY, OCCUR, RANGE, SELECT, SORT, STATS, UNIQUE, or VERIFY operation.
/*

PGM=ICETOOL - to use ICETOOL directly.
TOOLMSG - ICETOOL message data set. This data set has the same attributes as the DFSORT SYSOUT data set.
DFSMSG - DFSORT message data set. This data set has the same attributes as the DFSORT SYSOUT data set.
TOOLIN - ICETOOL statements. This data set has the same attributes as the DFSORT SYSIN data set.

Comment Statements
Asterisk (*) in column 1 indicates a comment statement.
Comment statements are printed with other ICETOOL statements, but otherwise ignored.

ICETOOL Return Codes
ICETOOL sets a return code for each operation it performs.
For the step, ICETOOL sets the return code to the highest operator return code.
The return codes are:
0 - Successful completion. No errors were detected.
4 - Successful completion. DFSORT detected one or more warning conditions, or RC4 was used for COUNT and the criteria was met.
8 - Unsuccessful completion. RC8 was used for COUNT and the criteria was met.
12 - Unsuccessful completion. ICETOOL detected one or more errors, or RC12 was used (or defaulted) for COUNT and the criteria was met.
16 - Unsuccessful completion. DFSORT detected one or more errors.
20 - Message data set error. The TOOLMSG DD statement was not present or the TOOLMSG data set was not opened.
24 - Unsupported operating system. This operating system is not supported by this release of DFSORT.

Functions:

COPY - Copies a data set to one or more output data sets.
COUNT - Prints a message containing the count of records in a data set.
DEFAULTS - Prints the DFSORT installation defaults in a separate list data set.
DISPLAY - Prints the values or characters of specified numeric or character fields in a separate list data set. Simple, tailored, or sectioned reports can be produced.
MODE - Three modes are available which can be set or reset for groups of operators: STOP mode (the default) stops subsequent operations if an error is detected; CONTINUE mode continues with subsequent operations if an error is detected; SCAN mode allows ICETOOL statement checking without actually performing any operations.
OCCUR - Prints each unique value for specified numeric or character fields and how many times it occurs in a separate list data set. Simple or tailored reports can be produced. The values printed can be limited to those for which the value count meets specified criteria (for example, only duplicate values or only non-duplicate values).
RANGE - Prints a message containing the count of values in a specified range for a specified numeric field in a data set.
SELECT - Selects records from a data set for inclusion in an output data set based on meeting criteria for the number of times specified numeric or character field values occur (for example, only duplicate values or only non-duplicate values). Records that are not selected can be saved in a separate output data set.
SORT - Sorts a data set to one or more output data sets.
STATS - Prints messages containing the minimum, maximum, average, and total for specified numeric fields in a data set.
UNIQUE - Prints a message containing the count of unique values for a specified numeric or character field.
VERIFY - Examines specified decimal fields in a data set and prints a message identifying each invalid value found for each field.


COPY

COPY FROM(indd) TO(outdd,...) USING(xxxx) VSAMTYPE(F/V)

Copies an input data set to one or more output data sets.
1. The DFSORT control statements in xxxxCNTL are used if USING(xxxx) is specified.
2. DFSORT control statements and options can be used to copy a subset of the input records (INCLUDE or OMIT statement; SKIPREC and STOPAFT options)
3. Reformat records for output (INREC, OUTREC and OUTFIL)

COPY Sample:
//STEP10 EXEC PGM=ICETOOL
//TOOLMSG SYSOUT=*
//DFSMSG SYSOUT=*
//IN1 DISP=SHR,DSN=TOUGH.TEST.DEPT
//DEPT1 DISP=SHR,DSN=TOUGH.TEST.DEPT1
//TOOLIN DD *
COPY FROM(IN1) TO(DEPT1) USING(DPT1)
//DPT1CNTL *
INCLUDE COND=(5,3,CH,EQ,C'D01')
//

Sample1:
COPY FROM(MASTER) TO(PRINT,TAPE,DASD)

Sample2:
//TOOLIN DD *
COPY FROM(IN) TO(DEPT1) USING(DPT1)
COPY FROM(IN) TO(DEPT2) USING(DPT2)

//DPT1CNTL DD *
INCLUDE COND=(5,3,CH,EQ,C'D01')

Sample3:
//DPT2CNTL DD *
INCLUDE COND=(5,3,CH,EQ,C'D02')

//TOOLIN DD *
COPY FROM(IN1) USING(ALL2)

//ALL2CNTL DD *
OUTFIL FNAMES=DEPT1,STARTREC=10,ENDREC=100,INCLUDE=(5,3,CH,EQ,C'D01'),OUTREC=(C'DEPT1',6,20,'JXUST')
OUTFIL FNAMES=DEPT2,OMIT=(10,5,CH,NE,'JXUST'),INCLUDE=(5,3,CH,EQ,C'D02')

Sample4:
As an example, if you specify:
OUTFIL OUTREC=(2/,C'Field 2 contains ',4,3,/,C'Field 1 contains ',1,3)

An input record containing:
111222

Would produce the following four output records:
Blanks
Blanks
Field 2 contains 222
Field 1 contains 111

COUNT
COUNT FROM(IN1) USING(XXXX) VSAMTYPE(V/F) LOCALE(name)

Prints a message containing the count of records in a data set. The INCLUDE or OMIT statement can be used to count a subset of the input records.

COUNT can also be used to:
1. Subtract a value from the count
2. Add a value to the count
3. Create an output data set containing text and the count, or just the count
4. Set RC=12, RC=8 or RC=4 if the criteria is met, RC=0 if not met.

EMPTY, NOTEMPTY, HIGHER, LOWER, EQUAL, NOTEQUAL - defines the criteria against which the record count is to be matched.
ADD - adds a value to the record count.
SUB - subtracts a value from the record count.
WRITE - the ddname of the count data set.
TEXT - a string to be printed before the count in the count data set

Sample:
COUNT FROM(IN5) USING(CTL1) EMPTY RC12
COUNT FROM(IN5) LOWER(100) HIGHER(500) RC4
COUNT FROM(IN5) SUB(2) TEXT('TOTAL RECORD: ')

DEFAULTS
DEFAULTS LIST(OPTIONS)

Prints the DFSORT installation defaults in a separate list data set.

DATASORT
DATASORT FROM(indd) TO(outdd) USING(xxxx)
HEADER TRAILER VSAMTYPE(x)
FIRST LAST
HEADER(u) TRAILER(v)
FIRST(u) LAST(v)

Copies one or more header records and/or one or more trailer records to the outdd data set in their original indd record order, while sorting the indd data records between the header and trailer records to the outdd data set. Thus, the first n records (header records) and/or last n records (trailer records) are kept in place and the data records between them are sorted.

Sample:
DATASORT FROM(FILE1) TO(FILE2) LAST(5) USING(CTL1)
DATASORT FROM(IN1) TO(OUT1) HEADER(3) TRAILER(2) USING(CTL1)

DISPLAY
Prints the values or characters of specified numeric or character fields in a separate list data set. Simple, tailored, and sectioned reports can be produced.

DISPLAY FROM(ACCTS) LIST(FANCY) TBETWEEN(16) -
TITLE('Accounts Report for First Quarter') -
DATE(MD4/) BLANK -
HEADER('Amount') ON(12,6,ZD,C1,N08) -
HEADER('Id') ON(NUM,N02) -
HEADER('Acct#') ON(31,3,PD,NOST,LZ) -
HEADER('Date') ON(1,4,ZD,E'99/99',NOST) -
INDENT(2) BETWEEN(5) -
STATLEFT -
TOTAL('Total for Q1') -
AVERAGE('Average for Q1')

MERGE
MERGE FROM(indd,...) ... USING(xxxx) TO(outdd,...) VSAMTYPE(x)

Sample:
MERGE FROM(INPUT1,INPUT2,INPUT3,INPUT4,INPUT5) FROM(INPUT6,INPUT7) USING(CTL1)

//CTL1CNTL DD *
MERGE FIELDS=(52,8,UFF,D)
OUTFIL FNAMES=OUT1,INCLUDE=(15,3,SS,EQ,C'D21,D33')
OUTFIL FNAMES=OUT2,SAVE

SAVE - Specifies that OUTFIL input records not included by INCLUDE or OMIT for any other OUTFIL group are to be included in the data sets for this OUTFIL group.

MODE
MODE STOP/CONTINUE/SCAN

Specifies one of three modes to control error checking and actions after error detection. A MODE operator affects the processing of the group of operators which follow it, up to the next MODE operator (if any).

STOP - If an operation fails, stops processing the remaining operators in the group, but continues to check for errors in ICETOOL statements. STOP mode is the default.
CONTINUE - If an operation fails, continues processing the remaining operators in the group.
SCAN - Checks for errors in ICETOOL statements without processing the operators. Set automatically if an error is detected while in STOP mode.

OCCUR
OCCUR FROM(indd) LIST(listdd) ON(p,m,f) ...

Prints, in the listdd data set, each unique value for specified numeric and/or character fields and how many times it occurs.

Sample:
OCCUR FROM(SOURCE) LIST(VOLSERS) ON(40,6,CH) ON(VALCNT)

OCCUR FROM(FAILURES) LIST(CHECKIT) LISTNOSDB -
DATE(YMD.) TITLE('Possible System Intruders') TIME(12.) -
TITLE('based on logon failures') TFIRST -
HEADER(' Userid ') ON(23,8,CH) -
HEADER(' Logon Failures ') ON(VALCNT) -
HIGHER(4) BLANK

OCCUR FROM(CALLERS) LIST(CALLRPT) -
DATENS(4MD) TITLE('Large Call Volume') -
INDENT(5) BETWEEN(10) -
HEADER('Phone Number') ON(7,10,ZD,E'(999)-999-9999')-
HEADER('Calls') ON(VALCNT,A1,N06) HIGHER(1000)

20050228 Large Call Volume
Phone Number Calls
-------------- --------
(037)-325-1807 3,521
(216)-721-5530 2,100
(856)-003-3008 12,163

ON(VALCNT) - the "value count" (that is, the number of times the ON values occur) is printed in the list data set record along with the other ON values.

RANGE
RANGE FROM(indd) ON(p,m,f) HIGHER(x) VSAMTYPE(x)
ON(VLEN) LOWER(y)
EQUAL(v)
NOTEQUAL(w)

Prints a message in TOOLMSG containing the count of values in a specified range for a specific numeric field.

RANGE FROM(DATA1) ON(VLEN) HIGHER(52)

RANGE FROM(DATA2) ON(31,18,ZD) EQUAL(-123456789012345678)

RANGE FROM(DATA2) ON(25,3,PD) HIGHER(-20) LOWER(+15)

RESIZE
RESIZE FROM(indd) TO(outdd) TOLEN(n) USING(xxxx)

Creates larger records from smaller records, or smaller records from larger records.

Sample:
RESIZE FROM(LARGE) TO(SMALL) TOLEN(25)

RESIZE FROM(OLD) TO(NEW) TOLEN(120) USING(CTL1)
//CTL1CNTL
OMIT COND=(1,30,CH,EQ,C' ')
SORT FIELDS=(1,30,CH,A)

SELECT
SELECT FROM(indd) TO(outdd) ON(p,m,f) ...
DISCARD(savedd) ON(VLEN)
ALLDUPS VSAMTYPE(x) UZERO USING(xxxx)
NODUPS
HIGHER(x)
LOWER(y)
EQUAL(v)
FIRST
FIRST(u)
LAST
FIRSTDUP
FIRSTDUP(w)
LASTDUP

Selects records from the indd data set for inclusion in the outdd data set based on meeting criteria for the number of times specified numeric and/or character field values occur.

ALLDUPS
Limits the records selected to those with ON values that occur more than once(value count > 1). ALLDUPS is equivalent to HIGHER(1).
NODUPS
Limits the records selected to those with ON values that occur only once (value count = 1). NODUPS is equivalent to EQUAL(1) or LOWER(2).
HIGHER(x)
Limits the records selected to those with ON values that occur more than x times (value count > x, 0 LOWER(y)
Limits the records selected to those with ON values that occur less than y times (value count < y).
FIRST
Limits the records selected to those with ON values that occur only once (value count = 1) and the first record of those with ON values that occur more than once (value count > 1). You can use this operand to keep just the first record for each unique field value.
LAST
Limits the records selected to those with ON values that occur only once (value count = 1) and the last record of those with ON values that occur more than once (value count > 1). You can use this operand to keep just the last record for each unique field value.
DISCARD
can be used to save the records which do not meet the criteria (that is, the discarded records), in the savedd data set.

Sample:
SELECT FROM(INPUT) TO(DUPS) ON(11,8,CH) ON(30,44,CH) ALLDUPS

SELECT FROM(IN) TO(OUT1) ON(29,5,FS) HIGHER(3)

SELECT FROM(DATAX) TO(NEWEST) ON(135,20,ZD) LASTDUP USING(CTL1)

SELECT FROM(BOOKS) TO(PUBLISHR) ON(29,10,UFF) FIRST(3) DISCARD(SAVEREST)

SORT
SORT FROM(indd) USING(xxxx) TO(outdd,...) VSAMTYPE(x)
JKFROM

Sorts the indd data set to the outdd data sets (up to 10) using the the DFSORT control statements in xxxxCNTL.

Sample:
SORT FROM(A) TO(B,C,D) USING(DEPT)
//DEPTCNTL DD *
SORT FIELDS=(15,3,A,27,4,D),FORMAT=PD
INREC OVERLAY=(22:5,8,SQZ=(SHIFT=LEFT))

SORT FROM(VSAMIN) TO(VSAMOUT1) USING(VSAM) VSAMTYPE(F) LOCALE(DA_DK)
//VSAMCNTL DD *
SORT FIELDS=(27,12,CH,A)
/*

SORT FROM(MASTER) USING(MULT)
//MULTCNTL DD *
SORT FIELDS=(18,3,ZD,A,43,2,BI,D)
OUTFIL FNAMES=DEPT1,INCLUDE=(5,3,CH,EQ,C'D01')
OUTFIL FNAMES=DEPT2,INCLUDE=(5,3,CH,EQ,C'D02')
OUTFIL FNAMES=DEPT3,INCLUDE=(5,3,CH,EQ,C'D03')
OUTFIL FNAMES=REST,SAVE
/*

Note: OUTFIL is specified, then no need to specify the TO option.

SPLICE
SPLICE FROM(indd) TO(outdd) ON(p,m,f) ... WITH(p,m) ...
WITHALL KEEPNODUPS KEEPBASE VSAMTYPE(x) UZERO USING(xxxx)
WITHANY
WITHEACH
VLENMAX
VLENOVLY

Splices together specified fields from records with matching numeric or character field values (that is, duplicate values), but different information. This makes it possible to join fields from different types of input records to create an output record with information from two or more records.

Sample:
SPLICE FROM(T1) TO(OUT1) ON(11,8,CH) ON(30,44,CH) WITH(1,100)

SPLICE FROM(T2) TO(OUT2) ON(11,8,CH) WITHALL WITH(51,50) WITH(101,75) KEEPNODUPS USING(CTL1)

SPLICE FROM(ROWS) TO(OUTPUT) ON(15,5,ZD) WITHANY WITH(21,20) WITH(41,20) WITH(61,20)

STATS
STATS FROM(indd) ON(p,m,f) VSAMTYPE(x) LMSG ON(VLEN)

Prints messages in TOOLMSG containing the minimum, maximum, average and total for up to 10 specified numeric fields. The average is calculated by dividing the total by the record count and rounding down to the nearest integer.

VLEN - is equivalent to ON(1,2,BI) and for variable-length records, represents the record length for each record.
LMSG - the minimum, maximum, average and total for all numeric fields are printed using messages that display 31 digits

Sample:
STATS FROM(DATA1) ON(VLEN) ON(15,4,ZD)

STATS FROM(VSAMIN) ON(5,8,BI) ON(20,2,PD) ON(12,6,FS) ON(47,3,FI) VSAMTYPE(F)

SUBSET
SUBSET FROM(indd) TO(outdd) KEEP INPUT
DISCARD(savedd) REMOVE OUTPUT
HEADER TRAILER RRN(q) ...
FIRST LAST RRN(q,r)
HEADER(u) TRAILER(v) RRN(q,*)
FIRST(u) LAST(v)
USING(xxxx) VSAMTYPE(x)

Selects input or output records from the indd data set for inclusion in the outdd data set based on meeting criteria for keeping or removing the first n records, specific relative record numbers, and/or the last n records. From 1 to 300 relative records or ranges of relative records can be specified.

DISCARD - can be used to save the records which do not meet the criteria.
KEEP, REMOVE - indicates whether the records that meet the criteria are kept or removed.
INPUT, OUTPUT - indicates whether the criteria are to be applied to the input records or output records.
HEADER, FIRST, TRAILER, LAST, RRN - specifies the header records (first u records), trailer records (last v records) and/or relative records (relative record q, or relative records q to r) to be kept or removed.
RRN(q,*) can be used to specify relative records q through the last record. From 1 to 300 RRN operands can be specified. u, v, q and r must be specified as n or +n where n can be 1 to 999999999999999.

Sample:
SUBSET FROM(INPUT) TO(OUTPUT) REMOVE INPUT HEADER TRAILER

SUBSET FROM(FILE1) TO(FILE2) REMOVE INPUT RRN(8) RRN(21,25) RRN(5001,*)

SUBSET FROM(IN1) TO(OUT1) REMOVE OUTPUT LAST(5) USING(SRT1)
//SRT1CNTL
SORT FIELDS=(11,5,CH,A,21,6,SFF,D)

UNIQUE
UNIQUE FROM(indd) ON(p,m,f) VSAMTYPE(x) UZERO
ON(VLEN)

Prints a message in TOOLMSG containing the count of unique values for a specified numeric or character field.

UZERO - causes -0 to be treated as unsigned, that is, as +0.

Sample:
UNIQUE FROM(INPUT) ON(20,40,CH)

VERIFY
VERIFY FROM(indd) ON(p,m,f) NOSIGN LIMIT(n) VSAMTYPE(x)

Examines up to 10 specified decimal fields in a data set and prints a message in TOOLMSG identifying each invalid value found for each field.

NOSIGN - the sign of the decimal values is not to be checked for validity.
LIMIT - a limit for the number of invalid decimal values (overriding the default of 200). If n invalid decimal values are found, ICETOOL terminates the operation.

Sample:
VERIFY FROM(NEW) ON(22,16,PD) ON(7,9,PD)

VERIFY FROM(NEW) ON(22,16,PD) ON(7,9,ZD) NOSIGN LIMIT(10)

The second VERIFY operator checks for invalid digits (A-F) in the packed decimal values from positions 22-37 and the zoned decimal values from positions 7-15 of the NEW data set. A message is printed identifying each value (if any) that contains an invalid digit. If 10 invalid values are found, the operation is terminated.

Data Format
CH (character EBCDIC, unsigned). Each character is represented by its 8-bit EBCDIC code.
Example: AB7
C1 C2 F7 Hexadecimal
11000001 11000010 11110111 Binary

ZD (zoned decimal, signed). Each digit of the decimal number is converted into its 8-bit EBCDIC representation. The sign indicator replaces the first four bits of the low order byte of the number.
Example: -247
2 4 - 7 Decimal
F2 F4 D7 Hexadecimal
11110010 11110100 11010111 Binary

Example: +247
F2 F4 C7
11110010 11110100 11000111

PD (packed decimal, signed). Each digit of the decimal number is converted into its 4-bit binary equivalent. The sign indicator is put into the rightmost four bits of the number.

Example: -247
2 4 7- Decimal
2 4 7D Hexadecimal
00100100 01111101 Binary
The number +247 becomes 247C in hexadecimal.

BI (binary unsigned). Any bit pattern.

你可能感兴趣的:(Utility,JCL)