You are currently on IBM Systems Media’s archival website. Click here to view our new website.

MAINFRAME > Tips & Techniques > Application Development

A Closer Look at the REXX Code for Processing SMF Data


Editor’s note: This article is the fourth and final of a series exploring how to process Systems Management Facilities (SMF) data using the REXX programming language.

Throughout this series, we've demonstrated examples by viewing SMF records in IDCAMS formatted dump output format. For your own tooling purposes, you'll need to have a data set in which the dump formatted output can be written to such that it can be manipulated by a REXX exec.

First, pre-allocate an output work data set with the same attributes as your input SMF data set, except that the record format should be variable block (VB). For the example in this article, our output work data set will use the following attributes:



Table 1

Data Set Name GEORGEN.READSMF.VB.SEQ
Data Set Organization (DSORG) PS (sequential)
Record Format (RECFM) VB (variable block)
Record Length (LRECL) 32760
Block Size (BLKSIZE) 27998
Data Set Type (DSNTYPE) LARGE. Use LARGE if your SMF input data set is larger than 65535 tracks (4369 cylinders) on a single volume, otherwise just take the default.
Space Should be similar to the space attributes of your SMF input data set

Figure 1 shows the sample Job Control Language (JCL), with some annotations, to run the REXX SMF parsing exec named @IBMR304 under the IKJEFT01 TMP (Terminal Monitor Program)—i.e., the time-sharing option (TSO) TMP initialization utility. The JCL source can be found in Code Sample 1.

In addition, the REXX source code for the @IBMR304 exec is provided in Code Sample 2, while a diagram of the general hierarchical calling flow in the exec can be found in Code Sample 3.

Snippets of Interest

Reading through the articles in this series, one can see the general flow and logic of the exec is fairly straightforward. However, a few code fragments in the REXX source might bear a bit more exposition.

In the process_smf_data() subroutine, you'll notice the following:

"CALL 'SYS1.LINKLIB(IFASMFDP)'"
"REPRO IFILE(DUMPOUT) OFILE(WORKSMF)"
"EXECIO * DISKR  WORKSMF ( FINIS STEM SMF."

Let's look at each line individually.

"CALL 'SYS1.LINKLIB(IFASMFDP)'"

IFASMFDP, the SMF data set dump utility program, is supplied as part of the z/OS base and is used to transfer the contents of an SMF data set to another data set. This REXX source line statement correlates to the following JCL fragment from Figure 1.

//DUMPIN    DD    DISP=SHR,DSN=SMFDATA.SMFSM0.G2441V00
//DUMPOUT   DD    DISP=(,PASS),SPACE=(CYL,(100,50)),UNIT=SYSDA,
//          DSN=&&DP
//SYSIN     DD    *
INDD(DUMPIN,OPTIONS(DUMP))
OUTDD(DUMPOUT,TYPE(30(4)))
/*
  • The SYSIN DD shows the statements and parameters being passed to the IFASMFDP invocation in the exec.
  • The INDD SYSIN statement describes the input data set that contains the raw SMF data pointed to by the DD named DUMPIN, or SMFDATA.SMFSM0.G2441V00.
  • OPTIONS (DUMP) indicates that the input data set is to be read and copied without being reset.
  • The OUTDD SYSIN statement describes the output work data set to which IFASFMDP will transfer the contents of the DUMPIN DD. Here, the temporary output work data set is pointed to by the DUMPOUT DD.
  • The TYPE parameter of the OUTDD SYSIN statement indicates that, for the purposes of this example, it will filter for and write SMF Type 30 Subtype 4 records only.
"REPRO IFILE(DUMPOUT) OFILE(WORKSMF)"

After invoking IFASMFDP, the DUMPOUT DD will contain the SMF Type 30 Subtype 4 records that we want to work with. You might be thinking, why not just read directly from the DUMPOUT DD now?

First, the data set attributes of the DUMPOUT DD will be patterned from the characteristics of the DUMPIN DD from which the SMF records were dumped. Hence, the RECFM of the DUMPOUT DD will be Variable Block Spanned (VBS).

However, REXX has the documented restriction that the EXECIO command does not support I/O on files allocated to data sets with spanned, track overflow or undefined record formats. So if we can't read VBS formatted records, what can we do?

Well, remember the output work data set with RECFM=VB that was pre-allocated? To resolve this dilemma, we're just going to use the REPRO command to handle the gory details in copying the DUMPOUT records (RECFM=VBS) to our work data set (RECFM=VB) to bypass this restriction.

"EXECIO * DISKR  WORKSMF ( FINIS STEM SMF."

Once the REPRO command is executed, the work data set pointed to by the WORKSMF DD contains the SMF Type 30 Subtype 4 records in a format that’s now readable by the EXECIO command. In this REXX source line statement, all of the data pointed to the WORKSMF DD is read in to the REXX SMF stem for further processing.

One caveat bears mentioning. The "EXECIO * ..." command will read all lines from an input DD. However, when working with very large SMF data files, you may run out of storage when trying to read all of the records contained therein. Possible workarounds might include reading the data in fixed-sized chunks (as opposed to "all"), playing with the IFASMFDP input parameters to filter the SMF data down to a more manageable size, or increasing your TSO region size. There's no single correct answer so use your judgment and apply each troubleshooting idea at your discretion, as appropriate for your particular situation.

Get Coding

This series has covered a gamut of concepts and topics to get you started with manipulating SMF data using REXX. You now have the basic tools from which to move forward, and with this final article, you have a working example to use as a code baseline or as a reference to turn to if you get stuck.

To further reinforce and develop your knowledge of SMF parsing, try to expand on what you have learned by taking the SMF Type 30 record example from this article and using the concepts and code samples to build parsers for some other SMF record types. Some good ones to initially practice with might include:

  • SMF Type 42 (DFSMS statistics and configuration)
  • SMF Type 70 (RMF Processor Activity)
  • SMF Type 72 (Workload Activity, Storage Data and Serialization Delay)

Hopefully, this series provided some knowledge of value to you. Perhaps you picked up an interesting tidbit or two that you can add to your tool bag. Or for some, perhaps your eyes were opened to a new world of data that might have otherwise seemed impenetrable or inscrutable. Whatever you’ve gleaned, you at least have a foundation from which to build upon and grow. The SMF world is your oyster ... so get coding!

If you have any questions or comments about the content in this article series, please contact me at georgen@us.ibm.com.

George Ng is a senior certified I/T managing consultant for IBM Systems and Technology Group Lab Services at IBM Poughkeepsie. His areas of focus include z/OS Parallel Sysplex, High Availability and Performance.



Advertisement

Advertisement

2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A Beginner's Guide to the REXX Programming Language on z/OS

Reading and Writing Files in the REXX programming language on z/OS.

MAINFRAME > TIPS & TECHNIQUES > APPLICATION DEVELOPMENT

Application Management is Important to the Entire Process

MAINFRAME > TIPS & TECHNIQUES > APPLICATION DEVELOPMENT

Application Testing: Giving Users What They Need

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
Mainframe News Sign Up Today! Past News Letters