SPAWN: Creating a Subprocess From a Procedure

How to:

Available Operating Systems: UNIX

Available Languages: reporting

The SPAWN function creates a subprocess from a procedure that executes a system command without terminating the current procedure.

Limit: On UNIX, you can invoke this function only from a COMPUTE or DEFINE command.

Syntax: How to Create a Subprocess From a Procedure

SPAWN(inlength, command, outcode)

where:

inlength

Numeric

Is the length, in characters, of command.

command

Alphanumeric

Is a UNIX command, or a .COM file you want to execute.

outcode

D

Is the return code specifying whether or not the spawn was successful, or the format of the output value enclosed in single quotation marks. Zero indicates a successful spawn; a non-zero value indicates an unsuccessful spawn.

Example: Creating a Subprocess From a Procedure on UNIX

SPAWN executes the echo command, which displays Hello at the beginning of the procedure:

MODIFY FILE EMPLOYEE
PROMPT EMP_ID
MATCH EMP_ID
ON MATCH DELETE
CASE AT START
COMPUTE
MESSAGE/38=SPAWN (10, 'echo Hello', 'D8');
ENDCASE
DATA