Waiting for the status of the commanded job
The #WAIT command is used to synchronise a commanding program with a job that the client previously commanded (requested). The commanding program is stopped until the expected status occurs. If several alternative states are specified, it is enough to fulfil one of the requested statuses for the program to continue running. The last valid return value of #WAIT MC_Status can be read out by the MCV_WAIT_STATUS function and used to continue program execution.
Available as of V3.1.3110
Syntax of the NC command: |
#WAIT MC_Status [ JobID=.. [MC_NEW] [MC_BUSY] [MC_ACTIVE] [MC_DONE] |
JobID=.. | User-specific JobID/job identification number. Every number must be unique in the commanding program. |
MC_NEW | New job received but not yet processed in the commanded channel. |
MC_BUSY | New job waits for execution in the commanded channel. |
MC_ACTIVE | The job is active in the commanded channel but was not completed. |
MC_DONE | The job was successfully completed in the commanded channel. |
MC_ABORTED | The job was aborted in the commanded channel before completion. |
MC_ERROR | An error occurred while the job is in progress. |
Properties:
- Job IDs are stored in a history when #WAIT MC_Status is called in order to return a correct status in a “later” request even after the job is completed/cancelled. If the job ID specified in JobID is unknown because it was never commanded or is no longer in the history, an error is output.
- The job ID history is deleted at program end. It is therefore no longer possible to synchronise with jobs from previous (client) jobs. It is also not possible to synchronise with jobs from another client.
Notice

If no expected status is defined for #WAIT MC_Status, an implicit MC_DONE and MC_ABORTED apply.
Programing Example

Waiting for job state
The program starts a “SlaveFile”.nc program in logical channel 3 with job 633, then waits for the job to be completed with the alternative states MC_DONE, MC_ABORTED or MC_ERROR. If none of the states is reached, the program stops.
%Example MC_Wait
N010 #MC_MovePath SYN[ CH=3 JobID=633 FileName=”SlaveFile.nc”]
N020 #WAIT MC_Status [JobID=633 MC_DONE MC_ABORTED MC_ERROR]
N100 M30