QCMDEXC scalar function
The QCMDEXC scalar function executes a CL command.
Authorization: Any authority requirements for the CL command apply to the use of this function.
The schema is QSYS2.
- command
- A character string containing a CL command. The maximum length is 32000 characters.
Example
Hold any jobs that started running an SQL statement more than 2 hours ago.
SELECT JOB_NAME,
CASE WHEN QSYS2.QCMDEXC('HLDJOB ' CONCAT JOB_NAME) = 1 THEN 'Job Held'
ELSE 'Job not held'
END AS HLDJOB_RESULT
FROM TABLE (QSYS2.ACTIVE_JOB_INFO (DETAILED_INFO=> 'ALL'))
WHERE SQL_STATEMENT_START_TIMESTAMP < CURRENT TIMESTAMP - 2 HOURS;