Quantcast
Channel: Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 741

Content Conversion for fixed length files with key field value shorter than key field length

$
0
0

It is common for hierarchical flat files to have a key field indicating the type of structure for the line. For the case of fixed length files, normally the value of the key field is same as the maximum length defined for the key field.

 

However, there are occasions where the value of the key field is shorter than the maximum defined length. Below is an example whereby the file has 3 different structures - Header, Line and Trailer. The maximum length of the key field is defined as 10, however the actual contents are only 6.

filestruct.png

 

This can cause potential issue during configuration and execution of content conversion for such file format. If the fieldFixedLengths parameter is set to 10 for the key field, and the keyFieldValue has length of 6 (i.e. MSGHDR); during runtime processing, it will not be able to match that line. Even if we try to pad the keyFieldValue with additional white space, these spaces are automatically removed during channel activation.

 

A simple technique can be employed in order to resolve this. It involves splitting the key field into two parts – an actual key field and a dummy field.

 

Using the example above, the key field is split into the following two fields:-

CORCID – length 6

TEMP – length 4

 

The corresponding data type in ESR should be modified to match this split of fields.

 

In the parameter configuration of the content conversion, the field split is reflected as below:-

xml.keyFieldName = CORCID

xml.Header.fieldFixedLengths = 6,4,<Other field lengths>

xml.Header.fieldNames = CORCID,TEMP,<Other fields>

xml.Header.keyFieldValue = MSGHDR

xml.Line.fieldFixedLengths = 6,4,<Other field lengths>

xml.Line.fieldNames = CORCID,TEMP,<Other fields>

xml.Line.keyFieldValue = MSGLIN

xml.Trailer.fieldFixedLengths = 6,4,<Other field lengths>

xml.Trailer.fieldNames = CORCID,TEMP,<Other fields>

xml.Trailer.keyFieldValue = MSGTRL

 

Below are screenshots of an example configuration based on the example. Please note that the example uses the MessageTransformBean module, but this splitting technique is also applicable for FCC configuration on the File/FTP adapter.

 

Module processing sequence

module.png

 

Module parameters

Set conversion class

contenttype.png

Set conversion type and document details

mtbtop.png

Set record structure

mtbstruct.png

Set field configuration for Header structure

mtbhead.png

Set field configuration for Line structure

mtbline.png

Set field configuration for Trailer structure

mtbtrail.png


Viewing all articles
Browse latest Browse all 741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>