You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Introduction

Parameters can be set for jobs and orders.

Order parameters are available to all the jobs in a job chain. When the value of an order parameter in a job chain is changed then this new value will be applied at the start of the next (persistent) order.

Note that when jobs are programmed using the JobScheduler API, job and order parameters are separate objects. Node and order parameters form the same object, although here node parameters have priority over order parameters of the same name.

Delimitation

Parameters can also be set for job chains and job chain nodes. However these parameters are used differently to job and order parameters and are not described in this article.

For more information about job chain and job chain node parameters see:

Setting Parameters for a Job or an Order

The Parameter function can be found in the JOE element tree as a sub-element of every Job and Order. Each parameter consists of a name and a value.

  • Enter the name-value pairs in the Name and Value fields as shown in the screenshot below.
  • Click the Apply button
  • Click the Save Configuration icon (top, left) to permanently save the parameters.

Reading and Setting Parameters in Shell Scripts

An environment variable of the form:

  • $SCHEDULER_PARAM_[PARAM-NAME] (Unix™)
  • %SCHEDULER_PARAM_[PARAM-NAME]% (Windows™)
    can be used to read any parameter in a shell script.

Parameters in a shell script can be added and modified using:

  • echo "[PARAM-NAME]=[PARAM-VALUE]" >> $SCHEDULER_RETURN_VALUES (on Unix™ systems)
  • echo [PARAM-NAME]=[PARAM-VALUE] >> %SCHEDULER_RETURN_VALUES% (on Windows™ systems)
    Check to see if the testParam parameter, described in the last chapter (page 28), has been set. As an example of the reading and writing of parameters, modify the scripts of the quickstart/firstOrderJob and quickstart/secondOrderJob Jobs as follows:

    A first order job for Windows
     @echo off
     echo %SCHEDULER_JOB_NAME% processed %SCHEDULER_ORDER_ID%
     echo Current Timestamp: %DATE% %TIME%
     echo Parameter testParam = "%SCHEDULER_PARAM_TESTPARAM%"
     echo Parameter testParam is modified to "123456789"
     echo testParam=123456789 >> %SCHEDULER_RETURN_VALUES%
     exit %ERRORLEVEL%
    

Example: firstOrderJob for Windows™

A first order job for Unix
 #!/bin/sh
 echo "$SCHEDULER_JOB_NAME processed $SCHEDULER_ORDER_ID"
 echo "Current Timestamp: `date`"
 echo "Parameter testParam = \"$SCHEDULER_PARAM_TESTPARAM\""
 echo "Parameter testParam is modified to \"123456789\""
 echo "testParam=123456789" >> $SCHEDULER_RETURN_VALUES
 exit $?

Example: firstOrderJob for Unix™

A second order job for Windows
 @echo off
 echo %SCHEDULER_JOB_NAME% processed %SCHEDULER_ORDER_ID%
 echo Parameter testParam = "%SCHEDULER_PARAM_TESTPARAM%"
 dir .\config\live\quickstart
 exit %ERRORLEVEL%

Example: secondOrderJob for Windows™

A second order job for Unix
 #!/bin/sh
 echo "$SCHEDULER_JOB_NAME processed $SCHEDULER_ORDER_ID"
 echo "Parameter testParam = \"$SCHEDULER_PARAM_TESTPARAM\""
 ls -l ./config/live/quickstart
 exit $?

Example: secondOrderJob for Unix™

Both Jobs read the testParam parameter, whilst the quickstart/firstOrderJob Job changes the value of the
parameter. testParamHello World! is the initial parameter setting for the quickstart/firstOrderJob Job. This value will be overridden by the Order

Now start the Order for the quickstart/firstJobChain Chain in JOC and follow its progress in the log file.

Further References

Job and Order Parameters

 Environment Variables

  • No labels