Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sfuenteRoot opened this issue May 30, 2023 · 4 comments
Open
Labels
question Further information is requested

Comments

@sfuenteRoot
Copy link

sfuenteRoot commented May 30, 2023

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
Copy link
Author

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

@yruslan
Copy link
Collaborator

yruslan commented May 30, 2023

It seems that the new feature that is not released yet could help here.
#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')

@sfuenteRoot
Copy link
Author

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

@yruslan
Copy link
Collaborator

yruslan commented Jun 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants