The RunJob Method

Previous Next

See Also

The RunJob method of the BatchRunner component has the following parameters:

Seqno

Parameter Name

Mode

Mandatory

Datatype

Details

1

JobName

in

Yes

String

 

2

XMLOutput

out

Yes

String

 

3

-quiet

in

No

Boolean

Details

4

-[<set>:]string_delimiter

in

No

String

Details

5

-[<external set>:]colsep

in

No

String

Details

6

-[<external set>:]nvl

in

No

String

Details

7

-[<task_name>:]data_directory

in

No

String

Details

8

-[<task_name>:]create_suc

in

No

Boolean

Details

9

-[<task_name>:]create_err

in

No

Boolean

Details

10

-[<task_name>:]create_mes

in

No

Boolean

Details

11

-[<task_name>:]

filename::<old_file_name>

in

No

String

Details

12

-[<task_name>:]

user_table::<old_table_name>

in

No

String

Details

13

<input_parameter_set.element>

in

No

?

 

14

,,

,,

,,

 

 

15

ReturnStatus

in

No

Yes|No

 

16

-logfile

 

No

String

Details

17

-wlogfile

 

No

Boolean

Details

 

The job-name parameter is the only mandatory parameter. It has to be the first input parameter and does not need to be named.

Input parameters 4 through 12 are optional pre-defined parameters, the same that can be specified for the ActionStartJob()  method. They all start with a minus to indicate that they are USoft pre-defined. User-defined parameters are not allowed to start with a minus.

Input parameters 13, 14, ... are user-defined parameters as specified in the input not provided.

The order is which all optional parameters are specified is of no importance. They are passed to the component by name.

When the select under the invoke retrieves multiple records, the job is called multiple times.

The ReturnStatus parameter can be used to specify that an XML status message, in the form '<result>Error</result>', is to be returned in the event of an error. If you set this parameter, the statement 'invoke batchrunner.runjob ... ' will no longer fail in the event of an error. You can also build your own error handling mechanism, making use of the return status.

If the ReturnStatus parameter is set to Yes:

· Data is returned if result is correct and an output set is defined.

 

· Nothing is returned if no output set is defined and result is correct.

 

· <Result>Error</Result> is returned in the event of an error. The BatchRunner statement does not fail. See "BatchRunner Error Handling for information about how these errors are to be handled further.

If the ReturnStatus parameter is set to No (or not set at all):

· Data is returned if result is correct and an output set is defined.

 

· Nothing is returned in the event of an error, and the statement fails.

Examples:

An example of a simple call that runs the MyFirstJob job, is:

INVOKE    BatchRunner.RunJob

WITH

SELECT    'MyFirstJob'

When calling the BatchRunner component, you can also use the function call syntax:

SELECT    BatchRunner.RunJob('MyJob', 'True' as "-quiet", contract_id as "contract_id")

An example of a more complex call with many input parameters is:

INVOKE    BatchRunner.RunJob

WITH

SELECT  'MySecondJob',

       'True'    "-quiet",

       my_data_dir    "-my import task:data_directory",

       '#'    "-nvl",

       23    "contract_id",

       56    "department_id"

FROM    SystemSettings

The output of the RunJob method is a string containing an XML document. The format is the same as the output of the XML.SqlExport method. The contents are all records from the output parameter set table. When the job has an output parameter set, then the output XML contains exactly one output record with one column (just like XML.SqlExport). If the job does not have an output parameter set, the output column is NULL.