DETACH

Disconnect program from terminal

 

 

USupported on UNIX

 

DETACH

Discussion

The DETACH statement places the current program in the background and returns control of the terminal to the shell, thus enabling two programs to run concurrently from the same terminal. When a program executes a DETACH statement, it creates a new process that is detached from the terminal and continues to run as a background process. Any subsequent I/O request to the terminal from the detached program competes with I/O requests from programs running in the foreground.

The new process can only inherit certain characteristics from the original process. Because locks on UNIX are process‑based, locks cannot be inherited by the new process. Any locks that a program has before a DETACH statement is executed are lost when the program detaches. If you need something locked after the DETACH statement, don’t lock it until after the DETACH.