Questions tagged [packed-decimal]

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).

39 questions
8
votes
2 answers

C# encoding a file in EBCDIC with packed decimals

I have to prepare a file for an outside entity, and this entity uses an IBM mainframe with COBOL and requires the file to be encoded in EBCDIC. I am creating the file in C#. I guess this is a two-part question...firstly, is the code below sufficient…
Matt
  • 83
  • 1
  • 3
8
votes
4 answers

How to unpack COMP-3 digits using Java?

I have huge mainframe file and there are some packed digits in that file. I would like to know how to unpack following digit using java? packed digit : ? I read tutorials for unpacking digits and found the following rule to count the number of bytes…
Shekhar
  • 11,438
  • 36
  • 130
  • 186
5
votes
3 answers

How to convert unpacked decimal back to COMP-3?

I had asked a question about converting COMP fields, for which I did not get any answer. I hope stack-overflow can help me on this question. I succeeded in converting COMP-3 to decimal. I need your help in converting the unpacked decimal back to…
Krishna Kumar N
  • 137
  • 2
  • 13
4
votes
2 answers

How to unpack COMP digits using Java?

I had found this useful link for unpacked COMP-3 digit, but i need to unpack COMP digit this time, is anyone know how to unpack it? Thanks a lot!
Michael Ouyang
  • 1,767
  • 1
  • 11
  • 19
4
votes
3 answers

Most efficient formula for unpacking 16-bit BCD? (e.g. 0x1234 to 0x01020304)

Is there a bit twiddling hack for efficiently unpacking a 16-bit packed BCD number? Doing it the pedestrian way requires 10 operations (3 shifts, 4 ANDs and 3 ORs or ADDs): x = (bcd & 0xF000) << 12 | (bcd & 0x0F00) << 8 | (bcd & 0x00F0) << 4 …
DarthGizka
  • 4,347
  • 1
  • 24
  • 36
4
votes
2 answers

Unpack Mainframe packed Decimal (BCD) with PHP

I got an data file from a mainframe. I handled already the EBCDIC conversion to latin1 with PHP. But now are this packed decimal fields left. For examle the number 12345 is packed into 3 Bytes and looks like: x'12345C' Negative would be like:…
Andi S.
  • 317
  • 1
  • 11
3
votes
4 answers

WRBTR field calculation inside CASE throws error for max decimal places

I have following select: SELECT FROM bseg LEFT JOIN aufk ON ( ltrim( aufk~aufnr, '0' ) = bseg~zuonr ) JOIN bkpf ON bkpf~belnr = bseg~belnr AND bkpf~gjahr = bseg~gjahr AND bkpf~bukrs = bseg~bukrs FIELDS bseg~bukrs, bseg~bschl, bseg~wrbtr,…
schmelto
  • 427
  • 5
  • 18
3
votes
2 answers

Kotlin - Is there a smart way to throw NotImplementedError for all the methods of a class?

I need to implement an interface (ResultSet) having hundreds of methods. For now, I'm going to implement only a subset of these methods, throwing a NotImplementedError for the others. In Java I found two solutions: Create an abstract class…
3
votes
1 answer

How can I convert a Cobol COMP field output to readable decimal in C#?

In converting a cobol program to C#, I encountered COMP: 03 Var1 PIC X(4). 03 Var2 PIC X(3). 03 Var3 PIC X(3). 03 Var4 PIC X(4). 03 Var5 PIC…
JinC
  • 33
  • 1
  • 7
3
votes
4 answers

How can I use SYNCSORT to format a Packed Decimal field with a specifc sign value?

I want to use SYNCSORT to force all Packed Decimal fields to a negative sign value. The critical requirement is the 2nd nibble must be Hex 'D'. I have a method that works but it seems much too complex. In keeping with the KISS principle, I'm…
MikeC
  • 408
  • 2
  • 4
  • 9
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
4 answers

How can I have Packed decimal and normal text in a single file?

I need to generate a fixed width file with few of the columns in packed decimal format and few of the columns in normal number format. I was able to generate. I zipped the file and passed it on to the mainframe team. They imported it and unzipped…
SJoe
  • 319
  • 2
  • 6
  • 14
2
votes
2 answers

Define returning type as packed number for method

I am learning ABAP Objects. I'd like to have an object method returning packed number type. I've made that working finally, but I don't know if it is the correct way and I'd need some further explanation which I can't find online. For integer, it…
jcjr
  • 1,503
  • 24
  • 40
2
votes
1 answer

Unpacked Decimal Format in x86 Assembly bugs when Addition is above 15

const char* p = rhs.digits; //temp pointer to rhs.digits. char* q = digits; //temp to just digits _asm { mov EAX, 0 //clear register for addition mov ESI, p //point to rhs.digits mov EDI, q …
Matt
  • 85
  • 6
2
votes
4 answers

Unpacking COMP-3 digit using Java

I have a file with some COMP-3 encoded fields. Can someone please tell me how do I test this code in below thread ? How to unpack COMP-3 digits using Java? Code I tried is BufferedReader br = new BufferedReader(new FileReader(FILENAME))) { …
Rahul Patel
  • 307
  • 1
  • 9
  • 27
1
2 3