SPOOLED_FILE_DATA table function
The SPOOLED_FILE_DATA table function returns the content of a spooled file.
If the spooled file contains double byte data, the job CCSID must be a mixed CCSID.
Authorization: This table function uses the CPYSPLF CL command. Any authority requirements for the CL command apply to the use of this function.
The schema is SYSTOOLS.
- job-name
- A character string containing a qualified job name. Can contain the following special value:
- *
- Use the name of the current job.
- spooled-file-name
- A character string containing the name of the spooled file. If this parameter is omitted, QPJOBLOG is used.
- spooled-file-number
- The number of the spooled file. If this parameter is omitted, the spooled file with the highest number matching spooled-file-name is used.
Column Name | Data Type | Description |
---|---|---|
ORDINAL_POSITION | INTEGER | Relative position of this row in the spooled file. |
SPOOLED_DATA | VARCHAR(200) | The data for this row in the spooled file. |
Note
This function is provided in the SYSTOOLS schema as an example of how spooled file data can be returned by embedding the CPYSPLF CL command in an SQL table function. Creating customized versions of this table function to better suit a specific need is encouraged. Use the Insert Generated SQL feature in ACS to extract the source for this function. Then modify it and create a new procedure in a user-specified schema.
Example
Return the most recent QSYSPRT file for a specific
job:
SELECT * FROM TABLE(SYSTOOLS.SPOOLED_FILE_DATA(
JOB_NAME =>'193846/SLROMANO/QPADEV0009',
SPOOLED_FILE_NAME =>'QSYSPRT'))
ORDER BY ORDINAL_POSITION;