As Cool As Ice: Analyzing Your RACF Data Using Dfsort™ and Icetool
As Cool As Ice: Analyzing Your RACF Data Using Dfsort™ and Icetool
As Cool As Ice: Analyzing Your RACF Data Using Dfsort™ and Icetool
Agenda
Unloaded format is easy to read and import into data-analysis tools such
as DB2®, Microsoft® Excel®, SAS®, DFSORT, and even ISPF edit or
browse
Everything is unloaded, with the exception of security-sensitive fields
(such as passwords and keys) and information which is “reserved for
IBM use”
The output of these utilities is documented in “RACF Macros and
Interface”
RACF ships default 30+ sample reports in ‘SYS1.SAMPLIB(IRRICE)’
An Introduction to DFSORT
These examples may or may not work if you are using a sort
product other than DFSORT. Consult your OEM sort product
vendor for questions on other sort products.
In DFSORT, each field is identified by a starting position, a length, and a data type
(format).
DFSORT supports a large number of data types, such as CH, ZD, PD, BI, FS,
UFF, SFF, Y2K, etc.).
DFSORT can also parse delimited fields, such as CSV data, into fixed fields
SORT FIELDS=(startingPosition,length,dataType,sortOrder)
– sortOrder: ‘A’ for ascending, ‘D’ for descending
– dataType: ‘CH’ for character (EBCDIC) data
For example, to sort on the type of record, the date, and the time,
code:
SORT FIELDS=(5,8,CH,A,32,10,CH,A,23,8,CH,A)
Tip: If all of the fields have the same data type, you can code the
FORMAT= keyword, which applies the specified data type to all of
the fields in the statement:
SORT FORMAT=CH,FIELDS=(5,8,A,32,10,A,23,8,A)
DFSORT can be used to select records using the INCLUDE and OMIT
statements.
INCLUDE COND=(startingPosition,length,dataType,testType,value)
OMIT COND=(startingPosition,length,dataType,testType,value)
You can specify either a constant value (C’YES ‘) or another field in the
record (39,4,CH) for the value.
You can code multiple selection criteria, joined together with the
Boolean AND and OR operators
INCLUDE COND=(startingPosition,length,dataType,testType,value,AND|OR,
startingPosition,length,dataType,testType…)
OMIT COND=(startingPosition,length,dataType,testType,value,AND|OR,
startingPosition,length,dataType,testType…)
You can code only one INCLUDE or OMIT statement per sort operation
You must code a SORT, MERGE, or COPY statement with your INCLUDE
or OMIT statement
SORT FIELD=COPY or OPTION COPY can be used instead of SORT FIELDS=(….) if you
don’t want to or need to sort the input data
SORT FIELDS=(10,8,CH,A)
INCLUDE COND=(5,4,CH,EQ,C'0200',AND,
(44,3,CH,EQ,C'YES',OR,
49,3,CH,EQ,C'YES',OR,
390,3,CH,EQ,C'YES'))
INCLUDE COND=(10,44,CH,SS,C'*')
selects any record in which the character ‘*’ appears within columns 10 to 53
INCLUDE COND=(5,4,CH,EQ,C'0500',AND,
266,4,CH,EQ,C'NO ',AND,
(10,249,SS,EQ,C'*',OR,
10,249,SS,EQ,C'%',OR,
10,249,SS,EQ,C'&'))
Which finds all general resource profiles (record type '0500') which are not
generic (record offset 266 contains 'NO') but have a generic character in the
name (the "SS" operands)
The SORT operator allows you to sort data, select the records which are of
interest, reformat the records, etc.
…where
indd is the input data set DD name
outdd is the output data set DD name
cntl is the one to four character prefix for the DD name that contains the
DFSORT control statements
– The DD name is formed by appending “CNTL” to the USING value
INCLUDE COND=((44,1,CH,EQ,C'Y',OR,
49,1,CH,EQ,C'Y',OR,
390,1,CH,EQ,C'Y'),AND,
5,4,CH,EQ,C'0200')
…where
indd is the DD name of the input data set
field is the starting position, length and data type of the field that is to be in
displayed the report
listdd is the DD name of the report data set
ON(field) can be (and usually is) repeated, once for each field in the report, up to
20 times
/*
//RACFCNTL DD *
SORT FIELDS=(5,8,CH,A)
INCLUDE COND=((44,1,CH,EQ,C'Y',OR,
49,1,CH,EQ,C'Y',OR,
390,1,CH,EQ,C'Y'),AND,
5,4,CH,EQ,C'0200')
/*
The OCCURS (or OCCUR) operator prints each unique value and its count (how many
records it appears in) for the field you specify. You can use various options (title
elements, headings, etc.) as for DISPLAY.
…where
indd is the DD name of the input data set
field is the starting position, length and data type of the field to be displayed in the
report
– VALCNT is a special keyword for the count field
ON(field) can be (and usually is) repeated, once for each field up to 10 times
DFSORT allows you to select records based on a relative date, such as:
30 days ago
60 days from now
Example: Find all of the user IDs which have been defined
in the past 90 days
Output:
1- 1 - UL90: User IDs defined in the past 90 days 06/05/25 06:30:06 pm
Date User ID Owner Special Operations Auditor Last Date Last Time
---------- -------- -------- ------- ---------- ------- ---------- ---------
2006-05-25 MARKN IBMUSER YES YES YES 2006-05-25 15:13:58
2006-03-28 OMVSKERN IBMUSER NO NO NO 2006-03-28 10:32:45
2006-04-05 ZOS17 IBMUSER NO NO NO 2006-04-05
Sources of Information
The DFSORT website at www.ibm.com/storage/dfsort which contains samples, tricks, Q&A,
papers, etc.
Advanced DFSORT
One can get very creative with DFSORT. For example, the first record in your RACF
data base is the ICB (“Inventory Control Block”) and has a wealth of control
information about your RACF environment. You can use DFSORT to reformat this
record into something more readable.
OPTION COPY
ALTSEQ CODE=(005C)
OUTFIL STARTREC=1,ENDREC=1,LINES=255,
HEADER2=(3/,C'ICB
information',20X,C'Page:',PAGE=(EDIT=(TTT)),3/),
BUILD=(C'Number of BAM Blocks=',5,4,HEX,/,
C'RBA of highest CIB=',9,6,HEX,/,
C'RBA of first block in sequence set=',15,6,HEX,/,
C'RBA of first BAM block =',21,6,HEX,2/,
C'ICBFLAGS=X<',27,1,HEX,C'>',/,
C' Dataset Extended=',
27,1,CHANGE=(3,B'1.......',C'YES',B'0.......',C'NO'),/,
…
The result:
ICB information Page:001
Number of BAM Blocks=00000001
RBA of highest CIB=00000001A000
RBA of first block in sequence set=00000000E000
RBA of first BAM block =00000000C000
ICBFLAGS=X<30>
Dataset Extended=NO
Resident data blocks=YES
Data set format=NEW
HPCS Write in Progress=NO
Number of templates=05
BAM high water mark=00000000C000
ICBSTAT=X<3D>
Bypass RACINIT stats=NO
Bypass Data set statistics=YES
No TAPEVOL statistics=YES
No DASD volume statistics=YES
No terminal statistics=YES
No ADSP protection=NO
EGN=YES
ICBSTAT1=X<30>
INIT_EVENT_TYPE,5,8,CH
The Challenge:
The DB2 Load Utility statement is of the form: starting position:ending position
the DFSORT symbol is startingpositon, length
The DFSORT starting position includes the RDW (4), the DB2 Load utility
statement does not
There is lot of other information in the IBM-supplied DB2 Load utility
statements for IRRDBU00 and IRRADU00
OPTION COPY
INCLUDE COND=(1,60,SS,EQ,C'POSITION(',AND,
1,60,SS,NE,C'AUTHID_NAME')
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAT=NONBLANK,ENDBEFR=C' ',FIXLEN=20),
%02=(STARTAFT=C'(',ENDBEFR=C':',FIXLEN=4),
%03=(ENDBEFR=C')',FIXLEN=4)),
BUILD=(%01,X,%02,UFF,ADD,+4,EDIT=(IIIT),X,
%03,UFF,SUB,%02,UFF,ADD,+1,EDIT=(IIIT),X,C'CH')),
IFTHEN=(WHEN=INIT,BUILD=(1,33,SQZ=(SHIFT=LEFT,MID=C',')))