REXX Tips & Tricks, Version 2.80

Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs

The DETACH command

The <DETACH command writes the message with the process ID of the detached 
program to STDERR. 
To catch this ID, you can redirect STDERR of the <DETACH command into a 
file (see Redirect STDOUT and STDERR). Than you can use any program that 
can read open files to process this file. 
Unfortunately REXX programs cannot read open files. Therefore you have to 
use a little trick to get the PID in a REXX program (see Detach a program) 

Note:  The STDERR of the DETACH command is used by the DETACH command and 
       by the detached process. Therefore, if you redirect STDERR of 
       DETACH into a file, this file is open until the detached process 
       ends. Note also that you cannot pipe the output of the DETACH 
       command to another program. 
 ---------- * ----------
 All programs started from a detached session use the standard input, 
 output and error handles of the detached session. You cannot use the 
 <START command to start another session from a detached session. 
 You can start some but not all PM programs from a detached session. For 
 example PMREXX.EXE works but VIEW.EXE doesn't. To start a usable, 
 interactive CMD session from a detached session you might use the 

   "pmrexx rexxtry cmd"
 Or, a more general solution, use the WPS interface: <SysSetObjectData. 

   rc = SysSetObjectData( '<WP_OS2WIN>', 'OPEN=DEFAULT;' )

Inf-HTML End Run - Successful