packed decimals

Chapter 1: Introduction

  • Machines store numbers in various formats:
    • Binary
    • Zoned Decimal
    • Packed Decimal Format
    • Floating Point Format (not covered in this class)
  • Importance of Decimal Representation:
    • Decimal points are not stored directly, but are implied when using formats such as binary, zoned decimal, and packed decimal.
    • As assembler developers, it is crucial to track the placement of decimal points during arithmetic operations.
    • We must consider the number of decimal digits to the right of the implied decimal point, which is not stored.
  • Example:
    • Discussion of a hypothetical instance in which a number is typed and processed.

Chapter 2: Printable Printable Versions

  • When processing digits (0-9), they are encoded as follows:
    • 0 is encoded as f0
    • 1 is encoded as f1
    • 9 is encoded as f9
  • All digits and characters typed in programs are saved as exudate (an encoding system), specifically into the assigned PDS (Program Data Structure) member.
  • Characters get processed into a text document form and converted to executable code by the assembler.
  • Example Number: 31720, with an explanation of its representation as a five-digit number with possible leading zeros.

Chapter 3: Meaning Hex Decimal Digit

  • Discusses the notion of an implied decimal point within document contexts:
    • Example: "…implied decimal point right there."
  • Clarification of data types:
    • Even if represented as a character string, a zoned decimal field transforms from character data to a signed numeric value.
    • Definition of Zoned Decimal as a signed numeric value which is equivalent to its epsonic only if it is a positive number.
  • Explanation of the significance of the next to last hex digit known as the sign digit.

Chapter 4: Zoned Decimal Numbers

  • Identification of the sign of the number based on the zone digit:
    • If sign digit = a, c, e, or f, the number is positive.
    • If sign digit = b or anything other than f, it is no longer in epsiodic equivalent but remains a zoned decimal number.
  • While arithmetic can be performed with zoned decimal numbers, the focus is on reading input formatted as zoned decimal, which must be converted before arithmetic operations.
  • Students will take zoned decimal numbers and pack them into storage before conducting calculations.
    • Example: A six-byte zoned decimal field.

Chapter 5: Packed Decimal Field

  • Instructions on how to declare a field:
    • Declare zoned decimal field: a as a six-byte field with an example like 03 17 20 00.
    • Transitioning to packed decimal: b, initialized with zeroes is crucial.
    • Encoding example provided for packed decimal representation, focusing on split between bytes (two digits per byte).

Chapter 6: Packed Decimal Number

  • Description of packed decimal operational details:
    • Size considerations: Each operand length is specified in packed decimal instructions.
    • Mechanism of packing:
    • Takes two digits from zoned decimal representation, removes zone digits and packs them into bytes.
    • The resulting packed value represents the original decimal without the need for hex conversion.
  • Example of decimal 31720 illustrated in packed format:
    • No conversion necessary when looking at the storage directly and understanding its implications related to arithmetic.

Chapter 7: Conclusion

  • Summary of packed decimal utility for arithmetic:
    • Ease of access as numbers are stored in an understandable format directly within storage.
    • Acknowledgment of potential confusion and challenges when working with packed decimal arithmetic.
    • Assurance of further discussions to clarify any uncertainties regarding packed decimal and its applications, especially starting Monday.