Top  Previous  Next


The PHANTOM statement starts a phantom process from a QMBasic program without the overheads of using EXECUTE.





PHANTOM command {options} {THEN statement(s)} {ELSE statement(s)}




commandis the command to be executed by the phantom process.


options are:

GROUPThe phantom process is grouped with its parent such that it will terminate if the parent terminates
LOGFILE nameSpecifies an alternative log file
NO.LOGSuppresses creation of a log file
NO.MSGSuppresses start and termination messages relating to this phantom in the parent process.
PASS.DATATransfers the data queue from the parent process to the phantom.
POOL nameMakes the phantom process a member of the specified connection pool.

The options may be in any order. At least one of the THEN and ELSE clauses must be present.



The PHANTOM statement is can be used to start a phantom process that does not need options supported only by the PHANTOM command. Removal of the need to use EXECUTE provides a small performance improvement.


If the LOGFILE option is used, name specifies the name of the record to be created in the $COMO file to save output from the phantom process. If this name contains a space, the portion before the space is used as the file name and the portion after the space is used as the record id within that file. Only a directory file can be used.


The GROUP keyword should be used with care. Termination of the parent process will cause all programs, paragraphs, etc running in the phantom process to be aborted. Unless the application uses transactions, this could result in only part of a linked sequence of updates being applied to data files.


When using the POOL option, the system will first look for an idle process in that pool that can be awakened. If no such process is found, a new phantom is started. The pool name may be followed by the keyword NEW.PROCESS to force creation of a new process even if an idle process exists. This allows an application to start a number of phantom processes that perform initialisation and then go into the idle pool waiting for work to do.


Any secure encryption keys enabled in the parent process are inherited by the phantom process.


The THEN clause is taken if the phantom process is started successfully. The STATUS() function will return the QM user number of the phantom process.


The ELSE clause is taken if the phantom fails to start. The STATUS() function will return the associated error code.








See also: