DSSetParam

Use the DSSetParam function to specify job parameter values before you run a job. Any parameter that is not set is defaulted.

Syntax


ErrCode = DSSetParam (JobHandle, ParamName, ParamValue)

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

ParamName is a string giving the name of the parameter.

ParamValue is a string giving the value for the parameter.

ErrCode is 0 if DSSetParam 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.BADPARAM ParamName is not a known parameter of the job.
  • DSJE.BADVALUE ParamValue is not appropriate for that parameter type.

Example 1

The following commands set the quarter parameter to 1 and the startdate parameter to 1/1/97 for the qsales job:


paramerr = DSSetParam (qsales_handle, "quarter", "1")
paramerr = DSSetParam (qsales_handle, "startdate", "1997-01-01")

Example 2

In this example, the qsales job uses a parameter set, called PS1, which contains two parameters, called P1 and P2 that have default values of P1def and P2def. There is a value set, called VSetA defined for the parameter set in which P1 and P2 have values of P1A and P2A.

By default, the job uses the default values from the parameter set PS1. The parameter values used are P1=P1def and P2=P2def

The following command sets the values of the parameters from the value set VSetA. The parameter values used are P1=P1A and P2=P2A.
paramerr = DSSetParam (qsales_handle, "PS1", "VsetA")
The following commands set the values of the parameters from the value set VSetA, and then override the value of the parameter P2 with the value P2X. The parameter values used are P1=P1A and P2=P2X:
paramerr = DSSetParam (qsales_handle, "PS1", "VsetA")
paramerr = DSSetParam (qsales_handle, "PS1.P2", "P2x")