The text of a manual · part 19 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 10 Statement Reference, pages 161 to 170
Pages 161 to 170 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 161
Statement Reference
Syntax Error Error Code and Message Meaning error 71: Syntax error label has not been defined. label is missing.
Execution Error Error Code
Meaning
03h
RETURN without GOSUB
07h
Insufficient memory space (too many nesting levels.)
Reference Statements
RETURN
10-51
Page 162
PDT 1100 Terminal Programmer’s Guide
GOTO Statement Name: Goto
Type: Flow Control Statement
Description Branches to a specified label.
Syntax GOTO label
Notes GOTO unconditionally transfers control to a label specified by label. !
In an IF instruction block, you can omit GOTO immediately following THEN or ELSE, as shown below. IF a=0 THEN Lbl1 ELSE Lbl2 END IF
!
!
GOTO allows you to branch anywhere in your program. However, you should branch only to another line in a program module or subroutine at the same program level. Avoid transferring control to a DEF FN block or other blocks at the different program level. You can use GO TO instead of GOTO.
Syntax Error Error Code and Message Meaning error 71: Syntax error label has not been defined. label is missing.
10-52
Page 163
Statement Reference
IF...THEN...ELSE...END IF Statement Name: If...Then...Else...End If
Type: Flow Control Statement
Description Conditionally executes specified statement blocks depending upon the evaluation of a conditional expression.
Syntax Syntax 1 IF conditionalexpression THEN statementblock1 [ELSE statementblock2] END IF
Syntax 2 IF conditionalexpression ELSE statementblock END IF where: conditionalexpression = A numeric expression which evaluates to true or false.
Notes IF statement block tests whether conditionalexpression is true or false. If the condition is true (not zero), statementblock which follows THEN is executed; if it is false (zero), statementblock which follows ELSE is executed. Then, program control passes to the first statement after END IF. ! !
You can omit either THEN block or ELSE block. IF statement block should terminate with END IF which indicates the end of the block.
10-53
Page 164
PDT 1100 Terminal Programmer’s Guide
!
!
IF statement blocks can be nested. When using the IF statement block together with other block-structured statements ( FOR...NEXT, SELECT...CASE...END SELECT, and WHILE...WEND), you can nest them to a maximum of 30 levels. A block-structured IF statement block has the following advantages over a singleline IF statement (which is not supported in BASIC 3.0): " More complex conditions can be tested since an IF statement block can contain more than one line for describing conditions. " You can describe as many statements or statement blocks as you want. "
!
Since it is not necessary to put more than one statement in a line, you can describe easy-to-read programs according to the logical structure, making correction and debugging easy. You can use ENDIF instead of END IF.
Syntax Error Error Code and Message Meaning too many nesting levels.
error 26:
error 50: Incorrect use THEN is missing. of IF...THEN...ELSE...END IF error 51: Incomplete control structure
END IF is missing.
Example k$=INKEY$ IF k$<>“” THEN PRINT k$; END IF
Reference Statements
10-54
ON...GOTO, ON...GOSUB, DEF FN...END DEF, FOR...NEXT, SELECT...CASE...END SELECT, and WHILE...WEND
Page 165
Statement Reference
INPUT Statement Name: Input
Type: I/O Statement
Description Reads input from the keyboard into a variable.
Syntax INPUT [;][“prompt”{,|;}] variable where: “prompt” = A string constant. variable = A numeric or string variable.
Notes When execution reaches an INPUT instruction, the program waits for the user to enter data from the keyboard and shows a prompting message specified by prompt. After entering data, press the ENT key. Then, the INPUT instruction assigns the typed data to variable. ! !
“prompt” is a prompting message to be displayed on the LCD. The semicolon (;) and comma (,) after “ prompt” have the following meanings: If “prompt” is followed by a semicolon, the INPUT instruction displays the prompting message followed by a question mark and a space. INPUT “data= ”;a$ data= ?
If “prompt” is followed by a comma, the instruction displays the prompting message but no question mark or space is appended to the prompting message. INPUT “data= ”,a$ data=
10-55
Page 166
PDT 1100 Terminal Programmer’s Guide
!
!
!
!
!
!
!
10-56
The cursor shape specified by the most recently executed LOCATE instruction takes effect. Even after execution of the CURSOR OFF instruction, the INPUT instruction displays the cursor. Data inputted by the user echoes back to the LCD. To assign it to variable, press the ENT key. Pressing the ENT key causes a line feed, except when INPUT is followed by a semicolon (;) in an INPUT statement. If you type no data and press the ENT key, an INPUT instruction automatically assigns a zero or a null string to variable. When echoed back data is displayed on the LCD, press the Clear key to erase all displayed data or BS key to erase the last character of data. If no data is displayed, pressing Clear or BS has no effect. Notes for entering numeric data: The effective length of numeric data is 12 characters. The 13th typed-in literal and the following is ignored. Valid literals include 0 to 9, a minus sign (-), and a period (.). They should be in correct numeric data form. If not, INPUT statement accepts only numeric data from the first literal up to correctly formed literal, as valid data. If no valid data is found, the INPUT instruction assigns a zero to variable. A plus sign (+) can be typed in, but is ignored in evaluation of the entered data. The effective length of string data is the maximum string length of variable. Overflowed data is ignored. The sizes of prompting message literals, echoed back literals and cursor depend upon the screen mode. In the single-byte ANK mode, they appear in single-byte code size. Both the screen mode and the display font size determine the sizes of prompting message literals, echoed back literals, and cursor. If the standard-size font is selected, they appear in standard size; if the small-size font is selected, they appear in small size.
Page 167
Statement Reference
Syntax Error Error Code and Message Meaning error 71: Syntax error
Neither a comma (,) nor semicolon (;) follows “ prompt”. “prompt” is not a string constant.
Execution Error Error Code
Meaning
06h
The operation result is out of the allowable range. (numeric variable is out of range.)
Reference Statements
LINE INPUT and LOCATE
Functions
INKEY$ and INPUT$
10-57
Page 168
PDT 1100 Terminal Programmer’s Guide
INPUT # Statement Name: Input #
Type: File I/O Statement
Description Reads data from a device I/O file into specified variables.
Syntax INPUT # filenumber, variable[,variable...] where: filenumber = A numeric expression which returns a value from 1 to 16. variable = A numeric or string variable.
Notes INPUT # reads data from a device I/O file (a communications device file or bar code device file) specified by filenumber and assigns it to variable. !
filenumber is a number assigned to the device I/O file when it was opened.
!
Reading data from a communications device file: An INPUT # instruction reads data fields separated by CR codes or commas (,) and assigns them to variable. If more than one variable is specified in an INPUT # statement, the program waits until all of the specified variables receive data. If an INPUT # instruction reads data longer than the allowable string length, it ignores only the overflowed data and completes execution, causing no execution error.
!
Reading data from a bar code device file: An INPUT # instruction reads the scanned data into the first variable. If more than one variable is specified in an INPUT # statement, the program ignores the second and the following variables.
10-58
Page 169
Statement Reference
If an INPUT # instruction reads data longer than the allowable string length, it ignores only the overflowed data and completes execution, causing no execution error. If the maximum number of digits has been omitted in the read code specifications of the OPEN “BAR:” statement (except for the universal product codes), then the INPUT # instruction can read bar codes of up to 99 digits. To read bar codes of 40 digits or more, define a sufficient string variable length beforehand. !
Notes for entering numeric data: Valid characters include 0 to 9, a minus sign (-), and a period (.) in correct numeric data form. INPUT # statement accepts only numeric data from the first character up to correctly formed character, as valid data. If no valid data is found, the INPUT # instruction assigns zero to variable. If the INPUT # instruction reads alphabetical characters with a numeric variable, it assigns zero to variable. When reading Code 39 bar codes, special care should be taken.
Syntax Error Error Code and Message Meaning error 71: Syntax error filenumber is missing.
Execution Error Error Code
Meaning
06h
The operation result is out of the allowable range (numeric variable is out of range.)
34h
Bad file name or number ( filenumber of an unopened file specified.)
36h
Improper file type ( filenumber of a file other than device I/O files specified.)
3Ah
File number out of the range.
Example INPUT #fileNo,dat$
10-59
Page 170
PDT 1100 Terminal Programmer’s Guide
Reference Statements
OPEN “BAR:”, OPEN “COM:”, CLOSE and LINE INPUT#
Functions
INPUT$
10-60