List Open Files (QDMLOPNF)


  Required Parameter Group:


  Default Public Authority: *USE

  Threadsafe: Yes

The List Open Files (QDMLOPNF) API generates a list of *FILE objects that are currently open in the job or that were opened by the thread that is specified in the job identification information input parameter.

The QSYS2.OPEN_FILES table function can be used as an alternative to this API. See OPEN_FILES table function for more information.


Authorities and Locks

Job Authority
This API must be called from within the job for which the information is being retrieved, or the caller of the API must be running under a user profile that is the same as the job user identity of the job for which the information is being retrieved. Otherwise, the caller of the API must be running under a user profile that has job control (*JOBCTL) special authority.

The job user identity is the name of the user profile by which a job is known to other jobs. It is described in more detail in the Work management topic collection.


Required Parameter Group

Receiver variable
OUTPUT; CHAR(*)

The receiver variable that is to receive the information requested. You can specify the size of the area to be smaller than the format requested as long as you specify the length of receiver variable parameter correctly. As a result, the API returns only the amount of data specified in the length of receiver variable.

Length of receiver variable
INPUT; BINARY(4)

The length of the receiver variable provided. The length of receiver variable parameter may be specified up to the size of the receiver variable specified in the user program. If the length of receiver variable parameter specified is larger than the allocated size of the receiver variable specified in the user program, the results are not predictable. The minimum length is 8 bytes.

Format of receiver information
INPUT; CHAR(8)

The format of the information returned in the receiver variable. The possible format name is:


Job identification information
INPUT; CHAR(*)

The information that is used to identify the job or thread for which the list of open files is to be returned. See Format JIDF0100 for details.

Format of job identification information
INPUT; CHAR(8)

The format of the job identification information. The possible format name is:


Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Format OPNF0100



Field Descriptions

Activation group name. The name of the activation group to which an open file is scoped. This field can contain the following special values:

Activation group number. The number of the activation group to which an open file is scoped. This field will contain zero for files scoped to the job.

Bytes available. The number of bytes of data available to be returned. All available data is returned if enough space is provided.

Bytes returned. The number of bytes of data returned.

File library. The name of the library that contains the open file. If the file is an inline data file, blanks are returned. For DDM files, this is the library in which the DDM file is located.

File name. The name of the file that is open. This field will contain the value QINLINE for unnamed inline data files. For DDM files, this is the name of the DDM file.

File type. The type of file that is open.

Job name used. The name of the job for which open files were listed.

Job number used. The number of the job for which open files were listed.

Job user name used. The user name of the job for which open files were listed.

Length of open file entry. The length of each open file entry.

Library auxilliary storage pool name. The name of the auxilliary storage pool (ASP) in which the library of the open file resides. This field can contain the following special values:

Library auxiliary storage pool number. The number of the auxiliary storage pool (ASP) in which the library of the open file resides. Possible values are:

Member or device name. If the file type is physical (PF) or logical (LF), this is the name of the database member. If multiple member processing is being performed, the value *ALL is returned. For device files (BSCF, CMNF, DKTF, DSPF, ICFF, MXDF, PRTF, SAVF, or TAPF), this is the name of the last program device used for an I/O operation. This field is blank for device files when no I/O operation has been performed, and always for inline data files. If the file is a spooled file, the value *SPOOL is returned. If the file is a DDM file, blanks are returned.

Number of open files available. The number of open files available to be returned.

Number of open files returned. The number of complete open file entries that are returned.

Number of shared opens. The number of times the file was opened for shared processing. This field will contain zero for open operations that are not shared.

Object auxilliary storage pool name. The name of the auxilliary storage pool (ASP) in which the open file resides. This field can contain the following special values:

Object auxiliary storage pool number. The number of the auxiliary storage pool (ASP) in which the open file resides. Possible values are:

Offset to list of open files. The offset in bytes from the beginning of the receiver variable to the first open file entry.

Open option. The type of open operation that is performed:

Other I/O count. Number of successful I/O operations of the following types:

Read count. Number of successful read operations. If record blocking is not in effect for the file, this is the number of records. If record blocking is in effect for the file, this is the number of record blocks.

Record format. The name of the last record format that was used for an I/O operation to the file. If no record format name was used or no I/O operations have been performed, this field is blank.

Relative record number. Relative record number of the last record referred to by an I/O or open operation for database files. Zero is returned for nondatabase files and database files on which no I/O operations have been performed.

Reserved. An ignored field.

Thread identifier. An 8-byte thread handle assigned by the system. It identifies the thread in which the file was opened.

Thread identifier used. The identifier of the thread for which open files were listed. A value of zero indicates open files were returned for all threads within the job.

Write count. The number of successful write operations. If record blocking is not in effect for the file, this is the number of records. If record blocking is in effect for the file, this is the number of record blocks.

Write/Read count. The number of successful write/read operations.


Format JIDF0100



Field Descriptions

Internal job identifier. The internal identifier for the job. The List Job (QUSLJOB) API returns this identifier. If you do not specify *INT for the job name parameter, this parameter must contain blanks. With this parameter, the system can locate the job more quickly than with the job name.

Job name. A specific job name or one of the following special values.

Job number. A specific job number, or blanks when the job name specified is a special value.

Reserved. An unused field. This field must contain hexadecimal zeros.

Thread identifier. The unique value used to identify the thread within the job. If the thread indicator is not 0, this field must contain hexadecimal zeroes.

Thread indicator. The value that is used to specify the thread within the job for which information is to be retrieved. The following values are supported:

User name. A specific user profile name, or blanks when the job name specified is a special value.


Error Messages



API introduced: V5R1

[ Back to top | Database and File APIs | APIs by category ]