cancel
Showing results for 
Search instead for 
Did you mean: 

FIle Content Conversion without End separator

Former Member
0 Kudos

Hi ,

I am trying to read a file to create Header(o:1), line Item (0:n) and (trailer 0:1)

Header: Occurrence is 1, key element is 03, length is 160 (suppose filed name are abcd)

Lineitem : Occurrence is n, key element is 06, length is 160 (suppose filed name are efghi)

Trailer is :Occurrence is 1, key element is 08, length is 160 (suppose filed name are xyz)

Worst part is there is no end separator therefore entire records comes in a single row. And as the number of line item is 0 to unbounded)

Therefore facing issue.

Any suggestion  to handle it at Adapter or integration level?

Regards,

Sudeep

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sudeep

This is one of the common requirement. Write a simple java mapping and convert the data to desired format.

Use substring function to separate the header ,item and trailer data.

Header = Substring (0,160)

item = Substring ( 161 ,length-160)

trailor= Substring (length-160+1 , length)

Then apply the logic to seprate the item data, since the item data will contain multiple line item details.

Former Member
0 Kudos

Indrajit,

I was searching some thing at adapter level rather than going for Java. Because if we have a end separator then we are able to do it easily but without end separator at adapter level solution is the concern.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You can use java program to create the separation in the file for both header and trailer.  Once you converted into header, item and trailer format then you can use PI to poll the file.

Former Member
0 Kudos

Thanks Baskar: I agree with the  solution but looking for something without Java.

Regards,

Sudeep

Harish
Active Contributor
0 Kudos

Hi Sudeep,

If you have fixed length for Header, lineitem and trailer, then
you can read the file as simple2XML and convert into simple XML (one segment unbounded
segment containing all the data).

then you can distinguish the data in mapping.

Regards,

Harish

Former Member
0 Kudos

Harish,

As there is no end separator so the adpater reads only the first 160 characters and ignores the rest data.

Regards,

Sudeep

Harish
Active Contributor
0 Kudos

Hi Sudeep,

in this case you need to read 160 char in one data segment and seperate the structure in map or write a adapter module.

Regards,

Harish