... then things got even more interesting. Coworker noticed one
performance on one system was tanking. Somehow this process was spawning
an infinite number of jobs on one of the target systems. We have it beat
into submission.
Current temporary used . : 74568 M
Peak temporary used . . : 950142 M
I wrote a procedure to kill the jobs:
CREATE PROCEDURE PROCESS_JOBS
(IN IN_CURRENT_USER *VARCHAR*(*10*),
IN IN_JOB_NAME *VARCHAR*(*10*) )
LANGUAGE SQL MODIFIES SQL DATA
SET OPTION DATFMT = *ISO
P1: BEGIN
DECLARE QUALIFIED_JOB_NAME *CHAR*(*28*);
DECLARE COMMAND *CHAR*(*200*);
*-- Ensure this is large enough.* DECLARE END_TABLE *INT* DEFAULT
*0*;
DECLARE C1 CURSOR FOR
SELECT JOB_NAME
FROM TABLE(QSYS2.ACTIVE_JOB_INFO(
CURRENT_USER_LIST_FILTER *=>* IN_CURRENT_USER,
JOB_NAME_FILTER *=>* IN_JOB_NAME
));
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET END_TABLE = *1*;
*-- DECLARE EXIT HANDLER FqsysOR SQLEXCEPTION*
*-- SET DEPT_SALARY = NULL;* OPEN C1;
FETCH C1 INTO QUALIFIED_JOB_NAME;
WHILE END_TABLE = *0* DO
SET COMMAND = 'ENDJOB JOB(' *CONCAT* QUALIFIED_JOB_NAME
*CONCAT* ') OPTION(*IMMED) SPLFILE(*YES) LOGLMT(0)';
CALL QSYS2.QCMDEXC(COMMAND);
FETCH C1 INTO QUALIFIED_JOB_NAME;
END WHILE;
CLOSE C1;
END P1
;
CALL ROB.PROCESS_JOBS('ROB', 'QRWTSRVR');
Big reason why I use stored procedures instead of CL for much of this stuff
now.
As an Amazon Associate we earn from qualifying purchases.