DEC

Synopsis

HELP:   Date decimal value as binary integer (COMP/COMP-5, e.g. 20260428)
TYPE:   OBJECT
SYNTAX: DEC(ENDIAN=SYSTEM/BIG/LITTLE/LOCAL,SIZE=num,PATTERN='str')

Description

Reads the date field as a decimal value stored in a binary integer (COBOL COMP/COMP-5).

The integer holds the date in its decimal representation: for example the 4-byte big-endian integer 0x01354B8C (= 20260428 decimal) with PATTERN='YYYYMMDD' yields the date 2026-04-28. This is the layout produced by COBOL

05 ORDER-DATE PIC 9(8) BINARY. 05 ORDER-DATE PIC 9(8) COMP-5.

ENDIAN selects the byte order: BIG -- most-significant byte first (default on IBM mainframe) LITTLE -- least-significant byte first (x86 native) SYSTEM -- platform native byte order (default)

SIZE specifies the field width in bytes: 2, 4, or 8. The default is 4.

The optional PATTERN parameter specifies the decimal digit layout (e.g. PATTERN='YYYYMMDD'). When omitted, the format is auto-detected from the digit count of the decimal value.

Arguments