MainframeSupports
tip week 21/2008:

Sometimes (but not as often as I would like) I get feedback from you dear reader. Once a danish reader read one of my tip in english about MQ definitions in batch and he told me how to get reasonable return codes from the MQ batch command COMMAND. I will now share this information with you. The english tip I am referring to was published in week 2/2005.

There is an option to the command COMMAND named FAILURE. FAILURE may be specified as FAILURE(CONTINUE) which means that if one of the commands read from DD name CSQUCMD fails execution continues, but at the end the return code from CSQUTIL will not be zero. You may also specify FAILURE(STOP) which means that execution of commands stops at the first error encountered and a return code not equal to zero will be returned. When FAILURE is not used the default for COMMAND is to execute all commands and terminate with a return code of zero. Here is an example of how to use FAILURE:

//MQUTIL   EXEC PGM=CSQUTIL,PARM='MYMQ'
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  COMMAND FAILURE(STOP)
/*
//CSQUCMD  DD DISP=SHR,DSN=MY.MQ.DEF(INITION)

A little surf around IBM's book manager site reveals that option FAILURE most likely has been around since MQ was invented on the mainframe. So do not worry about which version of MQ you are using because FAILURE will work anyway.

Previous tip in english        Sidste danske tip        Tip list