Transferring Data to BASIC Random Files
When you create a BASIC random file, system data changes as follows:
- Hexadecimal fields do not change.
- Change from a system binary field depends on the field length:
- Fields of 2 bytes, with no decimal positions to the right of the decimal point, change to 2-byte BASIC integer values. The only change is that the order of the bytes reverses.
- Fields of 2 bytes, with decimal positions to the right of the decimal point, change to BASIC single-precision numbers.
- Fields of 4 bytes change to BASIC double-precision numbers.
- EBCDIC character, date, time, and time-stamp fields change byte by byte and are mapped into ASCII characters as defined by the translation tables.
- Variable-length and null fields are converted to fixed lengths, and trailing blanks (for character, hexadecimal, date, time, and time-stamp data) or zeros (for binary, zoned, and packed data) are added to the maximum length of the field.
- Zoned decimal fields change into one of the following BASIC variables
depending on the field length and the number of decimal positions:
- Zoned decimal fields of 4 bytes or less with no positions to the
right of the decimal point change to a BASIC integer of an equivalent
value.
A zoned decimal field of 4 bytes or less, but with a decimal point, falls into the following category.
- Zoned decimal fields up to 7 bytes (including those that did not fall into the previous category) change to a BASIC single-precision number of an equivalent value.
- Zoned decimal fields greater than 7 bytes change to a BASIC double-precision number of an equivalent value.
- Zoned decimal fields of 4 bytes or less with no positions to the
right of the decimal point change to a BASIC integer of an equivalent
value.
- Packed decimal fields change into one of the following BASIC variables
depending on the length of the field:
- Packed decimal fields of 2 bytes or less with no positions to
the right of the decimal point change to a BASIC integer of an equivalent
value.
A packed decimal field of 2 bytes or less, but with a decimal point, falls into the following category (up to 4 bytes).
- Packed decimal fields of up to 4 bytes (including those that did not fall into the previous category) change to a BASIC single-precision number of an equivalent value.
- Packed decimal fields greater than 4 bytes change to a BASIC double-precision number of an equivalent value.
Note: Changes between binary, packed decimal, and zoned decimal numbers with decimal points are not equivalent to their BASIC number counterparts, because BASIC uses a binary number format that does not always change into exact decimal fractions. - Packed decimal fields of 2 bytes or less with no positions to
the right of the decimal point change to a BASIC integer of an equivalent
value.