File Format
The file format task (fileformat
) writes (on a file or in the log) the content of the specified file according to the layout(s) provided.
The following attributes are used to configure the task:
The following attributes configure the task:
Attribute | Type | Purpose | Default |
---|---|---|---|
repository | string | Name of the file repository | |
skip | integer | Number of records to skip | zero |
count | integer | Number of records to display. If zero, all records are displayed |
The following elements configure the file comparison:
Element | Purpose |
---|---|
file | Name and attributes of the file. Refer to File. |
output | Absolute path to the output file. If not specified, output is written on log |
layouts | Defines the record layout(s) contained in the file. Refer to Layouts. |
File
The file
element is used to define the file to display.
The following attributes configure the file:
Attribute | Type | Purpose | Default |
---|---|---|---|
recfmt | string | Defines the record format of the file. Refer to File Formats | fixed |
reclen | integer | Defines the maximum record length | |
varfmt | string | Defines the variable record format. Refer to Variable Record Formats | If not specified, the repository default is assumed. |
dd | string | When used with in a JCL interface, the name of the DD JCL statement referencing the file. The file characteristics are extracted from the file catalog and, therefore, the other attributes (recfmt, reclen and varfmt) are ignored. | |
trim | bool | If true, trailing spaces and NULLs (0x00) are removed from line sequential records | false |
encoding | string | Name of the text encoding to be used for Line Sequential files. | Latin1 |
cache | bool | If false, file copy is refreshed (applies to cached repositories only) | true |
Note
The list of available encodings is listed here: https://docs.microsoft.com/it-it/dotnet/api/system.text.encoding?view=net-5.0
Note
For MARS repositories, recfmt
, reclen
and varfmt
are ignored. The file characteristics are extracted from the MARS file catalog.
File Formats
Type | Synonim | Description |
---|---|---|
fixed | fb | Fixed Record Length |
variable | vb | Variable Record Length |
lineseq | ls | Line Sequential |
Variable Record Formats
Type | Description |
---|---|
ibm | IBM variable record format |
microfocus | Micro Focus variable record format |
Layouts
The layouts
element defines one or more record layout to compare/convert the files as well as the match script in case of multiple layouts.
The following elements configure the layouts:
Element | Purpose |
---|---|
layout | Adds a layout definition. Refer to Layout |
match | Defines the match algorithm. Refer to Match |
Layout
The layout
element defines a one or more record layouts. Each layout must be identified by a unique name (task-wide).
By default, the layout fields are defined using XML:
- Each layout element defines one single layout
- Record fields are defined using
field
elements
But there is also the possibility to define the layout using COBOL data definition syntax:
- Each layout element defines one or more layouts (one each level 01)
- Record fields are defined using COBOL notation
For further information on layout definition, refer to Record Layouts
Match
The match
element defines the "match class". Whenever more than on layout is provided, Ianus needs a match class to drive the selection of the correct layout for each record compared.
This class must implement the interface HPE.Ianus.Scripting.ILayoutMatch
. For a detailed description of the match class please refer to the Record Layout Layout Matcher section.
The class can be provided as:
- C# script: the code is compiled on the fly by Ianus and declared either:
- inline, by adding the code in the element value, or
- by reference, providing the filename of the script on the path attribute. If the script file name is not absolute, the script is searched in the same path of the job script.
- Class library: the class can be coded in any .NET language such as C# or VB.NET but also COBOL for .NET and compiled as .NET class library. The class can be referenced either:
- directly: providing the filename of the DLL containing the class on the assembly attribute and the full name of the class on the class attribute, or
- by alias: providing the name of the plugin alias defined in the Plug-ins section of the Environment Configuration File.
The following attributes configure the element:
Attribute | Type | Purpose | Default |
---|---|---|---|
path | string | Indicates to load the class script from the specified file | |
assembly | string | Indicates to load the class assembly from the specified DLL | |
class | string | Indicates the name of the class to use | |
plugin | string | Indicates to load the class from the plugin alias defined in Plug-ins |
Example
<job name="DUMPTASK">
<fileformat name="TESTFMT1" repository="REPOEBCDIC" text="ebcdic">
<file recfmt="fixed" reclen="80">IANUS.TEST.SEQ01.EBCDIC.DAT</file>
<layouts>
<include>ZZREC01.xml</include>
</layouts>
</fileformat>
<fileformat name="TESTEBCDIC" repository="REPOEBCDIC" text="ebcdic">
<output>C:\tmp\fileformat.txt</output>
<file recfmt="fixed" reclen="80">IANUS.TEST.SEQ01.EBCDIC.DAT</file>
<layouts>
<include>ZZREC01.xml</include>
</layouts>
</fileformat>
<fileformat name="FILECMP04" repository="REPOEBCDIC" count="5">
<file recfmt="variable" reclen="932">SYS053.bin</file>
<layouts>
<layout name="SYS053-DESCR">
<field name="header-sup" length="1" type="char"/>
<field name="header-cle-tab" length="4" type="zoned" signed="false"/>
<field name="header-cle-cenr" length="1" type="zoned" signed="false"/>
<field name="dstfrech" length="1" type="char"/>
<field name="dstflngf" length="2" type="integer" signed="false"/>
<field name="dstflngc" length="2" type="integer" signed="false"/>
<field name="dstflngr" length="2" type="integer" signed="false"/>
</layout>
<layout name="SYS053-REMARKS">
<field name="header-sup" length="1" type="char"/>
<field name="header-cle-tab" length="4" type="zoned" signed="false"/>
<field name="header-cle-cenr" length="1" type="zoned" signed="false"/>
<field name="dsttnlgt" length="2" type="integer" signed="false"/>
</layout>
<match path="SYS053.cs"/>
</layouts>
</fileformat>
</job>
Status codes
Status | Status code | Description |
---|---|---|
Ready | -1 | Task is initialized, but not yet started |
Running | -2 | Task is running |
Success | 0 | Task completed successfully |
Warnings | 1 | Task completed with warnings |
Errors | 2 | Task completed with errors |
Aborted | 9 | Task cannot be executed |