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.