PHANTOM

Top  Previous  Next

 

The PHANTOM command starts execution of a verb, sentence or paragraph as a background process. This command is not available on the PDA version of QM.

 

 

Format

 

PHANTOM {DATA} {NO.LOG} {USER n} command

 

 

A new background process is started to execute the command which must be a valid verb, sentence or paragraph. The process from which the PHANTOM command was performed continues without waiting for command to be completed. A message is displayed indicating the user number associated with the phantom. The user number is also returned in @SYSTEM.RETURN.CODE. If the phantom process cannot be started, @SYSTEM.RETURN.CODE holds the negative error code.

 

When the background process terminates a message is queued for display immediately before the next command prompt. This message is

 

Phantom n : Normal termination.

 

where n is the user number if the process completed successfully or

 

Phantom n : Abnormal termination.

 

if the process aborted.

 

Unless the NO.LOG keyword is used, the phantom process will automatically create a COMO file named PHn_date_time exactly as though it had commenced with the command

COMO ON PHn_date_time

A QMBasic program can determine this name using the !PHLOG() subroutine.

 

Output that would normally be directed to the display is suppressed except for recording in the COMO file. The COMO file may be switched off or redirected as desired from within the phantom process.

 

The DATA keyword causes the DATA queue of the process in which the PHANTOM command is executed to be passed into the phantom process, clearing it in the parent process.

 

The USER option allows the phantom process to be created as a specific user number within a range of numbers reserved by the PHANTOMS configuration parameter. An error will occur if there is already a phantom running as the specified user.

 

Any attempt to read data from the keyboard will cause the process to abort. DATA statements may be used in the phantom to supply input that would normally be read from the keyboard.

 

Phantom processes may not be started within a transaction.

 

All QM processes, including phantoms, execute the VOC LOGIN paragraph, if it exists. To exit from the LOGIN paragraph for a phantom process, insert a line

IF @TTY = 'phantom' THEN STOP

at the relevant point in the paragraph. See @TTY for more details.

 

 

Example

 

PHANTOM BASIC BP INVOICE

 

This command starts a phantom process to compile the QMBasic program INVOICE in the BP file.

 

 

See also:

CHILD(), LIST.PHANTOMS, !PHLOG(), STATUS