Now, I have a situation where the 'EMPTY QUEUE' commands(same as present in SYSIN DD of above JCL) are written into a PS file by a monitoring job and now I have to use this PS file in my JCL. Below JCL doesn't work...and gives the error 'CSQ9019E MQXX 'EMPTY' command is invalid'..!!!!
//CSQSTEP EXEC PGM=CSQUTIL,PARM='MQXX'
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
COMMAND DDNAME(CSQUCMD) TGTQMGR(MQXX)
//CSQUCMD DD DSN=file1,DISP=SHR <-- file1 has same 'EMPTY QUEUE' commands as in the previous JCL.
The same JCL works for other commands e.g. 'DISPLAY QUEUE', 'ALTER QUEUE' etc but doesn't work for 'EMPTY QUEUE'.
Can someone help me understand if there is a restriction on using the 'EMPTY QUEUE' command via PS file in JCL...and is there a way to overcome this..?
PS: I do have other alternative approach but all of them are somewhat tideous as comared to above and hence the question.
As I stated earlier, I designed my MQ monitoring job to have
STEP01 - write these 'EMPTY QUEUE' commands into PS based on some monitoring logic (via a REXX program)
STEP02 - User the PS file to execute the commands to clear the queues.
Before designing my rexx program (executing in STEP01), i was hoping that COMMAND & EMPTY will work together well but it seems that my assumption has gone wrong.
Thank you for your responses which confirms that COMMAND & EMPTY doesn't work together and there is no simple way to make them work together.
So now, I will have to tailor my Rexx program to create ane execute another JCL instead of creating a PS file with commands. This JCL, created from within RExx, will have the 'EMPTY QUEUE' command in SYSIN DD* (similar to the working example).
Suggestions to make this further simpler are encouraged.