HELP: Date field encoded as BCD zoned or packed decimal (PIC 9) TYPE: OBJECT SYNTAX: BCD(TYPE=UNPACKED/PACKED/ZONED,PATTERN='str')
Reads the date field as binary coded decimal (BCD).
TYPE=ZONED (default) handles PIC 9 DISPLAY fields in which each byte contains one decimal digit in the lower nibble (0x0-0x9) and a zone byte in the upper nibble (typically 0xF on IBM mainframes).
TYPE=PACKED handles PIC 9 COMP-3 fields in which two digits are packed into one byte. The last nibble of the last byte is a sign indicator: 0xC = positive, 0xD = negative, 0xF = unsigned (treat as positive).
The number of packed bytes required is ceil((digits + 1) / 2), where the extra nibble carries the sign. For example, an 8-digit date YYYYMMDD occupies 5 bytes in packed format.
The optional PATTERN parameter specifies the digit layout (e.g. PATTERN='YYYYMMDD'). When omitted, the format is auto-detected from the digit count.
NUMBER: TYPE=UNPACKED/PACKED/ZONED - BCD sub-type: ZONED=zoned decimal (PIC 9 DISPLAY) or PACKED=packed decimal (PIC 9 COMP-3) [ZONED]
UNPACKED - Unpacked BCD numberPACKED - Packed BCD numberZONED - Zoned BCD number