cancel
Showing results for 
Search instead for 
Did you mean: 

File Adapter Fixed Field Length

Former Member
0 Kudos

Hello,

I have the following problem. The file that is being generated is fixed length. However, there is no "\n" end line character in the end of each record. It is one big row of data. Is there any way to separate such file into records of information using File Adapter, since it seems with no "\n", File Adapter always has just ONE record.

Thank you for your help,

Dmitriy Mindich

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

New line is the default. You should have multiple lines by default.

You might try the following:

xml.endSeparator=<lastSeparatorString>

where <lastSeparatorString> = \n

Regards,

Bill

Answers (2)

Answers (2)

Former Member
0 Kudos

We're running J2EE.

Specifying 'nl' is newline - I don't have newline, just one gigantic stream...

Example -

Row contains Header(1), Line(n)

All records are fixed-width

Header has 3 fields

===================

RecordType 3 chars (this is the key - indicated by 450)

OrderNum 5 chars

Order Type 2 chars

Line has 3 fields

===================

RecordType 3 chars (this is the key - indicated by 475)

LineNum 4 chars

PartNo 5 chars

So the data would look like this

450Ord01ZS4750001PartA4750002PartB

This would be an order w/ 2 lines. If I send this stream in, only the header is read, the lines are dropped, and my mapping fails b/c the lines need to be there.

Former Member
0 Kudos

Hi Amanda,

If you don't have lot of fields You can use java mapping to split the record. We have done this to spilt records which has multiple delimitar.

-Jayant

Former Member
0 Kudos

Also try following sample configuration to split the record based on fixed length.

Plain2XML xml.recordsetStructure =HEADER,1,ITEM,*

Plain2XML xml.keyFieldName = ORDER_NUMBER

Plain2XML xml.keyFieldType = CaseSensitiveString

Plain2XML xml.HEADER.fieldNames= ORDER_NUMBER,field-shipto

Plain2XML xml.HEADER.fieldFixedLengths = 2,10

Plain2XML xml.ITEM.fieldNames = ITEM_NO,field-product,field-quantity

Plain2XML xml.ITEM.fieldFixedLengths = 2,5

Former Member
0 Kudos

I do have a lot of fields - between about 50-200, in 450 different interfaces. We did try the java program, but worry about performance problems during production. We'd rather use their solution.

The fixed length config below is exactly what we have - the problem is that it expects each change in record to have a newline between them. If you don't, then it only processes the headers & drops the lines off. That's why I'm trying to figure out how to override "endSeparator"

stefan_grube
Active Contributor
0 Kudos

Has every row the same length? Then you could add a small Java Routine to the Adapter Dispatcher to enter the \n into the stream. This Module runs before the conversion takes place.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Can you please explain creation of File Adapter module capable of inserting \n into the stream. I thought once you process message through adapter module, XML parsing has already been finished, meaning it is much more complicated to alter XML message.

Is there any way to alter character stream before XML parsing occurs?

Thank you in advance,

Dmitriy Mindich

Former Member
0 Kudos

Dmitriy, did you ever get this to work? I have the same scenario. I am trying to get endSeparator to work, but no luck yet. I can't seem to override the newline thing.

Former Member
0 Kudos

Amanda,

What Adapter are you using: J2EE or J2SE. In J2EE adapter, there is a parameter option XXX.endSeparator. The value that I use is "'nl'". What is your record separator?

DM