Browse Prior Art Database

NLS Translation of Zoned Decimal Fields

IP.com Disclosure Number: IPCOM000109936D
Original Publication Date: 1992-Sep-01
Included in the Prior Art Database: 2005-Mar-24
Document File: 1 page(s) / 36K

Publishing Venue

IBM

Related People

Trojacek, LA: AUTHOR

Abstract

Disclosed is a program that will convert zoned decimal fields from EBCDIC to ASCII and vice-versa.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 100% of the total text.

NLS Translation of Zoned Decimal Fields

      Disclosed is a program that will convert zoned decimal fields
from EBCDIC to ASCII and vice-versa.

      The zoned decimal byte consists of 4 bits that represent the
zone portion (the right half of a byte) and 4 bits that represent the
numeric portion (the left half of a byte).  The zone portion of the
last byte of a zoned decimal number represents the sign of the
number.  For a zoned decimal number each byte must be converted from
ASCII to EBCDIC, or vice-versa, and the sign bits must be converted
accordingly.

      The disclosed program accepts an input and output codepage and
understands the conversion rules for zoned decimal numbers from
EBCDIC to ASCII and vice-versa.  If the supplied codepages are
different the conversion would be performed.  The conversion would
convert each byte from ASCII to EBCDIC, or vice-versa, except for the
first 4 bits (right side) of the last byte (right side) which is
changed as follows:
Hexadecimal 'B' (if negative and output codepage is ASCII).
Hexadecimal '3' (if positive and output codepage is ASCII).
Hexadecimal 'D' (if negative and output codepage is EBCDIC).
Hexadecimal 'C' (if positive and output codepage is EBCDIC).

      An EBCDIC 123 is stored as 'F0F0F1F2C3' with an ASCII 123 being
stored as 'C0C0C1C233'.

      Disclosed anonymously.