Okay, I’m doing load testing and want to create some batch load, but don’t really know how. So the simplest thing that I can think of is run all of the scheduled jobs. Surely that is easy, there must be a button somewhere? NO!
Perhaps I can change the date and time on the server to fool it and get all of the jobs to run – jeepers might be a bit risky.
Ok, I’m going to go rogue on this problem:
I’m going to use runube at the command line and launch them all – easy!
select 'runube JDE PASSWORD PD910 *ALL ' || SJSCHRPTNM || ' ' || sjschver || NVL(sjjobque,'QBATCH') || ' Batch Hold Save'
from sy910.f91300 where sjschjbstat = '01'
order by sjschsttime asc;
runube JDE PASSWORD PD910 *ALL R5503005 AALL001S Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503006 AALL001S QCAR1 Batch Hold Save
runube JDE PASSWORD PD910 *ALL R04601 AALL00S Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B13S AALL001S Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503DTI5 AALL001S Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503DTI4 AALL001S Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B500XAALL005 QSTAT1 Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413INNSW001S QREPORT Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413ISMNG001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413IVLDR001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413IVGAD001S QBATCH Batch Hold Save
Wait, there are blanks and NULLs for the QUEUE, this is annoying! Break out the advanced case statement for just this situation:
select 'runube JDE PASSWORD PD910 *ALL ' || SJSCHRPTNM || ' ' || sjschver || CASE WHEN sjjobque IS NULL THEN N'QBATCH' WHEN sjjobque = ' ' THEN N'QBATCH' ELSE sjjobque END || ' Batch Hold Save'
from sy910.f91300 where sjschjbstat = '01'
order by sjschsttime asc;
How cool is that case statement, so I’m saying…
when the queue is NULL, make it QBATCH, when it’s ‘ ‘ (a space) make it QBATCH, elsewise make it the queue name.
Note that I also had some problems with CASE and character set mismatch
ORA-12704: character set mismatch
12704. 00000 - "character set mismatch"
*Cause: One of the following
- The string operands(other than an nlsparams argument) to an
operator or built-in function do not have the same character
set.
- An nlsparams operand is not in the database character set.
- String data with character set other than the database character
set is passed to a built-in function not expecting it.
- The second argument to CHR() or CSCONVERT() is not CHAR_CS or
NCHAR_CS.
- A string expression in the VALUES clause of an INSERT statement,
or the SET clause of an UPDATE statement, does not have the
same character set as the column into which the value would
be inserted.
- A value provided in a DEFAULT clause when creating a table does
not have the same character set as declared for the column.
- An argument to a PL/SQL function does not conform to the
character set requirements of the corresponding parameter.
*Action:
Error at Line: 45 Column: 152
So I had to add the “CAST” or N’STRING’ or _J’STRING’ (that is a JDE C BSFN joke – get it?) ROTFL – NOT!
FROM:
select 'runube JDE PASSWORD PD910 *ALL ' || SJSCHRPTNM || ' ' || sjschver || CASE WHEN sjjobque IS NULL THEN 'QBATCH' WHEN sjjobque = ' ' THEN 'QBATCH' ELSE sjjobque END || ' Batch Hold Save'
from sy910.f91300 where sjschjbstat = '01'
order by sjschsttime asc;
TO
select 'runube JDE PASSWORD PD910 *ALL ' || SJSCHRPTNM || ' ' || sjschver || CASE WHEN sjjobque IS NULL THEN N'QBATCH' WHEN sjjobque = ' ' THEN N'QBATCH' ELSE sjjobque END || ' Batch Hold Save'
from sy910.f91300 where sjschjbstat = '01'
order by sjschsttime asc;
runube JDE PASSWORD PD910 *ALL R5503005 AALL001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503006 AALL001S QCAR1 Batch Hold Save
runube JDE PASSWORD PD910 *ALL R04601 AALL00S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B13S AALL001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503DTI5 AALL001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503DTI4 AALL001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B500X AALL005 QSTAT1 Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I NNSW001S QREPORT Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I SMNG001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I VLDR001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I VGAD001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I TDBL001S QBATCH Batch Hold Save
runube JDE PASSWORD PD910 *ALL R5503B413I QQLD001S QBATCH Batch Hold Save
Paste this into a windows command line, and you are away!
'
1 comment:
Nice job, Shannon! Great script!
Post a Comment