Introduction

The JITL FileOrderVariablesJob template can be used to read variables from incoming files:

  • this applies to incoming files that are subject to JS7 - File Watching.
  • this applies to any files that are accessible to jobs in a workflow.

The following prerequisites are valid for incoming files:

  • The incoming file can hold pairs of names and values similar to the temporary file available from the JS7_RETURN_VALUES environment variable for return values of shell jobs: <name>=<value>.
    • pairs of names/values are separated from each other by EOL which can be CR, CRLF or LF.
    • The <value> can include any Unicode characters.
  • For the handling of incoming files the following applies:
    • If the incoming file holds pairs of names and values for variables then they are added to the order as return values from the JITL FileOrderVariablesJob template.
    • If the incoming file is empty then no return values are created and no error occurs.
    • If the incoming file includes content that does not match name/value pairs then an error is raised.

The JITL job does not use any arguments to specify its processing mode. Instead, users can add any arguments to this job that are expected to match the name of a name/value pair in the incoming file:

  • Job arguments that are not assigned a value are considered optional for the incoming file. Respective return values are created only if the incoming file provides the variable. This includes that the incoming file specifies an empty value for the variable.
  • Job arguments that are assigned a value are considered optional.
    • If the incoming file does not provide the variable then a return value with the JITL Job's default value is created.
    • If the incoming file provides a variable - optionally with an empty value - then a return value with the value from the incoming file is created.
  • For pairs of names/values for which no arguments are specified the JITL Job will raise an error.
  • Example of an incoming file:

    var1=value1
    var2=value2
    var3=

    • The variables var1 and var2 will be created with their respective values. For var3 an empty value will be returned from the JITL Job.

FEATURE AVAILABILITY STARTING FROM RELEASE 2.4.1

Usage

When defining the job either:

  • invoke the Wizard that is available from the job properties tab in the Configuration view and select the JITL FileOrderVariablesJob and relevant arguments from the Wizard

or

  • specify the JITL job class and com.sos.jitl.jobs.fileordervariablesjob.FileOrderVariablesJob Java class name and add arguments specifying the variables that are expected to be carried by incoming files.

Example

Download (upload .json): pdfFileVariables.workflow.json

You can use the job wizard like this:


Explanation:

  • Add an empty job from the instruction panel.
  • Specify a name and a label for the job.
  • Select an Agent.

In a next step invoke the job wizard that you find in the upper right corner of the job property editor. The wizard brings up the following popup window:


Explanation:

  • From the list of available job templates select the FileOrderVariablesJob.

Then hit the "Next" button to make the job wizard display available arguments:


Explanation:

  • There are optional arguments for this job to identify the file carrying variables:
    • if the job is used in a workflow to which orders are added from JS7 - File Watching then the job will use the internal file variable that specifies the incoming file and does not require an argument.
    • if the job is used in a workflow not subject to File Watching then the js7_source_file argument is used to specify the path to the file carrying variables.
  • Any additional arguments specify variables that are expected from the incoming file. The example makes use of the var1 argument which translates to the fact that from the incoming file a line is expected to specify the variable like this: var1=some value.
  • Select the check box provided with each argument if you want this argument to be added to the arguments of the FileOrderVariablesJob template.

When hitting the Submit button the wizard adds the required arguments to the job which should look like this:

Documentation

The Job Documentation including the full list of arguments can be found under: https://www.sos-berlin.com/doc/JS7-JITL/FileOrderVariablesJob.xml

The FileOrderVariablesJob class accepts the following arguments:


NameRequiredDefault ValuePurposeExample
js7_source_fileno

Specifies the path to the incoming file:

  • If the workflow in use is subject to File Watching then this argument is not required as the internal file variable will be used.
  • If the workflow is not subject to File Watching then the path to the incoming files has to be specified with the js7_source_file variable.
/tmp/file/some_file.csv

<variable>

yes

Specifies a variable that is expected from the incoming file:

  • If a value is specified then it is applied as a default value in case that the incoming file will not provide the variable.
  • If no value is specified then then incoming file is required to specify the variable and otherwise an error is raised.

Any number of variables can be specified like this.

var1

Further Resources



  • No labels