Problem solve Get help with specific problems with your technologies, process and projects.

Use DSPFD to track file accesses and nip performance issues in the bud

With journaling you can gather information on the number of updates to a file and prevent performance problems.

Nick Hobson

It is often useful to know which are the most heavily accessed files in your system. Perhaps you would like to know which files have the most updates, deletes or reads. Or which files are opened and closed the most. Such information can be useful in profiling individual programs, spotting performance bottlenecks and ensuring your system runs smoothly.

There are many ways to determine such information, including performance tools, but journaling may be a better option. It's easy to use journaling to gather information about the number of updates to a file, and it takes little or no preparation or overhead. The information is stored in each file object and can be extracted by simply using the DSPFD command.

Specifically, DSPFD with TYPE(*MBR) displays how many times since the last IPL each file has been opened, closed, cleared, reorganized or has had its access path rebuilt. At record level, it tells you how many writes, updates, deletes and reads (both logical and physical) have been performed. Strictly speaking, the information is per member, rather than per file.

Such information is especially useful if it's collected on a regular basis. For example, you could set up a job that runs once a day and writes the data to an outfile. You can then analyze day-by-day changes using query, or perhaps a simple program. Any unexpected spikes in activity can alert you that a program may be malfunctioning. It will not tell you which program is misbehaving, but it can be a useful early warning.

I have also used this technique during development to ensure that files are being read and updated as expected. More than once I've noticed that a file was being read many more times than the design would suggest and have been alerted to what could have become a performance issue.

About the author: Nick Hobson is director of Q-SYS Technology Ltd. based in the U.K. He has worked in IT for almost two decades and has worked on the AS/400, lately iSeries, for 12 years.


Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.