It used to take CPYSPLF into a physical file and then a query on that. From release 7.3
the contents can be read directly.
SELECT ORDINAL_POSITION, SPOOLED_DATA
FROM TABLE(SYSTOOLS.SPOOLED_FILE_DATA(
JOB_NAME => '123456/USER/CLOSE',
SPOOLED_FILE_NAME => 'QPJOBLOG'))
ORDER BY ORDINAL_POSITION
To search for a line inside a job log:
SELECT SPOOLED_DATA
FROM TABLE(SYSTOOLS.SPOOLED_FILE_DATA(
JOB_NAME => '123456/USER/CLOSE',
SPOOLED_FILE_NAME => 'QPJOBLOG'))
WHERE SPOOLED_DATA LIKE '%CPF%'
Note
the job name must be written in full, number included, in the form
number/user/name. WRKACTJOB shows it in three separate columns: they need joining with
slashes. If several spooled files share the same name, add SPOOLED_FILE_NUMBER => n to
pick one.
Releases. SYSTOOLS.SPOOLED_FILE_DATA is available from 7.3; on earlier releases it
came with a Db2 group PTF that may not have been applied. To find out whether it is there,
just run the query: if it is missing the system answers SQL0204 — object not found.
On systems without it, the long way remains: CPYSPLF into a physical file and query that.
Comments
No comments yet. Be the first to comment!
You need an account to comment. Log in · Sign up