On 12-Oct-2015 07:21 -0600, rob wrote:
Hey IBM DB2 service developers,

GET_JOB_INFO
Please add the columns:
Job_Number
Job_User
Job_Name

When using the special value '*' to retrieve information about the
current job you may want to use this function to determine what the
job name, user and number are. For example

SELECT JOB_NUMBER CONCAT '/' CONCAT JOB_USER
CONCAT '/' CONCAT JOB_NAME
FROM TABLE(QSYS2.GET_JOB_INFO('*')) A

Or better IMO, just provide a scalar UDF to retrieve and return the current job name in the qualified form. Although easily enough, one could just create their own scalar UDF.

Skip reference to that job-information UDTF entirely, by instead using a scalar Qualified Job Name UDF (named JQN in example below). That avoids the unnecessarily heavy\bloated usage, for that very limited purpose anyhow. For the above example, request instead:

VALUES(JQN())

If the table information were valued|required [though it seems much of what is returned, is debased by use of the '*' as argument], then:

select JQN() as qual_job_name, A.*
FROM TABLE(QSYS2.GET_JOB_INFO('*')) A


So you could then do something like:

select * from qsys2.output_queue_entries
where job_name =
(SELECT JOB_NUMBER CONCAT '/'
CONCAT JOB_USER CONCAT '/'
CONCAT JOB_NAME
FROM TABLE(QSYS2.GET_JOB_INFO('*')) A)


Similarly, again. the alluded scalar UDF would seem a better choice there too. For the above example, request instead:

select *
from qsys2.output_queue_entries
where job_name = JQN()


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].