|  
|
|  
|  
|
|  
|
|  
|
|  
|
|  
|
|  
|
|  
|
  |
|
  |
|
  |
|
|
Return to list of articles
Need to report on fields from SMF records? Here are some tips that you may find helpful.
We also have two 4GL products that make reporting on SMF data easier than ever.
Spectrum Writer 4GL -- get easy reports from SMF files, plus every other file in your shop!
Spectrum SMF Writer -- a very economical 4GL report writer that's just for SMF files!
Both programs also let you export SMF data to comma delimited files for use on PC's.
Best of all, you can download a free trial of either product and start making SMF reports right now! (Click one of the product names above to get started.)
Working with SMF & RMF Records
You can use Spectrum Writer (or Spectrum SMF Writer) to produce many useful reports from your shop's SMF files.
In addition, Spectrum Writer can also turn your SMF data into PC files, letting you work
with extracted SMF data in Excel (or other PC spreadsheet program). This This excerpt from the
Spectrum Writer Reference Manual provides
some tips on using Spectrum Writer with SMF files.
The SMF files are among the most complicated files in any shop. But Spectrum Writer
makes it easy to produce reports from them. Here are some specific points to keep in mind
when dealing with SMF files. Some of these points are illustrated in the SMF file definition
statements shown in Figure 42.
- SMF records can be big. So to be safe, specify Spectrum Writer's largest LRECL
value (32,767) when defining the file. Do this in either the FILE statement or the
INPUT statement. For example:
FILE: SMF DDNAME(SMF) LRECL(32767)
This will ensure that Spectrum Writer allocates an I/O area big enough to handle the
largest SMF records.
- You should not need to specify DCB information in your DD statement. Spectrum
Writer gets this information from the file's label. If you do give explicit DCB
information, be sure your LRECL and BLKSIZE values are correct for the input file.
- Spectrum Writer normally ignores the 4–byte RDW (record descriptor word) at
the beginning of variable–length records (such as SMF records). That is,
Spectrum Writer considers "column 1" of the SMF record to be the first byte
after the RDW. If you prefer to include the RDW as part of the input record, specify
the KEEPRDW option. Do this in either the FILE statement, the INPUT statement, or
an OPTIONS statement. For example:
FILE: SMF DDNAME(SMF) LRECL(32767) KEEPRDW
Note: When KEEPRDW is specified, "column 1" of the SMF record becomes the
first byte of the RDW. One reason you may want to specify KEEPRDW is to use the
field offsets listed in the SMF manual as a guide when writing your FIELD
statements. The SMF manual gives field offsets relative to the beginning of the
RDW.
- When defining fields to Spectrum Writer, you can use either the COLUMN parm
or the DISP (DISPLACEMENT) parm to specify where a field begins in a record.
Since the SMF manual indicates field locations as offsets (displacements), it's
generally more convenient to use the DISP parm in your FIELD statements.
FIELD: REC–TYPE DISP(5) LENGTH(1) TYPE(BIN) NOACC
- Spectrum Writer has a number of date and time "data types" that are especially
intended for use with SMF data. Use these in the TYPE parm of your FIELD
statements to define SMF dates and times. Some common data types for SMF
records are:
P-CYYDDD
| This is a packed Julian date which includes a single–digit century
indicator. Most SMF dates are stored in this format (written
0cyydddF in the SMF manual). Here is an example of defining a
date field and then using it to select the SMF records to include in
a report:
FIELD: SMF–DATE DISP(10) TYPE(P–CYYDDD)
INCLUDEIF: REC–TYPE = 5 AND SMF–DATE = 6/15/1994
| B-SECS
| This is a "binary seconds" time field. Most time–of–day and
elapsed time fields in SMF records are of this type. You should
specify LENGTH(4) for most SMF time fields. Also use the DEC(2)
parm to indicate that the binary seconds value contains hundredths
of seconds. Here is an example of defining a time field and using
it to select SMF records for a report:
FIELD: SMF–TIME DISP(6) TYPE(B–SECS) LENGTH(4) DEC(2)
INCLUDEIF: REC–TYPE = 5 AND (SMF–TIME > 12:59:00 AND < 13:02:30)
| BIT
| Some SMF data is contained in bits. For example, there is a bit in
type 5 records that indicates whether a job has ABENDed or not.
This bit is in the byte at offset 66, and is bit number 6 under IBM's
bit numbering convention. Remember that Spectrum Writer
numbers bits from 1 to 8 (rather than 0 to 7) from left to right. Thus
the ABEND field in the type 5 record can be defined like this:
FIELD: ABEND DISP(66) BIT(7)
To test a bit field, just name the field in your conditional
expression. For example, to include all type 5 records which
completed with an ABEND, use this statement:
INCLUDEIF: REC–TYPE = 5 AND ABEND
You can list bit fields in your COLUMNS statement as well.
COLUMNS: SMF–DATE SMF–TIME JOBNAME ABEND
By default the word "ABEND" will print in the report if the bit is on,
and the words "NOT ABEND" will print if the bit is off. Use the
ONTEXT and OFFTEXT parms in the FIELD statement if you want to
print different texts. (See an example of this on page 264.)
When defining bit fields, keep one other thing in mind. You
should explicitly specify a DISP or COLUMN parm for the first field
following the bit fields. Spectrum Writer does not automatically
increment the current location counter after FIELD statements for
bit fields. (This is to allow you to define additional bits within the
same byte.) An easy way to specify the DISP of the field following
a bit field is to use DISP(*+1):
FIELD: BIT–FIELD–A BIT(3)
FIELD: BIT–FIELD–B BIT(7)
FIELD: NEXT–FIELD DISP(*+1) LENGTH(5) ...
|
- In general you should work with only one type of SMF record at a time. Use the
INCLUDEIF statement to include only the appropriate type of records in your report.
You can use additional tests to further narrow down which records are
included.
INCLUDEIF: REC–TYPE = 30 AND SMF–DATE >= 6/1/1994
- Production SMF reports often report on "yesterday's" data. Rather than having to
change the date literal in your INCLUDEIF statement for each run, you can
COMPUTE yesterday's date, like this:
COMPUTE: YESTERDAY = #INCDATE(–1, DAY)
INCLUDEIF: REC–TYPE = 30 AND SMF–DATE = YESTERDAY
See "Computing Dates Like "Yesterday," "Last Week", etc." on page 272 for
more examples of automatically selecting date ranges bases on the system date.
- Some SMF records are variably formatted. That is, a field may be located at one
offset in one record, and at a different offset in another record of the same type.
This usually occurs when the record contains segments that are repeated a
variable number of times (such as one segment per DD statement in a step). Use
Spectrum Writer's OFFSET parm to define variably located fields. This parm is
used in the FIELD statement to specify an additional offset value to use when
determining where a field is located within a record. (This value is added to the
COLUMN or DISP parm value.) The advantage of the OFFSET parm is that, unlike
the COLUMN and DISP parms, it need not contain a constant numeric value. The
OFFSET parm can be any type of numeric expression. For example, it might be
something as simple as the name of a previously defined numeric field:
FIELD: IO–OFFSET DISP(32) TYPE(FULLWORD) /* OFFSET TO ID SECTION */
...
FIELD: JOBNAME DISP(0) OFFSET(IO–OFFSET) LEN(8) /*1ST ITEM IN ID SECTION*/
Or, the OFFSET value might be a complex calculation, such as would be needed to
compute the location of a field that follows a variable–length array (such as an
OCCURS DEPENDING ON array) in a record. For example:
FIELD: LAST–FIELD OFFSET(100 + (NUM–ITEMS–IN–ARRAY * ITEM–SIZE)) DISP(0) LENGTH(10)
When using the OFFSET parm, remember that the OFFSET parm remains in effect for
all subsequent FIELD statements (until a new OFFSET parm is encountered). Thus,
you only need to specify the OFFSET parm for the first field in any variably–located
segment. Specify OFFSET(0) if you wish to resume defining FIELDs that do not require
any OFFSET value.
Examples
The figures below show some actual SMF reports produced with Spectrum Writer.
|