on 03-10-2009 7:11 AM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.