cancel
Showing results for 
Search instead for 
Did you mean: 

FIXED FIELD LENGTH is not constant

Former Member
0 Kudos

Hello Guru's,

This is the question asked in IBM .

What will you do if field length of a field in flat file is not constant or not equal to the FIXED FILED LENGTH ?.

i.e. f1 is of length is 10 and in one row its length is only 9 what will happen and what will you do to overcome this situation.( consider its a FILE TO FILE SCENARIO )

can anyone help me in this regard.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member192295
Active Contributor
0 Kudos

Hi,

If field length is not constant we can recognize fields with fieldSeparator key word. If this is also not possible alternative way is each field have some character indication, so based on character we can use keyfield mechanism.

Most of the time if field lengths are constant that time only we will use fieldFixedLengths technique else we never use, only we can use fieldSeparator technique only.

Answers (4)

Answers (4)

Former Member
0 Kudos

> This is the question asked in IBM .

> What will you do if field length of a field in flat file is not constant or not equal to the FIXED FILED LENGTH ?.

> i.e. f1 is of length is 10 and in one row its length is only 9 what will happen and what will you do to overcome this situation.( consider its a FILE TO FILE SCENARIO )

The ans for this question is very simple.

Since your FIXED FIELD LENGTH is 10 correct. now if any value comes of length 9 or less, then there will be no problem at all. It will work perfectly without doing anything. BUT if your length goes beyond 10 then it will throw an error message which you can see in RWB.

Shorter length is never a problem in case of FIXED FIELD LENGTH.

I hope now you got the ans, but good way to learn is, to create a simple scenario and test it. )

Regards,

Sarvesh

Former Member
0 Kudos

Thanks for your reply's

Shabarish_Nair
Active Contributor
0 Kudos

JFYI~~~

in case of the receiver file adapter, if the length goes beyond the specified limit it can be handled

fixedLengthTooShortHandling

The following values are permitted:
·        Error

Error means that processing of the document is terminated.
·        Cut

Cut means that a value is shortened to the maximum permitted length.
·        Ignore

Ignore means that the system applies the value completely, regardless of it being too long. Subsequent columns are moved correspondingly.

Former Member
0 Kudos

Thanks for your information and I know this feature very well.... But you are a FCC champ I have seen many of your good blogs regarding FCC.... Yes that's very true when you have deep knowledge of anything you can't stop yourself to correct the things as you did it here...

Once again thanks for reminding/correcting. )

Regards,

Sarvesh

Shabarish_Nair
Active Contributor
0 Kudos

Sarvesh,

It was not at all a correction but just an additional info for the receiver file adapter.

Good day!!

Cheers,

ShaBZ

Former Member
0 Kudos

Vijay,

You too have a Good Day!!

Regards,

Sarvesh

siddhesh_pathak4
Contributor
0 Kudos

Hello Arjun,

1. We use the FixedFieldLength only when we have fixed lengths of parameters.

Even in that case you can manage to enter some spaces at the end of the parameter.

Like , you have fixed length of 8 and the parameter is coming with 5 . Add 3 spaces at the end of the parameter in mapping. You can use UDF for that.

Most of the time we go for EndSeperator if not confirm on fixed length.

Former Member
0 Kudos

For a flat file with field fixed length, Variations in the no of characters in a record can be handled by setting the following parameters:

xml.missingLastFields=ignore|add|error

xml.additionalLastFields=ignore|error

jyothi_anagani
Active Contributor
0 Kudos

Hi Arjun,

can you please give any idea on how the flat file looks ??? Is there any condition that u have to use only fixed field lengths or any other options.You can use field seperator as ' , '.

Thanks,

Jyothi