× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm writing my first SPL.

I copied a sample from
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/sqlp/rbafysqlproc.htm

I am developing using Run SQL Scripts.

The creation worked fine. When I try to call it using:
CALL ROB.PROCESS_JOBS('<redacted>', '*OUTQ', '*BATCH');
I am getting:
SQL State: 22023 Vendor Code: -443 Message: [SQL0443] JOB_STATUS_FILTER
PARAMETER INVALID
I do not believe it is a "must pad parms with spaces to fit" issue or I
don't think it would not have found the procedure in the first place
(that, and I tried the padding and got the same thing).

This SQL works fine:
SELECT JOB_NAME
FROM TABLE(QSYS2.JOB_INFO(
JOB_USER_FILTER =>'<redacted>',
JOB_STATUS_FILTER => '*OUTQ',
JOB_TYPE_FILTER => '*BATCH'
))
FETCH first 100 ROWS ONLY;

Creation steps:

SET schema = 'ROB';

CREATE PROCEDURE PROCESS_JOBS
(IN IN_JOB_USER CHAR(10),
IN IN_JOB_STATUS CHAR(7),
IN IN_JOB_TYPE CHAR(9))
LANGUAGE SQL READS SQL DATA
P1: BEGIN
DECLARE QUALIFIED_JOB_NAME CHAR(28);
DECLARE COMMAND CHAR(50);
DECLARE END_TABLE INT DEFAULT 0;
DECLARE C1 CURSOR FOR

SELECT JOB_NAME
FROM TABLE(QSYS2.JOB_INFO(
JOB_USER_FILTER =>IN_JOB_USER,
JOB_STATUS_FILTER => IN_JOB_STATUS,
JOB_TYPE_FILTER => IN_JOB_TYPE
));
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET END_TABLE = 1;
-- DECLARE EXIT HANDLER FOR 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
') SPLFILE(*YES) LOGLMT(0)';
CALL QSYS2.QCMDEXC(COMMAND);
FETCH C1 INTO QUALIFIED_JOB_NAME;
END WHILE;
CLOSE C1;
END P1
;




Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.