USS Sample - Use spawn process and catch the results

Sample
USS - Sample

Beispiel:                                 

/* REXX YUSSBSP2 Copyright YCOS Yves Colliard Software 1990-2009 */
/* TRACE ?R  */
  /* einschalten des interaktiven Trace Modus */
  /* */
x=syscalls('ON')
address syscall
/* Create a File */
'open /tmp/yyy' 128+1 /* o_creat+owronly */
myf=retval
/* Set parameter for spawn */
map.0=-1
map.1=myf      /* File Output */
map.2=-1
parm.0=3       /* Number of Parms  */
parm.1='/tmp'  /* Directory Output */
parm.2='-gRc'  /* Command Parms    */
parm.3='/u'    /* ls Directory     */
/* spawn the ls command */
'spawn /bin/ls 3 map. parm. __environment.'
/* close the file */
'close' myf
/* read and delete the file */
address TSO
resp=MSG('OFF')
"free fi(om)"
/* Read it again!! */
"ALLOC FI(OM) PATH('/tmp/yyy')",
   "PATHOPTS(ORDONLY)",
   "PATHDISP(DELETE,DELETE)",
   "FILEDATA(TEXT)"
"execio * diskr om (stem b. finis"
do i=1 to b.0
say strip(b.i)
end
"free fi(om)"
resp=MSG(resp)