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.
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 parameters
Set conversion class
Set conversion type and document details
Set record structure
Set field configuration for Header structure
Set field configuration for Line structure
Set field configuration for Trailer structure