We are using cloverETL 2.9.2. We want to read an ebcdic file with BCD(Binary-coded decimal) fields. I have no problems processing an ebcdic file with out BCDs.
I have set the BCD field with type of byte. The byte field coming out of the DataReader is getting translated from ebcdic to ascii. This screws up the value of the BCD. Is there a work around for this?
We have written our own transformation, and I hope that we do not need to write out own DataReader.
The data file has fixed length records. The fields in the records are also fixed length. I am going to give a simple example with a file containing 2 fields.
I am using Cp037 to translate EBCDIC to ASCII.
The first field is EBCDIC text with length 10 containing a name. I will fill out data in with ASCII so it can be read.
Next field is a BCD field with the length 2. It contains the number books owned. I will fill out this data in hex so it can be read.
Here is the node defination:
Here is the metadata for the file:
<?xml version="1.0" encoding="UTF-8"?>
Record 1 Tom has 10 books
Record 2 Steve has 201 books
±---------±----+
|Tom |010C|
±---------±----+
|Steve |201C|
±---------±----+
The problem is when I look at the first byte of Steve’s book count it should hex 20 but it has a value of hex 80. Hex 80 is the ASCII translation of EBCDIC hex 20.
I am able to read the names correctly.
We have prepared a short sample for you. Could you please check attached project, whether it is what you need? This sample reads data from input (10EBCDIC; 2 BCD). ? The BCD field (count) is transformed using byt2hex() in Reformat node, and sent to output port in hex format.
We have created the sample source data based on what you posted above. In case these data are not the source data you process, could you please send them to us?