Numeric data, array elements or character strings are read from a specified source and the values are assigned to target variables. If the target variable is numeric, ASCII character data is converted to numeric by an internal number builder. The number builder ignores blanks and leading non-numeric characters and terminates on the first character received with EOI true or on the first non-numeric character. Arrays are entered in row major order using the full array specifier, "(*)".
String items are terminated with either a LF (line-feed) , a CRLF (carriage-return/line-feed), an EOI signal, or after filling the dimensioned length of the string. The LF or CRLF characters are not entered into the string.
Complex numbers are entered in rectangular form, real part first, followed by imaginary part. The two parts should be separated by EOI or by a non-numeric character.
Sources
File. Files opened with ASSIGN are accessed by their I/O path (i.e. @Fil_nam) assigned as the source. All files may be accessed either sequentially, or randomly by including a record number.
By default, regular Windows files are accessed as binary (FORMAT OFF), unless the file type has been set to ASCII or the format is explicitly set to ASCII with the FORMAT ON option so that BDAT and regular files are also read as ASCII. With FORMAT OFF (the default), BDAT and regular files are accessed in their internal (binary) format. It is only necessary to use the FORMAT OFF option for back-porting to HP Basic. (See OUTPUT for a description of internal formats).
String. A string may be used as the source. ENTER begins at the beginning of the string and reads serially. Data is assumed to be in FORMAT ON (ASCII) format.
Device. A device-selector (ISC) or I/O path may be used as the source to enter items from a device. The default system attributes are used if the source is a device-selector. The ASSIGN statement determines the attributes used if the source is an I/O path. Use a device selector of 1 (or CRT) for the screen, and 2 (or KBD) for the keyboard. Press the ENTER key to terminate keyboard entry with CRLF. Press the CONTINUE key to terminate an entry without CRLF.
Buffer. You can also ASSIGN a buffer to an I/O path to use as the source. The ASSIGN statement determines the attributes used. The buffer empty pointer points to the beginning of the data to be removed and ENTER ed. The empty pointer is updated as data is ENTERed.
With USING
See IMAGE for a complete explanation of the image list. The items specified in the image list are acted upon as they are encountered. Each image list item should have a matching enter item. Processing of the image list stops when no matching enter item is found. Conversely, the image list is reused starting at the beginning to provide matches for all remaining enter items. FORMAT ON is used with ENTER USING even if FORMAT OFF has been specified.
Records
When entering from a file, you may specify a record number. The first record in the file is record 1. The record size for BDAT files is specified when the file is created and defaults to 256 bytes. For other file types the record size is 1; such that the record number is the offset into the file. The first byte of the file is at offset 1. When a record number is specified and the record size is not 1, an End of Record error or event occurs if ENTER requires more data than a single record.