on 03-11-2010 1:55 PM
Hi everybody,
In the file adapter receiver, I want to create a fixed length record file .
Each record need to have the same size.
How is it possible, because I have a file which contains variable legnth depending of the lenght of message?
exemple:
<mess>
<row>1234567</row>
<row>123456789A</row>
</mess>
give the file
1234567<CR>
123456789A<CR>
<CR> means carriage return
and I want a file like
1234567 <CR>
123456789A<CR>
with the same lenth of record (10 in the example).
Can anyone help me, ,please?
Kind regards.
E. Koralewski
> and I want a file like
> 1234567 <CR>
> 123456789A<CR>
>
> with the same lenth of record (10 in the example).
>
> Can anyone help me, ,please?
This you have to handle in mapping. You need to created an UDF which should check the length of field, if length is less than 10 then it should add spaces for the remaining values.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
Create a value user defined function with one input argument a and name it is inputpad. Then add the following code:
Imports: java.*;
while (a.length()<Integer.parseInt("10"))
{
a= a +" " ;
}
return String;
Here I am assuming your fixed length for the field is 10. If it is more or less then change the number. Now in your mapping do all your logic and then in the final add this like:
input ---> your logic --> inputpad udf --> target.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.