cobrix icon indicating copy to clipboard operation
cobrix copied to clipboard

Binary file with Endianness is expressed as big-endian and field PIC.

Open sfuenteRoot opened this issue 2 years ago • 4 comments

we are migrating a process developed in dataStage to scala, using bookshelves. The Copyboock is defined and we manage to read the file in DF with select. But the fields that in the original process we read as binary (Raw) we fail to interpret correctly.

in the DS process, is define like

image this is loaded into a database, converting it to hexadecimal, and we can see it, for example so:

image

but in DF, we do not know how to treat it and we see it like this: image

   .withColumn("CMAVCRPE_P55_TEXT_ori", (col("CMAVCRPE_P55_TEXT")))
   .withColumn("CMAVCRPE_P55_TEXT_hex", hex(col("CMAVCRPE_P55_TEXT")))

image Then, we think that we are not performing the reading correctly and that bits are lost.

image Thank you

sfuenteRoot avatar May 30 '23 10:05 sfuenteRoot

The schema print:

| | | |-- CMAVCRPE_P55: struct (nullable = true) | | | | |-- CMAVCRPE_P55_LEN: integer (nullable = true) | | | | |-- CMAVCRPE_P55_TEXT: string (nullable = true)

But i want to change to binary, like:

image

sfuenteRoot avatar May 30 '23 12:05 sfuenteRoot

It seems that the new feature that is not released yet could help here. https://github.com/AbsaOSS/cobrix/issues/624

You can try it out by building the master branch, or by waiting a few days when the release is planned.

The fields that you want to be 'raw' the pic should look like this:

   09.  ZMAVCRPE_P55_TEXT  PIC X(63) COMP.

(note 'COMP')

yruslan avatar May 30 '23 12:05 yruslan

Thank you, for your prompt reply. We look forward to the deployment of the next version.

sfuenteRoot avatar Jun 01 '23 09:06 sfuenteRoot

2.6.8 is released. You can define binary fields as above (PIC X(63) COMP.)

yruslan avatar Jun 02 '23 06:06 yruslan