$PACK and field specifiers
These formats are used in defining fields, in $FORMAT, in the FLD elements of a DEFRECORD and as hex codes, directly in $PACK and $UNPACK.
| Format | $PACK code | Legacy | Purpose |
|---|---|---|---|
| BID | KDB BLOB ID | ||
| BID6 | KDB BLOB ID 6 byte version | ||
| BID8 | KDB BLOB ID 8 byte version | ||
| BLOBSYM | The SYM of a bound database BLOB | ||
| BLOBSYM6 | The SYM of a bound database BLOB, 6 BYTE version | ||
| BLOBSYM8 | The SYM of a bound database BLOB, 8 BYTE version | ||
| BOOL | Numeric boolean with "1" for TRUE and "0" for FALSE | ||
| BOOL_FALSE | Numeric boolean that is always FALSE. Othewise identical to BOOLEAN | ||
| BOOL_SPACE | As Boolean but a space is treated as FALSE rather than error | ||
| CHAR( | Character field (presumed to be UTF-8 encoded) | ||
| CURRENCY( | Currency. For now, identical to NUM. | ||
| DATE | F603 | Julian date | |
| FP | PACK_NUMERIC_VALUE | Internal representation of a KCML number. Use this for SYM values. | |
| HEX( | Binary field | ||
| INT( | Cd0y | Integer (signed) | |
| LANG( | Multi-language string field | ||
| NUM( | Numeric (signed) | ||
| TEXT( | Multiline text field | ||
| TIME | F703 | Time in seconds since midnight | |
| TIMESTAMP | Time stamp in milliseconds since 0000-00-00T00:00:00.000Z held in 6 bytes. Replaces TS6. | ||
| UINT( | Bd0y | Integer (unsigned) | |
| UNUM( | Numeric (unsigned) |
| Format | $PACK code | Legacy | Purpose |
|---|---|---|---|
| B | Bd0y | Y | Unsigned binary format |
| B+ | Cd0y | Y | Signed binary format |
| BLOBSYM | The SYM of a bound database BLOB | ||
| BLOBSYM6 | The SYM of a bound database BLOB, 6 BYTE version | ||
| BLOBSYM8 | The SYM of a bound database BLOB, 8 BYTE version | ||
| BOOL | Numeric boolean with "1" for TRUE and "0" for FALSE | ||
| BOOL_FALSE | Numeric boolean that is always FALSE. Othewise identical to BOOLEAN | ||
| BOOL_SPACE | As Boolean but a space is treated as FALSE rather than error | ||
| BR | Dd0y | Byte swapped (little-endian) unsigned binary format | |
| BR+ | Ed0y | Byte swapped (little-endian) signed binary format | |
| CURRENCY( | Currency. For now, identical to NUM. | ||
| D | 3dxx | IBM display format | |
| DATE | F603 | Julian date | |
| F | 10xx | ASCII free format | |
| FP | PACK_NUMERIC_VALUE | Internal representation of a KCML number. Use this for SYM values. | |
| I | 2dxx | Legacy ASCII integer format | |
| INT( | Cd0y | Integer (signed) | |
| INTERNAL | internal ptr | ||
| M8 | F008 | BASIC-2 internal BCD format | |
| MD3 | FD03 | Three byte packed date of the form YYMMDD | |
| MD4 | FD04 | Four byte packed date of the form CCYYMMDD | |
| METHOD | vtable entry | ||
| MI4 | F304 | IEEE floating point L-H little-endian format | |
| MI8 | F308 | IEEE floating point L-H little-endian format | |
| MJ | F603 | Y | Julian date (replaced by DATE) |
| MM4 | F204 | IEEE floating point H-L big-endian format | |
| MM8 | F208 | IEEE floating point H-L big-endian format | |
| MT | F703 | Y | Time in seconds since midnight (replaced by TIME) |
| MW8 | F008 | Y | BASIC-2 internal BCD format |
| NUM( | Numeric (signed) | ||
| O+ | 7d0y | Packed decimal format with binary overflow | |
| OBJECT_PTR | OBJECT represented as a pool handle | ||
| P | 6dxx | Unsigned packed decimal format | |
| P+ | 5d0y | IBM packed decimal format | |
| POOL | A pool allocating handle | ||
| SY8 | PACK_NUMERIC_VALUE | Y | Internal representation of a KCML number (replaced by FP) |
| TIME | F703 | Time in seconds since midnight | |
| TS4 | Time stamp in seconds since 1970-01-01T0000Z held in 4 bytes | ||
| U | 4dxx | IBM USASCII-8 format | |
| UINT( | Bd0y | Integer (unsigned) | |
| UNUM( | Numeric (unsigned) | ||
| VTABLE | vtable entry | ||
| Vs | Packed decimal format with binary overflow supporting size > 6 bytes | ||
| Vu | Packed unsigned decimal format with binary overflow supporting size > 6 bytes | ||
| W | 8d0y | Wang signed packed decimal format as in PACK | |
| WE | 9d0y | Wang signed packed decimal format with even number of digits | |
| X | Informix money format |
Where:
d = number of implied decimal places
xx = field width in binary (xx > 0)
y = field width in binary (0 < y < +6)
| Format | $PACK code | Legacy | Purpose |
|---|---|---|---|
| BID | KDB BLOB ID | ||
| BID6 | KDB BLOB ID 6 byte version | ||
| BID8 | KDB BLOB ID 8 byte version | ||
| CHAR( | Character field (presumed to be UTF-8 encoded) | ||
| HEX( | Binary field | ||
| INIT_TYPED_PTR | Record string represented as a pool handle allocated in initialisation | ||
| LANG( | Multi-language string field | ||
| MB | FA01 | Y | Legacy boolean with "Y" for TRUE and "N" for FALSE |
| PTR | String represented as a pool handle | ||
| TEXT( | Multiline text field | ||
| TIMESTAMP | Time stamp in milliseconds since 0000-00-00T00:00:00.000Z held in 6 bytes. Replaces TS6. | ||
| TS6 | Y | Time stamp in milliseconds since 0000-00-00T00:00:00.000Z held in 6 bytes. Replaced by TIMESTAMP. | |
| TYPED_PTR | Record string represented as a pool handle |
Where:
d = number of implied decimal places
xx = field width in binary (xx > 0)
y = field width in binary (0 < y < +6)
These are not available for fields.
| Format | $PACK code | Legacy | Purpose |
|---|---|---|---|
| int_t | Equivalent to C type signed int | ||
| uint_t | Equivalent to C type unsigned int | ||
| int8_t | Equivalent to C type signed char | ||
| uint8_t | Equivalent to C type unsigned char | ||
| int16_t | Equivalent to C type signed short | ||
| uint16_t | Equivalent to C type unsigned short | ||
| int32_t | Equivalent to C type int | ||
| uint32_t | Equivalent to C type unsigned | ||
| int64_t | Equivalent to C type int64 | ||
| uint64_t | Equivalent to C type uint64 | ||
| ptr_t | Equivalent to C type PTRWORD | ||
| BASE64 | BASE64 encoding | ||
| BID | KDB BLOB ID | ||
| BID6 | KDB BLOB ID 6 byte version | ||
| BID8 | KDB BLOB ID 8 byte version | ||
| BITS( | Count set bits in a string | ||
| BLOBSYM | The SYM of a bound database BLOB | ||
| BLOBSYM6 | The SYM of a bound database BLOB, 6 BYTE version | ||
| BLOBSYM8 | The SYM of a bound database BLOB, 8 BYTE version | ||
| BOOL | Numeric boolean with "1" for TRUE and "0" for FALSE | ||
| BOOL_FALSE | Numeric boolean that is always FALSE. Othewise identical to BOOLEAN | ||
| BOOL_SPACE | As Boolean but a space is treated as FALSE rather than error | ||
| CHAR( | Character field (presumed to be UTF-8 encoded) | ||
| CURRENCY( | Currency. For now, identical to NUM. | ||
| HEX( | Binary field | ||
| INIT_TYPED_PTR | Record string represented as a pool handle allocated in initialisation | ||
| INTERNAL | internal ptr | ||
| LANG( | Multi-language string field | ||
| META | METAPHONE phoneme encoding | ||
| METHOD | vtable entry | ||
| NUM( | Numeric (signed) | ||
| OBJECT_PTR | OBJECT represented as a pool handle | ||
| POOL | A pool allocating handle | ||
| PTR | String represented as a pool handle | ||
| SNDX | SOUNDEX encoding | ||
| TEXT( | Multiline text field | ||
| TIMESTAMP | Time stamp in milliseconds since 0000-00-00T00:00:00.000Z held in 6 bytes. Replaces TS6. | ||
| TS4 | Time stamp in seconds since 1970-01-01T0000Z held in 4 bytes | ||
| TS6 | Y | Time stamp in milliseconds since 0000-00-00T00:00:00.000Z held in 6 bytes. Replaced by TIMESTAMP. | |
| TYPED_PTR | Record string represented as a pool handle | ||
| UNUM( | Numeric (unsigned) | ||
| URL | URL encoding | ||
| UTF-16 | UTF-16, UCS-2 or Unicode encoding | ||
| UTF-16+ | UTF-16, UCS-2 or Unicode encoding, with XML encoding | ||
| UTF-16BE | UTF-16, UCS-2 or Unicode encoding, big-endian | ||
| UTF-16BE+ | UTF-16, UCS-2 or Unicode encoding, big-endian, with XML encoding | ||
| UTF-16LE | UTF-16, UCS-2 or Unicode encoding, little-endian | ||
| UTF-16LE+ | UTF-16, UCS-2 or Unicode encoding, little-endian, with XML encoding | ||
| UTF-32 | UTF-32 or UCS-4 encoding | ||
| UTF-32+ | UTF-32 or UCS-4 encoding with XML encoding | ||
| UTF-32BE | UTF-32 or UCS-4 encoding, big-endian | ||
| UTF-32BE+ | UTF-32 or UCS-4 encoding, big-endian, with XML encoding | ||
| UTF-32LE | UTF-32 or UCS-4 encoding, little-endian | ||
| UTF-32LE+ | UTF-32 or UCS-4 encoding, little-endian, with XML encoding | ||
| UTF-8 | UTF-8 encoding | ||
| UTF-8+ | UTF-8 and XML encoding | ||
| VTABLE | vtable entry | ||
| Vs | Packed decimal format with binary overflow supporting size > 6 bytes | ||
| Vu | Packed unsigned decimal format with binary overflow supporting size > 6 bytes | ||
| X | Informix money format | ||
| XML | XML entity encoding format |
| Format | $PACK code | Legacy | Purpose |
|---|---|---|---|
| A | A000 | Y | Alphanumeric format |
| A( | A000 | Y | Alphanumeric multi-language format |
| B | Bd0y | Y | Unsigned binary format |
| B+ | Cd0y | Y | Signed binary format |
| BR | Dd0y | Byte swapped (little-endian) unsigned binary format | |
| BR+ | Ed0y | Byte swapped (little-endian) signed binary format | |
| C | A100 | Compressed alphanumeric format | |
| D | 3dxx | IBM display format | |
| DATE | F603 | Julian date | |
| F | 10xx | ASCII free format | |
| FP | PACK_NUMERIC_VALUE | Internal representation of a KCML number. Use this for SYM values. | |
| I | 2dxx | Legacy ASCII integer format | |
| INT( | Cd0y | Integer (signed) | |
| M8 | F008 | BASIC-2 internal BCD format | |
| MB | FA01 | Y | Legacy boolean with "Y" for TRUE and "N" for FALSE |
| MD3 | FD03 | Three byte packed date of the form YYMMDD | |
| MD4 | FD04 | Four byte packed date of the form CCYYMMDD | |
| MI4 | F304 | IEEE floating point L-H little-endian format | |
| MI8 | F308 | IEEE floating point L-H little-endian format | |
| MJ | F603 | Y | Julian date (replaced by DATE) |
| MM4 | F204 | IEEE floating point H-L big-endian format | |
| MM8 | F208 | IEEE floating point H-L big-endian format | |
| MT | F703 | Y | Time in seconds since midnight (replaced by TIME) |
| MW8 | F008 | Y | BASIC-2 internal BCD format |
| O+ | 7d0y | Packed decimal format with binary overflow | |
| P | 6dxx | Unsigned packed decimal format | |
| P+ | 5d0y | IBM packed decimal format | |
| SKIP | 00xx | Skip field | |
| SY8 | PACK_NUMERIC_VALUE | Y | Internal representation of a KCML number (replaced by FP) |
| TIME | F703 | Time in seconds since midnight | |
| U | 4dxx | IBM USASCII-8 format | |
| UINT( | Bd0y | Integer (unsigned) | |
| W | 8d0y | Wang signed packed decimal format as in PACK | |
| WE | 9d0y | Wang signed packed decimal format with even number of digits |
Where:
d = number of implied decimal places
xx = field width in binary (xx > 0)
y = field width in binary (0 < y < +6)
| $PACK spec | format | Deprecated | Purpose |
|---|---|---|---|
| 00xx | SKIP | Skip field | |
| 10xx | F | ASCII free format | |
| 2dxx | I | Legacy ASCII integer format | |
| 3dxx | D | IBM display format | |
| 4dxx | U | IBM USASCII-8 format | |
| 5d0y | P+ | IBM packed decimal format | |
| 6dxx | P | Unsigned packed decimal format | |
| 7d0y | O+ | Packed decimal format with binary overflow | |
| 8d0y | W | Wang signed packed decimal format as in PACK | |
| 9d0y | WE | Wang signed packed decimal format with even number of digits | |
| A000 | A | Y | Alphanumeric format |
| A000 | A( | Y | Alphanumeric multi-language format |
| A100 | C | Compressed alphanumeric format | |
| Bd0y | B | Y | Unsigned binary format |
| Bd0y | UINT( | Integer (unsigned) | |
| Cd0y | B+ | Y | Signed binary format |
| Cd0y | INT( | Integer (signed) | |
| Dd0y | BR | Byte swapped (little-endian) unsigned binary format | |
| Ed0y | BR+ | Byte swapped (little-endian) signed binary format | |
| F008 | M8 | BASIC-2 internal BCD format | |
| F008 | MW8 | Y | BASIC-2 internal BCD format |
| F108 | MN | BASIC-2C internal format | |
| F204 | MM4 | IEEE floating point H-L big-endian format | |
| F208 | MM8 | IEEE floating point H-L big-endian format | |
| F304 | MI4 | IEEE floating point L-H little-endian format | |
| F308 | MI8 | IEEE floating point L-H little-endian format | |
| F603 | MJ | Y | Julian date (replaced by DATE) |
| F603 | DATE | Julian date | |
| F703 | MT | Y | Time in seconds since midnight (replaced by TIME) |
| F703 | TIME | Time in seconds since midnight | |
| FA01 | MB | Y | Legacy boolean with "Y" for TRUE and "N" for FALSE |
| FD03 | MD3 | Three byte packed date of the form YYMMDD | |
| FD04 | MD4 | Four byte packed date of the form CCYYMMDD | |
| PACK_NUMERIC_VALUE | SY8 | Y | Internal representation of a KCML number (replaced by FP) |
| PACK_NUMERIC_VALUE | FP | Internal representation of a KCML number. Use this for SYM values. |