BUFTYP Function
The BUFTYP function returns the number that represents the type of the
next item in the input buffer. See the INPUT statement in chapter 4 for
an explanation of the input buffer. The BUFTYP function returns the same
numeric values representing HP Business BASIC/XL data types returned by
the DATATYP and TYP functions (see Table 5-1).
Table 5-1. Numbers Representing Input Data Types
--------------------------------------------------------------------------------------------
| | |
| BUFTYPE | Type of Next Item in |
| Result | DATA Statement or Input |
| | Buffer |
| | |
--------------------------------------------------------------------------------------------
| | |
| 1 | DECIMAL |
| | |
--------------------------------------------------------------------------------------------
| | |
| 2 | Entire string |
| | |
--------------------------------------------------------------------------------------------
| | |
| 4 | End-of-record (EOR) mark |
| | |
--------------------------------------------------------------------------------------------
| | |
| 5 | SHORT INTEGER |
| | |
--------------------------------------------------------------------------------------------
| | |
| 11 | INTEGER |
| | |
--------------------------------------------------------------------------------------------
| | |
| 13 | REAL |
| | |
--------------------------------------------------------------------------------------------
Syntax
BUFTYP
The BUFTYP function determines the type of a numeric datum by its format,
whether it contains a decimal point or is expressed in scientific
notation, its value, and the default numeric type.
Table 5-2 explains how BUFTYP determines the type of a numeric datum.
Table 5-2. Type Assignment by BUFTYP Function
----------------------------------------------------------------------------------------------
| | | |
| Range | Without Decimal Point and | With Decimal Point or |
| | Not Expressed in | Expressed in |
| | Scientific Notation | Scientific Notation |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| [-32768, 32767] | SHORT INTEGER | REAL |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| [-2147483648, 2147483647] | INTEGER | REAL |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Outside integer ranges but inside | REAL | REAL |
| real range | | |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Outside real ranges | DECIMAL | DECIMAL |
| | | |
----------------------------------------------------------------------------------------------
Examples
10 A=BUFTYP !After this call, A will contain the data type of the
20 !next item in the input buffer.