In REXX land, it must be a PIPE: the response is sent asynchronously. CP provides the *ASYNCMD IUCV service to grab the response of FOR. Here's something I quickly constructed:
address command parse upper arg CPcmd if CPcmd='' then CPcmd='Q USERID' MaxWait=5 /* Wait at most 5 seconds */ 'PIPE (end ?)', ' Literal +'maxwait 'TimeOut', /* Timeout value + flag */ '!DELAY', /* Wait */ '!J: FaninAny', /* Gather all stop reasons */ '!VAR STOPreason', /* Store in REXX var */ '!G: Gate', /* GATE will stop STARMSG */ '?STARMSG *ASYNCMD', /* Connect to *ASYNCMD IUCV serv*/ '!G:', /* Allow for a graceful stop */ '!CPrc: Totarget PICK 33 == /1/', /* Up to the CP retcode record */ '!cons', /* ... here's the response ... */ '?CPrc: !NOT CHOP 33!VAR CPrc!COPY!J:', /* Extract CP retcode */ '?CP FOR VMOPER PATH * CMD' CPcmd'!cons' /* Send CP cmd to VMOPER*/ PipeRC=rc If PipeRc<>0 then say 'CP FOR failed, rc=' PipeRC else If Word(StopReason,2)='TimeOut' then say 'Did not get response within' maxWait 'seconds' else Say 'CP Retcode:' CPrc exit PipeRc 2007/8/22, Marcy Cortes <[EMAIL PROTECTED]>: > > If I wanted to capture the results of a CP FOR command in a rexx exec > (preferably a pipe), is there some sample rexx somewhere for that? > > Marcy Cortes > -- Kris Buelens, IBM Belgium, VM customer support