Content Conversion (Pattern/Random content in input file)
The scenario deals with the content conversion so as to extract all the data in an input file wherein the content may follow a pattern or content is random.
The Data type is shown as below:
Note: During the creation of data type the header, hbatch, body , tbatch and trailer are created at the same level and a recordset creation is ignored.
Here it can be noted that header and trailer have their occurrences as 1 while the hbatch, body and tbatch are 0 to unbounded. In this case the pattern noticed is that the header and trailer comes once and within it hbatch, body and tbatch occur. The body comes repeating in between an hbatch and tbatch. The sample file below will throw more light.
The sample file:
In the Integration directory, the following has to be mentioned at the configuration of the communication channel.
The recordset name is optional. Even though it is mentioned, it can be ignored by the statement ignoreRecordsetName = true . In the recordset structure, the occurrence for trailer has to be set to * . The recordsets per message is set to * . This specifies the number of recordsets to be grouped together in a message. All recordsets are thus included in the XML message.
The output XML thrown to XI for further processing is as shown below:
Suppose the trailer occurrence is mentioned as 1 (as in the data type created ) then the output XML would not have the complete data as in the input file, rather only the final hbatch, body and tbatch occurring before the trailer would be included in the message.
The output XML after content conversion would be then as follows for the same input file:
NOTE: In case, whole of the file follows a random content then all you need to change is the occurrence (make all the nodes as 0 – unbounded) during the creation of data type. At the communication channel configuration, the number of substructures need to be mentioned as * for the sequence.
Hope this weblog would help you in case of the content conversions of files following a pattern or random occurrences.