-
Notifications
You must be signed in to change notification settings - Fork 78
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
Packed-Decimal columns help required in outgoing EBCDIC file #628
Comments
Packed decimals are supported by Cobrix when such fields have As you said, Cobrix does not support writing to ebcdic files, but maybe the source code of teh decoder can help you encode them: cobrix/cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/decoders/BCDNumberDecoders.scala Line 30 in 6f66bf5
Example: 10 SOME-FIELD PIC S9(4) USAGE IS COMP-3. Further documentation: |
Hi, Thanks for your reply. below are sequence of steps am doing to create EBCDIC file for the above header
Issue is around COMP-3 columns - I am currently using below UDF to pack comp-3 and storing in BinaryType() column in a dataframe. As data is already converted, should i need to encode to 'CP037'? I tried but no luck If it is not right, please help me with sequence steps to convert to COMP-3 and encoding to ebcdic (Cp037) For example: def pack_number(n):
Regards, |
Hi @ManojKolisetty-git , sorry for the late response. COMP-3 fields should not be encoded in CP037 nor any other encodings. Encodings are for string and numerics in DISPLAY format only. COMP-3 defines representation of numbers encoding-agnostic. Did the code above worked an the end to create COMP-3 fields? |
Background [Optional]
Hi,
I have requirement to create outgoing EBCDIC file (fixed width) with header, detail and footer records of length 155 bytes. I am aware that cobrix dont support writing to EBCDIC using copybooks hence I am writing dataframe to TEXT and encoding to CP037.
Question
In my copybook (file spec) there are few columns with Packed-Decimal. I am trying to understand how numeric data can be converted into packed decimal before encoding to Cp037.
Attribute Name = File Date
Format = S9(07) Packed Decimal (This field indicates the file creation date. The date format is Julian (YYYYDDD))
Length = 4
I tried converting to binary and populated in file but not working when reading back using cobrix (pyspark). Please help with some examples of converting to packed decimal.
For testing I am trying to create outgoing EBCDIC file and read it using cobrix in pyspark. Below is the copybook i created for reading header
The text was updated successfully, but these errors were encountered: