Skip to Content

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:

image
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:

0112345010101

021111112222

03100001111112222

03100011111212223

041000011111

021231116722

03100781119012332

041005611001

059453287699

In the Integration directory, the following has to be mentioned at the configuration of the communication channel.

image image


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:

image

image
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:
image


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.

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. KAPIL PATIL
    Hi Shabarish,
          
    I had faced a similar scenario and i guess this blog would prove to be very helpful indeed.

    Regards,
    Kapil    

    (0) 
  2. B Krishnan
    Hi,

    How do we handle the scenario, if the Header and Trailer record doesn’t have a key field value whereas the detail records have key field value.

    Require your expert guidance.

    Thanks.
    Bala

    (0) 
  3. raja kv
    HI,
      Thanks for your greate blog. I am facing one issue  Can you tell me how i can resolve it. please see the incoming file structure i am getting
    010johnnewjersy
    02001price
    03002989
    030039898
    020011898
    02001101
    0309090
    010johnks

    where 010-keyfield
    020-keyfield
    030-keyfiled
    here rows with 020 030 can repeatand whole set 010,020..unbound,030..unbound . 010 record can repeat once again which will treated as new set
    hope you understand. Can you tell how i can configure sender adapter for this strucure. It is very urgent .
    Thanks for your time
    bye
    raj

    (0) 

Leave a Reply