/*********************************************************************
*
*  ROUTINE:      RSCS REXX (pipeline driver for RSCS 3.1)
*
*  PURPOSE:      Pipeline driver to issue RSCS 3.1 command and trap
*                output. No inputs; output sent to primary output.
*
*  PACKAGE:      USERTOOL
*
*  CALLS:        CP SET SMSG
*
*  DEPENDENCIES: Calling programs may need to be aware that this
*                driver can CP SET SMSG IUCV at beginning and
*                CP SET SMSG OFF at the end.
*
*  AUTHOR:       Robert Fowles  <RBF@PSUVM>  2/25/92
*
*  REVISIONS:
*********************************************************************/

arg RSCScmd '(' opts

call Scanopts

if setsmsg then address command 'CP SET SMSG IUCV'
sig = right(time('L'),6)   /* Unique CRI signature for this call */

'maxstrm output'
if rc = 0
then sec = ''
else sec = '\ Rscs: | *.output.1:'   /* Write to secondary */

'CALLPIPE (end \)',
  '|STARMSG *MSG CP SM RSCSX (SL.'sig')' RSCScmd,
  '|Rscs: find 00000004RSCS',   /* only SMSGS from RSCS */
  '|spec 22-*',              /* Strip STARMSG header and part of othr*/
  '|locate 20.6 /'sig'/',    /* Just ones with CRI signature */
  '|tolabel 0001'||,         /* Until "End of Response" msg num */
  '|spec 31-*',              /* Keep just message text */
  '|buffer',                 /* Prevent halt before last line */
  '|f: fanout',              /* Save output for below */
  '|take 1',                 /* Discard output */
  '|c: faninany',            /* Come here to stop pipeline */
  '|spec /pipmod stop/',     /* Set up to stop */
  '|subcom cms',             /* Stop STARMSG and DELAY */
 '\literal +00:10',          /* Set timer to stop pipeline */
  '|delay',
  '|c:',                     /* Go stop pipeline */
 '\immcmd stop',             /* Set immediate command "stop" */
  '|c:',                     /* Go stop pipeline */
 '\ f:',                     /* Send to primary output */
  '|*:',
  sec

if setsmsg then address command 'CP SET SMSG OFF'

exit rc

ScanOpts:
   setsmsg = 1
   rscs = 'RSCSX'
   do while opts <> ''
      parse var opts opt opts
      select
         when opt = 'NOSET' then setsmsg = 0
         when opt = 'RSCS' then do
            parse var opts rscs opts
            if rscs = '' then rscs = 'RSCSX'
         end
         otherwise call Errstop 'Incorrect argument'
      end
   end
   parse value diagrc(8,'QUERY USER' rscs) with cprc cpcc m
   if cprc > 0 then exit cprc
   return

Errstop:
   say arg(1)
   exit 100

Reply via email to