One Star

AFB120 File format to a CSV file format

Hello,
Does anyone has a clue on how to stard from an afb120 file format and output a csv file format with making the replacements needed.
Here you can find the afb120 format specs.
http://wiki.fenix.iscte.pt/index.php/AFB120_format
Thanks a lot any help I can get from you guys.
2 REPLIES
One Star

Re: AFB120 File format to a CSV file format

Hi,
looks like a record will have a fix length of 120 Bytes (or character). So you could use a tFileInputPositional to read one line after another. Extract two fields recordType (two bytes) and data. After this component use a tMap to split the data in different streams (depending on the recordType). You could decompose the data with the tExtractPositionalFields component.
You may now have the problem that you have different streams for the same data. To get the together you could use context variables. Remember that in tMap the streams are generated in the same order in which they are defined in the tMap component. So start with the first record (for a account for example) in the topmost position.
Bye
Volker
One Star

Re: AFB120 File format to a CSV file format

Hi again,
here my answer regarding your question in 5456
but besides the fact that they are positional , they also need transformation and that is where I'm stuck because
for exemple an amout can come as 1234.2N
and the N caracter is in fact a 5 and debit position. These are for bank statements,

The answer depends on the desired output. You could, for example, split the data in two values (1234.2) and (N). The second one could be used together with a lookup table with the same values provided in your link. I would add the attribute debitCreditType which will be positive or negative. If the first one would be defined as a number you could (in java) use the following code:
(rowN.amount*10+(rowLookup.debitCreditValue))*(rowLookup.debitCreditType)

Additional you should care about the decimal position.
Bye
Volker