B: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
Line 35: Line 35:


===See Also===
===See Also===
The letter B can also be used as a [[Attribute (Screen)|screen attribute]] in the category, [[:Category:Field Specifications|field specifications]].
The letter B can also be used as a [[Attribute (Screen)|screen attribute]] for string or numeric values. See the category, [[:Category:Field Specifications|field specifications]].


<noinclude>
<noinclude>
[[Category:Format Specifications]]
[[Category:Format Specifications]]
</noinclude>
</noinclude>

Revision as of 14:42, 7 August 2013

The B (binary) format specification is used for fast and efficient internal numeric storage. Binary format is machine specific. There are two types: BH stores the most significant byte first, and BL stores the least significant byte first. B format defaults to BH or BL, whichever is the native format of the hardware. When portability is desired, BH or BL should be used. When speed is desired, B should be used. In general, systems that utilize Intel chips will use a native format of BL, and those that don't will use BH. The following chart indicates the format native to several hardware/operating system combinations:

COMPUTER NATIVE FORMAT
AT&T with UNIX BH
IBM PC, XT, AT, with DOS BL
IBM AT with LINUX BL
NCR Tower with UNIX BH

The field length for a B-formatted number can be 1, 2, 3 or 4. The value range for each field length is as follows:

FIELD VALUE
LENGTH RANGE
1 + / - 127
2 + / - 32, 767
3 + / - 8, 388,607
4 + / - 2, 147, 483, 647


Technical Considerations

1.) As with ZD and PD, the decimal point is implied for B format specifications; it is not stored with the number. To retrieve the same number as was written, the same format specification must be used. Reading a field with a B 4 that was written with a B 4.2 results in a number 100 times larger than was written. The number is rounded to the specified number of decimal positions before writing.

See Also

The letter B can also be used as a screen attribute for string or numeric values. See the category, field specifications.