DSRunJob

Use the DSRunJob function to start running a job. This call is asynchronous; the request is passed to the runtime engine, but you are not informed of its progress.

Syntax


ErrCode = DSRunJob (JobHandle, RunMode)

JobHandle is the handle for the job as derived from DSAttachJob.

RunMode is the name of the mode that the job is to be run in and is one of:

  • DSJ.RUNNORMAL (Default) Standard job run.
  • DSJ.RUNRESET Job is to be reset.
  • DSJ.RUNVALIDATE Job is to be validated only.
  • DSJ.RUNRESTART Restartable job sequence is to be restarted with the original job parameter values.

ErrCode is 0 if DSRunJob is successful, otherwise it is one of the following negative integers:

  • DSJE.BADHANDLE Invalid JobHandle.
  • DSJE.BADSTATE Job is not in the right state (compiled, not running).
  • DSJE.BADTYPE RunMode is not a known mode.

Remarks

If the controlling job is running in validate mode, then any calls of DSRunJob will act as if RunMode was DSJ.RUNVALIDATE, regardless of the actual setting.

A job in validate mode will run its JobControl routine (if any) rather than just check for its existence, as is the case for before/after routines. This allows you to examine the log of what jobs it started up in validate mode.

After a call of DSRunJob, the controlled job's handle is unloaded. If you require to run the same job again, you must use DSDetachJob and DSAttachJob to set a new handle. Note that you will also need to use DSWaitForJob, as you cannot attach to a job while it is running.

Example

The following command starts the job qsales in standard mode:


RunErr = DSRunJob(qsales_handle, DSJ.RUNNORMAL)