Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are Packed Decimal fields and Zoned Decimal fields in COBOL?

0
Posted

What are Packed Decimal fields and Zoned Decimal fields in COBOL?

0

Packed Decimal: Packed Decimal is also called as COMP-3, Computational-3. In packed decimal, sign is stored separately as the hex value in the last nibble(4 bits) of the storage. COBOL Comp-3 is a binary field type that puts (“packs”) two digits into each byte, using a notation called Binary Coded Decimal, or BCD. This halves the storage requirements compared to a character, or COBOL “display”, field. Comp-3 fields are denoted as : PIC S9(5) comp-3. Example to show the bytes reserved: PIC S9(7) COMP-3. Byte size = (7 + 1) / 2 = 4 PIC S9(5)V99 COMP-3. Byte size = (5 + 2 + 1) / 2 = 4 PIC 9(7) COMP-3. Byte size = (7 + 1) / 2 = 4 Zoned Decimal: As a default, sign is over punched with the numeric value stored in the last bite.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.