On 5/15/2024 11:28 AM, Birgitta Hauser wrote:
Sorry, but THIS will only work in RPG not in CL
Perhaps a Rexx example?
/* Check for duplicate job, send escape message */
DEBUG = "off"
parse upper arg jobname
ADDRESS EXECSQL
EXECSQL "SET OPTION COMMIT=*NONE"
EXECSQL "declare c1 cursor for ",
"SELECT count(*) ",
"FROM TABLE(QSYS2.ACTIVE_JOB_INFO()) B ",
"WHERE JOB_NAME like '%"jobname"%'"
EXECSQL "open c1"
EXECSQL "fetch from c1 into :count"
/* debugging */
if DEBUG = "on" then do
say "Searching for job name" jobname
say "fetch SQLSTATE=" sqlstate
say "count = " count
end
if SQLCODE < 0 then SIGNAL ERROR
EXECSQL "close c1"
if count > 0 then do
MSGDTA='Job count is' strip(count) 'jobs'
ADDRESS COMMAND
"SNDPGMMSG MSGID(CPI8859) MSGF(QCPFMSG) MSGDTA(&MSGDTA)
MSGTYPE(*ESCAPE)"
end
EXIT
ERROR: say SQLCODE
As an Amazon Associate we earn from qualifying purchases.
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.