User GuideReference ManualIntegration Scenarios
 

1.5.6. Multirecord Message Format

See: Managing Channels - Manage a Channel

Multirecord Wizard screen allows you to define your Multirecord message format (delimited or a fixed-length) according to your own file format.

What is mr file?

The mr file is a multirecord definition file which is used by the Self-Service MultiRecord wizard to generate the corresponding message definition and also to build the corresponding servingxml resource file.

How to build mr file?

(1) Specify if the message is a delimited or a fixed-length.

For fixed-length messages, the mr file header will look like this:

<multirecord name="mymultirecord" type="fixed-length" lineDelimited="true" recordDelimiter="\r\n" quoteSymbol-character="&quot;" quoteSymbol-escapeSequence="\&quot;" xmlns="http://xmlns.babelway.com/2007/multi-record">

For the delimited messages the mr file header will look like this:

<multirecord name="mymultirecord" type="delimited" fieldDelimiter="," recordDelimiter="\r\n" quoteSymbol-character="&quot;" quoteSymbol-escapeSequence="\&quot;" xmlns="http://xmlns.babelway.com/2007/multi-record">

* recordDelimiter defines the delimiter between each record, it is usually the ending line character represented on windows by \r\n, on Unix/Linux by \n and on Macintosh by \r.

* lineDelimited specify if the system use a record delimiter. If set to false, record will be based on the sum of the fields lenght for fixed length or the number of fields for delimited multirecords.

* fieldDelimiter, only used whith a delimited message, defines the field delimiter.

* quoteSymbol-character is the character used to quote a field (often &quot;)

* quoteSymbol-escapeSequence is the sequence that will display the quote symbol character in a quoted field (often \&quot;)

Hint:

For multirecord as message in, do not specify recordDelimiter. The system will catch the \r or \n or \r\n. For multirecord as message out, DO specify recordDelimiter as being for instance "\r\n"; this will generate windows compliant file and let you change the delimiter from the advanced properties later on.

(2) The second step is to write the message records definitions

You should specify the name for the record and for each of its field. Each record should have at least one field with a static value which will be used to identify the record.

<record name="Record1">
    <field name="recordType" value="R1" width="2"/>
    <field name="field1" width="5"/>
    <field name="field2" width="3"/>
</record>

* the width is only mandatory for fixed-length messages

* value is used to specify that the field has a static value that will never change

By default all first fields with a static value are used to identify a record. But, you can also manually defines which fields must be used to identify a record using the identifier paramter.

<record name="Record1">
    <field name="recordType" value="R1" width="2" />
    <field name="fieldA" width="5"/>
    <field name="fieldB" width="3" value="BBB" identifier="true"/>
    <field name="fieldC" width="7" />
    <field name="fieldD" width="2" value="DD" identifier="true"/>
</record>

In this case, only the third and fifth fields (fieldB & fieldD), with identifier equals to true, will be used to identify the record. The default (without identifier=true) would only use recordType field as the identifier.

Remark:

For fixed-length messages, the fields used to identify a record should have the same position and length in each record. No overlap between identifiers is allowed between records.

If a fixed-length message have variable length identifier per records, the only way to define it in the mr files is to first define the smallest common length identifier for all records and then for each records that have longer identifier, add as many as smaller field needed to unambiguously identify each record.

For example if we have a message where AAAAA, 111 and 2222 are identifier like in the following:

AAAAA contentcontent   anothercontent
1112222  this and that

The following definition is not valid since the fieldA is bigger than field1 and moreover, fieldA also overlaps with field2

<record name="Record1">
    <field name="fieldA" width="5" value="AAAAA" identifier="true"/>
    <field name="fieldB" width="15" />
    <field name="fieldC" width="17" />
</record>

<record name="Record2">
    <field name="field1" width="3" value="111" identifier="true"/>
    <field name="field2" width="4" value="2222" identifier="true"/>
    <field name="field3" width="20" />
</record>

It should be replaced by:

<record name="Record1">
    <field name="fieldA" width="3" value="AAA" identifier="true"/>
    <field name="fieldA" width="2" value="AA" identifier="true"/>
    <field name="fieldB" width="15" />
    <field name="fieldC" width="17" />
</record>
<record name="Record2">
     <field name="field1" width="3" value="111" identifier="true"/>
    <field name="field2" width="2" value="22" identifier="true"/>
    <field name="field2" width="2" value="22" identifier="true"/>
    <field name="field3" width="20" />
</record>

We had to split the fieldA in two in order to have one fieldA with the length 3 (the same as field1) with another fieldA with the remaining length 2.

Then the field2 (length 4) was also bigger than the second fieldA (length 2) so we also need to split it in two field2 of length 2.

All corresponding identifier have now the same length (3 and 2) and there is no overlap between them.

It is also possible to add 4 extra parameters label, description, justify & padCharacters to each field

<field name="myField" label="My Field" description="My field description" justify="right" padCharacter="x" width="10"/>

* label and description are used to display the message tree

* justify can be center, left or right

* padCharacter is the character used to fill empty space in the field width

(3) The last step is to define the message structure at the end of the mr file.

 <xml>
    <group name="Transaction" maxOccurs="unbounded">
          <group name="headers">
             <record name="header" minOccurs="1" maxOccurs="unbounded"/>
          </group>
          <record name="record1" maxOccurs="unbounded"/>
          <group name="footers">
             <record name="footer" />
          </group>
     </group>
  </xml>

* Each element can define the minOccurs and the maxOccurs parameter with either a 0, a positive number or 'unbounded'.

* Records defined in the records section can only appear once in the message structure.

* Records can be grouped using the group element. The name of the group is mandatory.

* Records in a group should be ordered in the same way they appeared at the message.

Sample multirecord fixed-length message

HH00123  AB
HH00045 CDE
R1one  100
R1two  101
R1four 103
FF3

Sample multirecord definition file

<?xml version="1.0" encoding="UTF-8"?>
<multirecord name="mymultirecord" type="fixed-length" recordDelimiter="\r\n" quoteSymbol-character="&quot;" quoteSymbol-escapeSequence="\&quot;" xmlns="http://xmlns.babelway.com/2007/multi-record">
<records>
<record name="header">
<field name="recordType" value="HH" width="2"/>
<field name="header1" width="5" justify="right" padCharacter="0" />
<field name="header2" width="4" justify="right" padCharacter=" " />
</record>
<record name="record1">
   <field name="recordType" value="R1" width="2"/>
   <field name="field1" width="5" label="My field" description="My field Descritpion" />
   <field name="field2" width="3"/>
</record>
<record name="footer">
<field name="recordType" value="FF" width="2" />
<field name="footer1" width="1"/>
</record>
</records>
<xml>
       <group name="Transaction" maxOccurs="unbounded">
          <group name="headers">
             <record name="header" minOccurs="1" maxOccurs="unbounded"/>
          </group>
          <record name="record1" maxOccurs="unbounded"/>
          <group name="footers">
             <record name="footer" />
          </group>
       </group>
    </xml>
</multirecord>

Wizard screen

When you create a new message format, you must first configure it using the following wizard.

Multirecord Wizard screen

Figure 1.43. Multirecord Wizard screen


A Multi Record messsage can only be set up using a sample file. Select your sample file using the Browse... button then click on the Upload command.

Edit screen

Once the message format sample has been uploaded, or when it is used or copied from a saved format, edit screen appears as follows.

Multirecord Edit screen

Figure 1.44. Multirecord Edit screen


See Message Edit Functions for further information on message definition, contextual menu and additional commands available on this screen.