Reputation: 1
Longtime reader, first question ever!
I'm trying to write a stored procedure in DB2 that will periodically write journal entries to a file using a batch job, with the DBUJRN tool. The problem I'm having is that sometimes the time window that I'm calling DBUJRN with is too narrow, and there are no entries. This is a problem because DBUJRN will error out instead of continuing the stored procedure (and the error I see generated from the stored procedure is quite generic, not something I could say that "there are no entries in this window for this file" reliably). I can't find anything in the documentation related to this. Is there a way to get the DBUJRN command to continue past this error?
Sample DBUJRN command:
DBU11/DBUJRN JRN(JRNLIB/JOURNAL) FILE(LIBA/FILEA) OUTFILE(LIBB/FILEA) RCVRNG(*CURCHAIN) FROMTIME(05032024 152100) TOTIME(05032024 172100) JRNCDE((R))
AS/400 Output:
"No entries converted from journal
Command not run. Error detected by validity checker."
Upvotes: 0
Views: 152
Reputation: 23813
I suppose you might be able to define a SQL Condition handler that would allow the stored proc to continue.
But really CALL QSYS2.QCMDEXC()
is a pretty hacky solution. Fine for quick and dirty, not something you really want to see in production.
What you should do
MONMSG
CREATE PROCEDURE ... LANGUAGE CL...
Now your SQL Stored proc can just use CALL MYCLSTOREDPROC
Upvotes: 0