comp-3

Decoding COMP-3 packed fields in an ASCII file in Python?

跟風遠走 提交于 2020-06-12 09:37:14
问题 I have a file that was formerly an EBCDIC-encoded file, which was converted to ASCII using dd. However, some lines contain COMP-3 packed fields which I would like to read. For example, the string representation of one of the lines I would like to decode is: '15\x00\x00\x00\x04@\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x0c777093020141204NNNNNNNNYNNNN\n' The field I would like to read is specified by PIC S9(09) COMP-3 POS. 3 , that is, the field that starts with the third byte and is nine bytes long

COBOL COMP-3 number format issue

别来无恙 提交于 2020-01-16 05:38:07
问题 I have a cobol "tape format" dump which has a mixture of text and number fields. I'm reading the file in C# as a binary array (array of byte). I have the copy book and the formats are lining up fine on the text fields. There are a number of COMP-3 fields as well. The data in those fields doesnt seem to match any BCD format. I know what the data should be and I have the raw bytes of the COMP-3. I tried converting to EBCDIC first which yielded no better results. Any thoughts on how a COMP-3

Is there an existing gem or script that converts numbers to comp-3/packed decimal format?

巧了我就是萌 提交于 2019-12-11 02:46:14
问题 Continuing with my adventure to convert COBOL to a Ruby program, I have to convert a decimal digit to a comp-3/packed decimal format. Anyone know of a simple Ruby script or gem that does this? Berns 回答1: Ruby knows how to pack nibbles, so it turns out to be quite easy: def pack_comp(n) s = n.abs.to_s + (n < 0 ? "d" : "c") s = "0" + s if s.size.odd? [s].pack("H*") end 来源: https://stackoverflow.com/questions/2623997/is-there-an-existing-gem-or-script-that-converts-numbers-to-comp-3-packed

SQL How to get COMP-3 Packed Decimal?

强颜欢笑 提交于 2019-12-11 02:08:01
问题 I am creating an ASCII output file contain some information and two of my fields require the date and time to be in packed decimal fields (COMP-3). I am using SQL and SSIS to generate my file. Field Name Format Length Picture Date YYYYMMDD 5 S9(8) C-3 Time HHMMSS 4 S9(6) C-3 I have searched multiple sites and I still can't figure out how to convert a date/time into a packed decimal field. Any help would be greatly appreciated. The following site http://www.simotime.com/datapk01.htm

Interpreting COMP-3 Packed Decimal Fields into numeric values

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 14:27:38
问题 I am creating an SSIS package to read in unpacked data from a series of copybook files. I am unsure of the correct interpretation of the following field definitions and was hoping someone would know: FIELD-NAME-1 PIC S9(15)V9(3) COMP-3. FIELD-NAME-2 PIC S9(3)V9(8) COMP-3. FIELD-NAME-3 PIC S9(3)V9(6) COMP-3. The data is stored in fixed width text. The data for the above fields has the following lengths: FIELD-NAME-1: 19 FIELD-NAME-2: 11 FIELD-NAME-3: 9 I am unsure how to interpret the decimal

Unable to unpack comp 3 to numeric in java

≯℡__Kan透↙ 提交于 2019-12-04 05:54:42
问题 I referred a code on the internet to unpack comp 3 to numeric in java. I tried to pass a sample comp3 file to the code but I didn't get the proper unpacked data. I got some weird numbers. I am new to this concept(comp 3) so can you guys help me on this. Thanks in advance Below is my code import java.math.BigInteger; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /** * Converts between integer and an array of bytes in IBM mainframe packed * decimal format.

Converting COMP-3 columns in Mainframes to readable format using Record Editor tool

为君一笑 提交于 2019-12-02 17:07:37
问题 This is the file which we received as Binary from Mainframes which includes COMP-3 columns as well along with other columns And when we tried loading this Binary file into Record Editor, It is displaying Special Characters Kindly let us know step by step process from Starting to Ending on How to process COMP-3 columns and load into Record Editor. 回答1: So what have you tried ???, In the last question I suggested: You will have to update RecordEditor/JRecord The font will need to be ebcdic

C#: Convert COMP-3 Packed Decimal to Human-Readable Value

给你一囗甜甜゛ 提交于 2019-11-29 14:50:23
问题 I have a series of ASCII flat files coming in from a mainframe to be processed by a C# application. A new feed has been introduced with a Packed Decimal (COMP-3) field, which needs to be converted to a numerical value. The files are being transferred via FTP, using ASCII transfer mode. I am concerned that the binary field may contain what will be interpreted as very-low ASCII codes or control characters instead of a value - Or worse, may be lost in the FTP process. What's more, the fields are

COMP-3 data unpacking in Java (Embedded in Pentaho)

做~自己de王妃 提交于 2019-11-28 10:00:27
问题 We are facing a challenge in reading the COMP-3 data in Java embedded inside Pentaho ETL. There are few Float values stored as packed decimals in a flat file along with other plain text. While the plain texts are getting read properly, we tried using Charset.forName("CP500"); , but it never worked. We still get junk characters. Since Pentaho scripts doesn't support COMP-3, in their forums they suggested to go with User Defined Java class . Could anyone help us if you have come across and