LISTFILE. It’s Not Your Father’s LISTF Anymore

Have you explored the LISTFILE functionality recently? There are two features in particular that are particularly handy when combined together. These features are the selection equation to select files based on attributes such as file code or access options; and the output format 9 which shows what processes are accessing a file.

Troubleshooting Image database locks means issuing a SHOW LOCKS command in DBUTIL. Diagnosing locks on other types of files used to be more difficult. You can create the creating an equivalent command for flat files and KSAM files by combining LISTFILE with SELEQ and FORMAT=9. This will produce a list of files that are locked, the process(es) locking the file(s), and processes that are waiting for the locks to be released. In the following example there is one file selected. Two processes are shown that have the file open. The second process listed has the file locked. You can tell this because it contains FLOCK underneath OWNER. The first process is waiting for the lock to be released based on the FLOCK being shown under WAITER.

2 Accessors(O:2,P:2,L:2,W:2,R:0),Share
#S837 DW,USER.WERTH P:1,L:1,W:1,R:0 REM :
ACCESS: W-excl REC#: 0 FNUM: 9
LOCKS--Owner-- --Waiter--
#S835 DW,DOUG.WERTH P:1,L:1,W:1,R:0 REM :
ACCESS: W-excl REC#: 0 FNUM: 9
LOCKS--Owner-- --Waiter--

Here are a few other examples:

Obtain a list of COBOL source files in an account with this command:


Display all Powerhouse subfiles and who is accessing them:


Display all Image databases:

:listfile @.@.@;seleq=[code=-400];format=2

Here are the allowable options for the SELEQ parameter:

[CODE = filecode mnemonic|number|PRIV]

As you can see LISTFILE has become a very powerful command, no longer limited to choosing files solely on the file name.