The text of a manual · part 25 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 10 Statement Reference, pages 221 to 230
Pages 221 to 230 of 413, from PDT 1100 Terminal Programmer's Guide
The original document is the PDF (3.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Symbol PDT-1100
Page 221
Statement Reference
PUT Statement Name: Put
Type: File I/O Statement
Description Writes a record from a field variable to a data file.
Syntax PUT [#] filenumber[,recordnumber] where: filenumber = A numeric expression which returns a value from 1 to 16. recordnumber = A numeric expression which returns a value from 1 to
32,767.
Notes PUT writes a record from a field variable(s) declared by the FIELD statement to a data file specified by filenumber. !
filenumber is the number of a data file opened by the OPEN statement.
!
recordnumber is the record number where the data is to be placed in a data file, within the range of 1 to the maximum number of registrable records (filelength) specified by the OPEN statement (when a new data file is created).
!
If recordnumber option is omitted, the default record number is one more than the last record written. Record numbers to be specified do not have to be continuous. If you specify record number 10 when records 1 through 7 have been written, for example, the PUT instruction creates records 8 and 9 filled with spaces and then writes data to record 10. If the actual data length of a field variable is longer than the field width specified by the FIELD statement, the excess is truncated from the right end column. Since data in a data file is treated as text (ASCII strings), numeric data should be converted into the proper string form with the STR$ function before being assigned to a field variable.
!
!
!
10-111
Page 222
PDT 1100 Terminal Programmer’s Guide
!
The PUT statement cannot write data to files stored in the flash ROM (B:).
Syntax Error Error Code and Message Meaning error 71: Syntax error filenumber is missing.
Execution Error Error Code
Meaning
05h
Parameter out of range (either filenumber or recordnumber is out of range.)
07h
Insufficient memory space.
34h
Bad file name or number (filenumber of an unopened file specified.)
36h
Improper file type (filenumber of a file other than communications device files specified.)
3Eh
A PUT instruction executed without a FIELD instruction.
41h
File damaged.
42h
File write error (writing onto a read-only file attempted.)
43h
Not allowed to access data in flash ROM.
Reference Statements
10-112
OPEN and GET
Page 223
Statement Reference
READ Statement Name: Read
Type: I/O Statement
Description Reads data defined by DATA statement(s) and assigns them to variables.
Syntax READ variable[, variable...] where: variable = A numeric or string variable.
Notes READ reads as many data values as necessary from data stored by DATA statement and assigns them, one by one, to each variable in the READ instruction. !
!
If the data type of a read value does not match that of the corresponding variable, the following operations take place so that no error occurs: The READ instruction converts the numeric data into the string data type and then assigns it to the string variable. DATA 123 Statement example: READ a$ PRINT a$ Output
123
If the string data is valid as numeric data, the READ instruction converts the string data into the numeric data type and then assigns it to the numeric variable. Statement example:
DATA “123” READ b PRINT b
Output:
123
10-113
Page 224
PDT 1100 Terminal Programmer’s Guide
If the string data is invalid as numeric data, the READ instruction assigns the value 0 to the numeric variable.
!
!
Statement example:
DATA “ABC” READ c PRINT c
Output:
0
The number of data values stored by the DATA statement must be equal to or greater than that of variables specified by the READ statement. If not, an execution error occurs. To specify the desired DATA statement location where the READ instruction should start reading data, use the RESTORE statement.
Execution Error Error Code
Meaning
04h
Out of DATA (DATA values remain to be read by the READ instruction.)
Reference Statements
10-114
DATA and RESTORE
Page 225
Statement Reference
REM Statement Name: Rem
Type: Declarative Statement
Description Declares the rest of a program line to be remarks or comments.
Syntax Syntax 1 REM comment
Syntax 2 ' comment
Notes REM causes the rest of a program line to be treated as a programmer's remark or comment for the sake of the program readability and future program maintenance. The remark statements are non-executable. !
Difference in description between Syntax 1 and Syntax 2: The keyword REM cannot begin in the first column of a program line. When following any other statement, REM should be separated from it with a colon (:). An apostrophe ( '), which may be replaced for keyword REM, can begin in the first column. When following any other statement, an apostrophe (') requires no colon (:) as a delimiter.
!
You can branch to a REM statement labelled by the GOTO or GOSUB statement. The control is transferred to the first executable statement following the REM statement.
10-115
Page 226
PDT 1100 Terminal Programmer’s Guide
Syntax Error Error Code and Message Meaning error 2: Improper label REM begins in the first column of a program line. name (redefinition, variable name, or reserved word used)
Reference Statements
10-116
$INCLUDE
Page 227
Statement Reference
RESTORE Statement Name: Restore
Type: I/O Statement
Description Specifies a DATA statement location where the READ statement should start reading data.
Syntax RESTORE [label]
Notes RESTORE specifies a DATA statement location where the READ statement should start reading data, according to label designating the DATA statement. ! !
You can specify DATA statements in included files. If label option is omitted, the default label is a DATA statement appearing first in the user program.
Syntax Error Error Code and Message Meaning error 81: Must be DATA label is not a DATA statement. statement label.
Reference Statements
DATA and READ
10-117
Page 228
PDT 1100 Terminal Programmer’s Guide
RESUME Statement Name: Resume
Type: Error Control Statement
Description Causes program execution to resume at a specified location after control is transferred to an error-handling routine.
Syntax Syntax 1 RESUME [0]
Syntax 2 RESUME NEXT
Syntax 3 RESUME label
Notes RESUME returns control from the error-handling routine to a specified location of the main program to resume program execution. !
The RESUME instruction has three forms as listed below. The form determines where execution resumes.
RESUME or RESUME 0
Resumes program execution with the statement that caused the error.
RESUME NEXT
Resumes program execution with the statement immediately following the one that caused the error.
RESUME label
Resumes program execution with the statement designated by label.
!
The RESUME statement should be put inside the error-handling routine.
10-118
Page 229
Statement Reference
Syntax Error Error Code and Message Meaning error 71: Syntax error label has not been defined.
Execution Error Error Code
Meaning
14h
RESUME without error (RESUME instruction occurs before the start of an error-handling routine.)
Reference Statements
ON ERROR GOTO
Functions
ERR and ERL
10-119
Page 230
PDT 1100 Terminal Programmer’s Guide
RETURN Statement Name: Return
Type: Flow Control Statement
Description Returns control from a subroutine or an event-handling routine (for keystroke interrupt).
Syntax RETURN
Notes RETURN instruction in a subroutine returns control to the instruction immediately following the GOSUB that called the subroutine. RETURN instruction in an event-handling routine for keystroke interrupt returns control to the program following the one where the keystroke trap occurred. ! !
No label designating a return location should be specified in a RETURN statement. You may specify more than one RETURN statement in a subroutine or an eventhandling routine.
Reference Statements
10-120
GOSUB and ON KEY...GOSUB