Questions tagged [comp-3]

A convention for storing numerals, one per half-byte, with the final half-byte being an indicator of the sign. Common values for the sign are C (positive) D (negative) and F (unsigned, treated as positive).

A convention for storing numerals, one per half-byte, with the final half-byte being an indicator of the sign. Common values for the sign are C (positive) D (negative) and F (unsigned, treated as positive). Rare, but possible, other values for the sign are A (positive), B (negative) and E positive.

See BCD for what looks like a packed-decimal, but only containing numerals (no signs).

31 questions
7
votes
2 answers

Unpacking EBCDIC Packed Decimals (COMP-3) in an ASCII Conversion

I am using Jon Skeet's EBCDIC implementation in .NET to read a VSAM file downloaded in binary mode with FTP from a mainframe system. It works very well for reading/writing in this encoding, but it does not have anything to read packed-decimal…
Josh Stodola
  • 81,538
  • 47
  • 180
  • 227
6
votes
8 answers

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

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…
tsilb
  • 7,977
  • 13
  • 71
  • 98
5
votes
5 answers

Interpreting COMP-3 Packed Decimal Fields into numeric values

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)…
Ham
4
votes
2 answers

Cobol COMP-3 value changes after write to dataset

SOLVED I found this line buried much past where I am moving these values to the output file: INSPECT OUT-RECORD REPLACING ALL X'00' BY ' ' changing my X'00' to X'40', which is where I'm getting the mysterious '4'. I will attribute this to my…
J.Turner
  • 43
  • 6
3
votes
3 answers

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

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…
user3873438
  • 125
  • 1
  • 5
2
votes
1 answer

SQL How to get COMP-3 Packed Decimal?

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 …
buzzzzjay
  • 1,140
  • 6
  • 27
  • 54
2
votes
2 answers

DISPLAY in COBOL of Signed Comp-3 Data shows unexpected output

Theoretically, I studied like the end of character in comp-3 tells whether it is positive or negative value C - Indicates positive value D - Indicates negative value Is this not applicable for new version of COBOL in mainframes? 01 WS-COMP3 PIC…
Lakshanth C
  • 95
  • 2
  • 9
2
votes
1 answer

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

I'm starting a new adventure to convert COBOL program to a Ruby program, I have to convert a a comp-3/packed decimal format to number. From another previous post, there is code that would convert from a number to comp-3, but not the inverse.
RedNax
  • 1,507
  • 1
  • 10
  • 20
2
votes
1 answer

how to convert decimal to Packed decimal/COMP-3

I need convert some decimal to PD6.2, then send it to Mainframe. It's very hard to find any function in C#. please help. Thanks a million
Mike Long
  • 363
  • 4
  • 16
2
votes
1 answer

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

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…
Guru
  • 43
  • 2
  • 6
2
votes
1 answer

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

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
btelles
  • 5,390
  • 7
  • 46
  • 78
2
votes
5 answers

COBOL COMP-3 number format issue

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…
Shaun Neal
  • 1,183
  • 1
  • 10
  • 12
1
vote
1 answer

Converting unpacked Packed Decimal Comp-3 data into doubles

I have a fixed width text file, which has been unpacked from Comp-3 data into fixed width strings. I need to know how to interpret the following fields: FIELD-NAME-1 PIC S9(15)V9(3) COMP-3. FIELD-NAME-2 PIC S9(3)V9(8) COMP-3. FIELD-NAME-3 PIC…
Ham
1
vote
1 answer

S0C7 while moving PIC 9(11) COMP-3 to PIC 9(11)

I'm moving a field which is in PIC 9(11) COMP-3 coming from an INPUT file to PIC 9(11). I'm getting S0C7 error or ABEND Bellow is my code: 10 FIELD-FROM PICTURE 9(11) OCCURS 012 TIMES COMPUTATIONAL-3. 01 FIELD-TO PICTURE…
Ahmed SEDDIK
  • 149
  • 12
1
vote
1 answer

Having trouble unpacking Comp-3 in .Net. There are letter characters aside from sign character inside Comp-3 value

I am trying to import a Mainframe EDI File back to SQL Server using .NET and I am having problems unpacking some comp-3 fields. This file was from one of our clients and I have the Copy Book layout for the following fields: 05 EH-GROSS-INVOICE-AMT …
Sirch Dcmp
  • 147
  • 1
  • 9
1
2 3