Tasks
Tasks are the units of work of a Ianus job. The following summarized the supported Ianus tasks and the correspondint XML elements defining the tasks.
| Element | Task | Description |
|---|---|---|
| tablecompare | Table Compare | Compare two database tables |
| spcompare | Stored Procedure Compare | Compare the output of two stored prcoedures |
| filecompare | File Compare | Compare two files |
| tablecopy | Table Copy | Copy/Convert a database table |
| tableunload | Table Unload | Export a table to a file |
| tableload | Table Load | Import a table from a file |
| tablescan | Table Scan | Scan a table |
| filecopy | File Copy | Copy/Convert a database file |
| filedump | File Dump | Display the raw content of a file |
| fileedit | File Edit | Copy, filter and edit file |
| fileformat | File Format | Display the formatted content of a file |
| generate | Generate | Generate template based files |
| imsconv | IMS/DB Data Conversion | Split and validate IMS/DB export |
| log | Log | Log user messages |
| jclsubmit | JCL Sumbit | Submit a job to a JES region |
| foreach | Foreach | Iterate other tasks |
| userscript | User Script | Execute custom tasks (coded in .NET languages) |
| powershell | PowerShell | Execute a Powershell script |
| sql | Sql | Execute SQL commands against a data source |
| excel | Excel Import/Export | Import/Export RDBMS data to Excel files |
| setenv | Set Environment Variable | Set environment variable |
| copycheck | Copycheck | Check COBOL layout (copybook) |
| listcat | Listcat | Extracts file info from LISTCAT reports |
The following attributes are available to configure all tasks:
| Attribute | Type | Purpose | Default |
|---|---|---|---|
| name | string | Task name | |
| enabled | bool | Task enablement condition | true |
| thread | bool | Multi threading strategy, when job runs in multi-threading mode. Refer to Multi Threading Strategy for possible options. | multi |
The following elements configure all tasks:
| Element | Purpose |
|---|---|
| pre | Defines the pre-execution actions |
| post | Defines the post-execution actions |
Task Enablement Condition
Task execution can be enabled/disable depending on conditions. The following conditions are supported:
| Syntax | Description |
|---|---|
true |
Task is always enabled (default). |
false |
Task is always disabled. |
ifdef <ENV> |
Task is enabled if the environment variable <ENV> is defined. |
ifndef <ENV> |
Task is enabled if the environment variable <ENV> is not defined. |
Example
<setenv enabled="true" name="VAR1">ACME</setenv>
<setenv enabled="ifndef OUTDIR" name="OUTDIR">.</setenv>
<generate name="generate.tablecopy">
<collection type="excel" file="sample.xlsx"/>
<output multi="true">%OUTDIR%/tablecopy/${Object Name}.xml</output>
<template>
<include type="text">templates/tablecopy.xml</include>
</template>
</generate>
Multi Threading Strategy
When job runs in multithreaded mode, it indicates the multithreading management strategy.
| Value | Description |
|---|---|
| single | Task runs alone |
| first | Task starts alone |
| multi | Task runs in parallel |
For further information on multithreaded tasks, please refer to Multi-Threaded Jobs.
Pre and Post actions
Every task can be have a set of actions defined to be executed before (pre) or after (post) the task specific function is performed.
Note
Actions perform operations that can be performed also by using specialized task. The latter have a wider spectrum of options to control the operation than actions. But the advantage of using actions over specialized task is that actions form part of the task itself, affecting its result and, most important, guarranteeing the correct execution sequence. This is particularly useful when dealing with multi-threded jobs.
Action are defined with corresponding elements. The following actions are supported:
| Element | Purpose |
|---|---|
| jcl | Submit a JCL to a JES region. |
| powershell | Execute a Powershell script |
| sql | Execute a SQL statement against a database |
The following attributes configure the actions:
| Attribute | Type | Purpose | Default |
|---|---|---|---|
| minrc | integer | Minimum success RC threshold | 0 |
| maxrc | integer | Maximum success RC threshold | 0 |
| source | string | If defined, the action command/script is loaded from the specified file | |
| region | string | For JCL action, the region to submit the JCL | |
| db | string | for SQL action, the database to run the SQL command |
Actions are always executed sequentially in the order they are defined in the task.
Actions wait for the corresponding command to be completed (i.e. the JCL is completed once the JCL has run).
Action return codes are defined as follows:
| Element | Return code |
|---|---|
| jcl | JCL status code |
| powershell | Value of the variable $ActionReturnCode |
| sql | SQL Query execution return code |
Actions are considered successful is their own return code is between the MIN and MAX return-codes defined. If an action fails, the task execution is terminated with errors.
Example
<tablecompare name="TESTOK" mode="key" left="QS" right="QS">
<pre>
<jcl region="MFESCLASSIC" source="TSTIAN0K.jcl"/>
<jcl region="MFESCLASSIC">
//EMBEDDED JOB 'EMBEDDED',FC,CLASS=A,MSGCLASS=X
//DELPS EXEC PGM=IEFBR14
//*
</jcl>
<powershell>
echo "I am PowerShell $($PSVersionTable.PSVersion) in job $($Job.Name) and task $($Task.Name)"
$ActionReturnCode = 10;
</powershell>
<sql db="QS">
select count(*) from dbo.TEST01
</sql>
</pre>
<left>dbo.TEST01</left>
<right>dbo.TEST01</right>
</tablecompare>
<!-- post actions will fail here -->
<tablecompare name="TESTERR" mode="key" left="QS" right="QS">
<left>dbo.TEST01</left>
<right>dbo.TEST01</right>
<post>
<jcl region="MFESCLASSIC">
//EMBEDDE2 JOB 'EMBEDDE2',FC,CLASS=A,MSGCLASS=X
//DELPS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE NON.EXISTING.FILE
SET MAXCC=4
/*
</jcl>
</post>
</tablecompare>