Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Users frequently find a situation when a job creates some a result that which should be forwarded to subsequent jobs in a workflow.

...

Shell jobs can pass results to subsequent jobs:

  • by creating a key/value pair with the syntax: key=value.
  • The key/value pair is appended to a temporary file that which is provided by JS7 and that is indicated by the JS7_RETURN_VALUES environment variable.
  • The key provided is the name of the workflow order variable that which can be used by subsequent jobs.
    • If the variable does not yet exist then it is will be created on-the-fly.
    • If the variable exists then the value is will be overwritten


The job script implementation looks like this:

...

Second Job: Read Variables

Shell jobs access workflow order variables and order variables from a mapping to environment variables.

  • The JOC Cockpit GUI offers to add allows the mapping to be added per job from the right lower corner with the Environment Variables sub-tab Environment Variables.
  • The mapping includes to freely choose free choice of the name of an environment variable that which is used in the job script and to assign an existing workflow variable or order variableorder variable.
  • The spelling of variable names is case-sensitiveesensitive.


The job script implementation looks like this:

...

Code Block
languagebash
titleExample of a Windows Shell job passing reading variables
linenumberstrue
@rem read results
@echo FIRST_RESULT = %FIRST_RESULT%
@echo SECOND_RESULT = %SECOND_RESULT%

Considerations

Scope of Order Variables

The examples above create order variables on-the-fly. Such variables can be overwritten by any job or instruction in a workflow.

However, if variables are declared with the workflow, then they are considered arguments which cannot be overwritten:

  • Clicking in the background of the middle panel without selecting any object such as a job, will cause the workflow properties to be shown in the right hand panel.
  • Workflow properties allow variables to be added which:
    • can carry no default value: Such variables are considered mandatory and values have to be added when submitting orders.
    • can carry a default value: Such variables leave it up to the order to provide a value which would overwrite the default value.

If a variable is declared at workflow level then it cannot be overwritten by subsequent jobs.

Image Added

Historic Outcome of Order Variables

The examples above create order variables on-the-fly. Such variables can be overwritten by any job or instruction in a workflow..

  • JS7 keeps track of the historic outcome of variables with an order's position in the workflow and restores values if a job is repeated. You can make the second job fail and use
    • the Resume operation offered by the JOC Cockpit GUI allows the job to be rerun with the same order variable values as before.
    • the Resume parameterized operation offered by the JOC Cockpit GUI allows order variables to be modified before rerunning the job.

Image Added


This operation makes a popup window appear that looks like this:

  • Most recent values of order variables are displayed and can be modified.
  • The returnCode is a built-in variable that shows the historic value of the predecessor job's return code.

Image Added


Modifications include changing the values of order variables and modifying the order's position in the workflow:

  • Drag & Drop the order by holding the red bullet of the failed order and move the order to a different position.
  • Drag & Drop operations are limited within a logical scope:
    • they allow selection of a position within a sequence of jobs and instructions in a workflow.
    • they do not allow jumping into a JS7 - Fork-Join Instruction or other instructions that check an initial condition which might not be met by the current order.

Image Added