Record Layouts
Record layouts are used by several Ianus tasks to define the structure of the records being processed.
Layouts can be defined using either:
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 (XML defined Layouts):
- Each layout element defines one single layout
- Record fields are defined using
field
elements - Layout name is defined by the
name
attribute of thelayout
element. When omitted, the layout name is automatically generated
But there is also the possibility to define the layout using COBOL data definition syntax (COBOL defined layouts):
- Each layout element defines one or more layouts (one each level 01)
- Record fields are defined using COBOL notation
- The name of each layout corresponds by 01 level field name in the COBOL definition. If the
name
attribute is specified, it defined the name of the first defined layout
The layout name is assigned by name
attribute. When omitted, the layout name is assigned as follows:
The following attributes configure the layout:
Attribute | Type | Purpose | Default |
---|---|---|---|
name | string | Name of the layout | |
type | string | Type of layout: xml or cobol |
xml |
format | string | COBOL code format: fixed or free |
fixed |
length | string | Layout length: auto or length in bytes |
auto |
comp | string | Overrides the repository definition for the integer notation type: default , bin or little |
default (the repository default) |
mixedchars | bool | When true , Char fields considered as mixed SBCS and DBCS (shifted DBCS) |
false |
mergeencapsulateddbcs | bool | See Merge Encapsulated DBCS | false |
forcesosionencapsulated | bool | See Merge Encapsulated DBCS | false |
zonedsign | string | Defines the SIGN mode (ascii or ebcdic) of the ZONED fields | ebcdic |
path | string | COBOL copybook path (only for COBOL layouts) | |
explicitconversion | bool | if set to true , Ianus applies explicit conversion routines without staging values in .NET datatype |
false |
keypart | bool | if set to true , the field is considered part of the key to compare when using filecompare with mode=key |
false |
The following elements configure the task:
Element | Purpose |
---|---|
enable | Enables processing for the named field. Refer to Enable. |
Merge Encapsulated DBCS
When mergeencapsulateddbcs
is set to true
, Ianus automatically merges DBCS fields preceeded and followed by 0E and 0F placeholders. The latter are PIC X fields whose name is FILLER or contains, respectively, the strings "0E" or "0F".
When forcesosionencapsulated
is set to true
, Ianus considers the 0E and 0F placeholders as actual SOSI at conversion time, regardless of the actual fields values.
For example, in the layout below, the fields CHAR02
and CHAR03
will be encapsulated:
01 FILE01-REC-COBOL.
03 ZONED-FIELDS.
05 ZONED01 PIC S9(8).
05 ZONED02 PIC 9(8).
03 FILLER.
05 CHAR01 PIC X(8).
05 FILLER PIC X.
@ianus*type=dbcs
05 CHAR02 PIC X(16).
05 FILLER PIC X.
05 CHAR03-0E PIC X.
@ianus*type=dbcs
05 CHAR03 PIC X(16).
05 CHAR03-0F PIC X.
03 COMP-FIELDS.
05 COMP01 PIC S9(8) COMP.
05 COMP02 PIC 9(8) COMP.
05 COMP03 PIC S9(4) USAGE IS COMP.
05 COMP04 PIC 9(4) COMP.
03 PACKED-FIELDS.
05 PACK01 PIC S9(9) USAGE COMP-3.
03 last-hh pic x(3) value high-values.
The resulting field is a "mixed" type field, which offset is the same as 0E placeholder and the length is equal to the length of the original "dbcs" field plus two.
Note
The automatic merge of encapsulated DBCS fields works only with COBOL defined layouts.
Note
To trigger the correct DBCS conversion, the actual file content must contain 0e/0f at placeholders position.
Enable
The enable
elements enable the process for specific field. More than one enable
element can be specified to enable multiple fields.
When a field is enabled, Ianus automatically disables processing as follows:
- If the field being enabled has a REDEFINES clause, the redefined field and all the fields redefining the redefined field are disabled
- If the field being enabled has not a REDEFINES clause, all the fields redefining the field being enabled are disabled
Fields can be also dynamically enabled/disable using a Record Layout Layout Matcher.
Example
<filecompare name="COMPARE.CORRECT" left="REPOEBCDIC" right="REPOBGLA" mode="layout" >
<left recfmt="fixed" reclen="80">IANUS.TEST.REDEF02.EBCDIC.DAT</left>
<right recfmt="fixed" reclen="80">IANUS.TEST.REDEF02.ASCII.DAT</right>
<layouts>
<layout type="cobol" format="fixed">
01 multi-rec.
03 rec-data.
05 fill01 pic x(40).
05 fill02 pic x(40).
03 rec-01 redefines rec-data.
05 rec-01-a pic x(8).
05 rec-01-b pic 9(8).
05 rec-01-c pic x(8).
03 rec-02 redefines rec-data.
05 rec-02-a pic x(8).
05 rec-02-b pic S9(8) comp.
05 rec-02-c pic S9(8) comp-3.
05 rec-02-d pic x(10).
05 filler redefines rec-02-d.
07 fava pic s9(8) comp.
03 rec-03 redefines rec-data.
05 rec-03-a pic x(8).
05 rec-03-b pic S9(8) comp.
05 rec-03-c pic S9(8).
05 rec-03-d pic x(8).
</layout>
<enable>REC-02</enable>
</layouts>
</filecompare>
<foreach name="LOCALS">
<collection type="csv" delimiter="|">
DSN | Name | Copybook | Format | LRECL |
AWS.M2.CARDDEMO.USRSEC.PS | User Security file | CSUSR01Y | FB | 80 |
AWS.M2.CARDDEMO.ACCTDATA.PS | Account Data | CVACT01Y | FB | 300 |
AWS.M2.CARDDEMO.CARDDATA.PS | Card Data | CVACT02Y | FB | 150 |
AWS.M2.CARDDEMO.CUSTDATA.PS | Customer Data | CVCUS01Y | FB | 500 |
AWS.M2.CARDDEMO.CARDXREF.PS | Customer Account Card Cross reference | CVACT03Y | FB | 50 |
AWS.M2.CARDDEMO.DALYTRAN.PS.INIT | Transaction database initialization record | CVTRA06Y | FB | 350 | |
AWS.M2.CARDDEMO.DALYTRAN.PS | Transaction data which has to go through posting | CVTRA06Y | FB | 350 |
AWS.M2.CARDDEMO.TRANSACT.VSAM.KSDS| Transaction data entered online | CVTRA05Y | FB | 350 |
AWS.M2.CARDDEMO.DISCGRP.PS | Disclosure Groups | CVTRA02Y | FB | 50 |
AWS.M2.CARDDEMO.TRANCATG.PS | Transaction Category Types | CVTRA04Y | FB | 60 |
AWS.M2.CARDDEMO.TRANTYPE.PS | Transaction Types | CVTRA03Y | FB | 60 |
AWS.M2.CARDDEMO.TCATBALF.PS | Transaction Category Balance | CVTRA01Y | FB | 50 |
</collection>
<execute>
<filecopy name="${DSN}" source="TMPE" target="TMPA" mode="layout">
<source recfmt="fixed" reclen="${LRECL}">${DSN}</source>
<target recfmt="fixed" reclen="${LRECL}">${DSN}</target>
<layouts>
<layout type="cobol" format="free" path="copybooks/${Copybook}.cpy"/>
</layouts>
</filecopy>
</execute>
</foreach>