On Sun, Sep 20, 2009 at 10:40 AM, Kris Buelens <kris.buel...@gmail.com> wrote:

> I don't really agree with the recommendation to use RACF(BATCH as
> opposed to using RAC:
> - with RAC, one gets a returncode for the specific RACF command that
> was executed
> - RACF(BATCH gives one global returncode for all stacked commands.
> A REXX stage can also be written using RAC.

The BATCH is to avoid it to prompt when you did something unexpected.
My RACF REXX is short enough to include here. I see it even features a
secondary output for failed commands.

/* RACF     REXX     Issue RACF commands                             */
/*                   Author: Rob van der Heij, 21 Jul 2008           */

arg line                              /* Take 1st command            */
signal on error

'streamstate all states'
parse var states . s1 .               /* View stream 1               */
parse var s1 inp1 ':' out1            /* Pick both sides             */
if wordpos(out1, '0 4 8') > 0         /* We have 2nd output          */
  then err = '\ rc: | *.output.1:'
  else err = '\ rc: | cons'           /* or the console              */

do i = 1 + (line = '')                /* Using the stack so can't    */
  if i > 1 then 'peekto line'         /* do more than one at a time  */
  'callpipe (end \ name RACF.REXX:6)',
     '\ var line',
     '| append strliteral /END/ ',
     '| o: fanout',
     '| stack',
     '\ o: ',
     '| take last ',
     '| spec ,RACF BATCH, ',
     '| command ',
     '| strnfind /RPI      I/',
     '| rc: strnfind /RPI      E/',
     '| *:',
     err

  if i > 1 then 'readto'
end

error: return rc * ( rc <> 12 )

Reply via email to