In this installment of Carsten Flensburg’s APIs by Example, Carsten demonstrates the use of the List Open Files (QDMLOPNF) API.
The QDMLOPNF API lists the files that are currently open in your job and returns the same information as that displayed by the DSPJOB OPTION(*OPNF) command. The advantage to retrieving this information with an API is that you can use the returned information in your program logic rather than simply displaying it to the user.
The API is demonstrated in the form of a utility program that you can call from your own program when you need to retrieve the open file list.