The text of a manual · part 17 of 26
IRL Programming Reference Manual, pages 161 to 170
Pages 161 to 170 of 260
The original document is the PDF (666 KB). 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 Intermec 9445, Intermec 9550, Intermec 9560 and Intermec 9512
Page 161
L (Lookup Record)
7
L (Lookup Record) Purpose:
Finds the record location of a specific string within a file and puts that record location in a numeric register. Lookup searches for the string in $0 unless another string is specified.
Syntax:
L F[(rec)] [string] [#d] [*]
Parameters:
F is the file to be searched, A through Z. (rec) is the starting record location within file F. The default is record 0. n #n
Literal number, as in F(n) Numeric register, as in F(#n)
string is the string to search for. The default is the value in $0. The search string length and the file record length must be the same for a match. "data" Literal string (quotation marks are required) $n String register F(n) Record n in file F #d is the destination register. The default is numeric register #0. If the search string is found, the record location is stored in this register. * is the wild card indicator. The asterisk indicates that the search string contains wild card characters. The default is to search without wild cards. ? # @
Any alphanumeric character (including symbols) Any number Any letter (uppercase or lowercase)
For example, the following command searches for a record in file A that is seven characters long and contains three letters, a dash, and three numbers. LA"@@@ - ###"* Return Value:
The specified result register #d contains the search result. If the search string is found, the record location is stored in the result register. If the string is not found, the result register is set to the size of the file.
7-29
Page 162
L (Lookup Record)
Notes:
The L command stops after finding the first occurrence of the given string. To continue searching a specific file for the given string, set the optional starting record location to one greater than the record location stored in the result register, and then execute the L command again.
Examples LA
: Search file A, starting at record 0, for the string in : register $0, and save the record location in register #0.
LA"F-16"#9 : Search file A, starting at record 0, for string F-16, and : save the record location in register #9. LB(10)$3#1 : Search file B, starting at record 10, for string in : register $3, and save the record location in register #1. LA*
: Search file A, starting at record 0, for string in register : $0 ($0 = ####). Wild card is in effect, so search for any : four digit string. Save record location in register #0.
LA”25########”*
7-30
: Search file A, starting at record 0, for a 10-digit : part number beginning with “25”. Wild card is in : effect. Save record location in register #0.
Page 163
N (Numeric Input)
7
N (Numeric Input) Purpose:
Accepts only numeric data from the scanner, keypad, or keyboard and places the data into register #0. Readers running IRL 2.X accept up to 128 characters. Readers running IRL 4.X (JANUS readers) accept up to 250 characters.
Syntax RL v2.X:
K [len, len, len] [;time]
Syntax IRL v4.X:
K [len, len, len, len, len] [;time]
Parameters:
len is a number or numeric register that indicates an acceptable length for input data. The reader only accepts input that matches one of the specified lengths. For example, N4 only accepts data that is 4 characters long. For IRL v2.X, you can set up to three lengths. For IRL v4.X, you can set up to five lengths. The lengths can be a fixed value (such as 10) or a range (such as 2-4). For example, N 2-4,10 accepts a string that is two, three, four, or ten characters long. If you omit len, then data of any length is accepted. ;time Sets the receive timeout period from 1 to 6500. If the reader does not completely receive the data within (time X 10) milliseconds, the next statement is executed. For IRL v2.X, any partially accumulated input is discarded. For IRL v4.X, partially accumulated input is stored in $0. The timeout count is reset each time the input command receives one character of input.
Return Value IRL v2.X:
Register $0 contains the input string. Register #0 (status register) indicates the result of the input: 0 1
Return Value IRL v4.X:
The input was received. The user-defined timeout elapsed before the data was fully received.
Register $0 contains the input string. Register #0 (status register) indicates the result of the input. For a detailed list of input status codes, see the A (ASCII) command in this chapter.
7-31
Page 164
N (Numeric Input)
Notes:
Non-numeric input is not allowed with this command and results in an error beep. Data is appended to the contents of $0. If $0 is full, excess data is lost. All input is parsed for reader commands and valid reader commands are executed. See your reader manual for details on a specific reader command. All valid data is shown on the reader display. When you specify an entry length, the program only accepts input of that length. When you specify more than one length, the program only accepts input that matches one of the specified lengths. When you use a numeric register to define a fixed-length entry, values greater than the maximum length (128 or 250) are treated as 128 and 250, depending on the IRL version. Any current reader configuration command settings apply to all inputs.
Notes IRL v4.X:
You can use the set IM_IRL_STAT=n environment variable to use the IRL v2.X return values on JANUS readers. See Chapter 5, “Using IRL With JANUS Readers,” for help with setting environment variables.
Examples N
: Accepts variable-length numeric input with no timeout.
N6,3,2
: Accepts input that is six, three, or two characters long.
N;900
: Accepts variable-length input with 9 second timeout.
N#2,6;6500 : Accepts input the length of the value in register #2 : or input that is six characters long. Timeout is 65 sec.
7-32
Page 165
O (Open File)
7
O (Open File) Purpose:
Opens a designated file. For IRL v2.X, you must specify the number and size of records. For IRL v4.X, you can open dimensioned or undimensioned files.
Syntax IRL v2.X:
O F(n, m)
Syntax IRL v4.X:
O F ["filename"] [(n, m)]
Parameters:
F is the filename (A - Z). Use this name throughout your program to refer to this file. filename is an optional DOS filename and path (enclosed in quotes) for JANUS readers. You refer to the opened file throughout the program using the name you assign to F in this open command. n is the number of records in file, from 1 to 65535. Records are numbered from 0 to (n-1). m is the length of each record of the file. The minimum is one character. If the data is longer than specified, the excess data is truncated. For IRL v2.X, the maximum record length is 128. For IRL v4.X, the maximum record length is 250.
Notes IRL v2.X:
You must open a file before you use it, and the O commands must be at the beginning of your program. Only comments and blank lines can come before an O command. The O command is executed only when the program is compiled. For IRL v2.X, the size of each file is calculated as: size = ((record size + 2) x num records) where 2 is added for record length and checksum characters.
Return Value: Notes IRL v2.X:
None. To determine the total memory space reserved for multiple files, perform the above calculation for each proposed file and then add together. The total cannot exceed the reader’s available memory (IRL v2.X).
7-33
Page 166
O (Open File)
For dimensioned files, each record is stored in memory in this format: String Length ...Data Characters ...Checksum The checksum is checked when each record is retrieved, using Longitudinal Redundancy Check (LRC). The LRC is calculated as the exclusive OR of all characters in a record. If there is an error, the device displays the message, LRC Data Error. Notes IRL v4.X:
You must open a file before you use it, and the O commands must be at the beginning of your program. Only comments and blank lines can come before an O command. The O command is executed only when the program is compiled. You can read from and write to file 0, for a total of 27 available data files. The IRL filenames 0 and A through Z use the default DOS filenames {IRL-0}.IRD and {IRL-A}.IRD through {IRL-Z}.IRD. Use the filename parameter to specify a different file. You cannot open the default file 0 or specify a size for file 0. File 0 is opened automatically and is undimensioned. The size of each dimensioned file is calculated as: size = 9 + (record size + 1) X num records where record size and num records are the dimensioned sizes. The size of each undimensioned file is calculated as: size = 6 + SUM(record size + 1) where: SUM(record size + 1) is the total sum of each record size. record size is the number of actual characters in the record.
Notes IRL v4.X:
To determine the total disk space reserved for multiple files, perform the above calculations for each proposed file and then add together. The total cannot exceed the reader’s available disk space. When you compile a program, the size of an undimensioned file is not calculated. If your program opens a dimensioned data file and there is insufficient disk space for the entire file, the reader displays a Fatal Error message.
7-34
Page 167
O (Open File)
7
If your program opens a dimensioned data file and there is already a dimensioned data file with the same name but different dimensions in the same directory, the compile fails and the Dimension Error message is displayed. If two programs in the same directory refer to the same filename, such as {IRL-A}.IRD, one program may overwrite the other’s data file. To avoid problems, use the filename parameter to name a specific file and path, or use different data filenames in different programs. If a program opens a data file and the file is empty when the program ends, IRL deletes the file from disk. You copy an IRL data file to a DOS text file with the XF command. For more information on dimensioned and undimensioned files, see Chapter 5, “Using IRL With JANUS Readers.”
Examples OA(50,10)
: Opens file A with 50 records (0 to 49). Each record is 10 : characters long.
OR(100,35) : Opens file R with 100 records (0 to 99). Each record is 35 : characters long. OU
: IRL v4.X. Opens an undimensioned file named {irl-u}.ird. : Throughout your program, this file is called "U".
OB"C:\SALES\DATA.IRD"(100,15) : IRL v4.X. Opens the file : c:\sales\data.ird as file B, containing 100 records of 15 : characters each. OC"DATA"(100,15) : IRL v4.X. Opens the file data.ird in the current : directory as file C, containing 100 records of 15 : characters each.
7-35
Page 168
P (Prompt)
P (Prompt) Purpose:
Displays a specified string on the reader.
Syntax IRL v2.X:
P string
Syntax IRL v4.X:
P string [video]
Parameters:
string is the string in one of these formats: "data" Literal data, up to 125 characters in IRL v2.X up to 250 characters in IRL v4.X F(n) Record n in file F $n String register video enables or disables reverse video and blinking characters for prompts and input displayed on JANUS readers. You can set both reverse video and blinking at the same time. video is one or more of the following: \V \v \F \f
Reverse video (white characters on black background) Normal video (black characters on white background) Enable blinking Disable blinking
These changes remain in effect until you change them with another P command using the opposite video setting. Return Value: Notes:
None. For compatibility with earlier versions of IRL, you can use literal strings without quotation marks. However, if you omit the quotation marks, all text after the P is displayed, including comments. Therefore, quotation marks are recommend. You can display a value from a numeric register if you first convert the value to a string. See the C (Convert) command earlier in this chapter. You can use ASCII control characters to control the format of the display. Use the Escape or backslash character sequences as follows: \\ \0xhh \n \b \r
7-36
Backslash Any ASCII character, where hh is the hex value Line feed Backspace Carriage return
Page 169
P (Prompt)
Notes:
\e \e[2J \e[r;cH \e[s \e[u
7
Escape character, used in these sequences: Clear the display Move cursor to row r column c Save cursor position Restore cursor position
You can generate control characters, international characters, and graphic characters using the \0xhh instruction, where the hh represent the two hexadecimal digits for the desired character. For example, \0x7F is the Delete character. For a list of ASCII hex codes, see the ASCII chart in Appendix A. You can configure some reader display options, such as transparent mode and buffered mode. See your reader manual for details.
Examples P"ENTER ID" : Displays ENTER ID. P$1
: Displays the contents of string register $1.
P"This will \FBlink\f and this is in \VReverse Video\v."
7-37
Page 170
Q (Quit Subroutine)
Q (Quit Subroutine) Purpose:
Quits the current subroutine and returns to the instruction following the S (Call Subroutine) command. The Quit command can be conditional.
Syntax:
Q [expression] expression is a numeric or string conditional expression. The Quit command is performed if the expression is true. Expressions are in this form: a operator b For numeric expressions, a and b are numeric registers, floating point registers, string lengths [$n], or literal numbers. For string expressions, a and b are string registers, file records, or literal strings. You can use these wild card characters in a literal string: ? Any alphanumeric character # Any number @ Any letter (uppercase or lowercase) operator is one of these conditional operators:
Return Value: Notes:
All Versions
IRL v2.2 and Higher
< = >
<= less than or equal <> not equal >= greater than or equal less than equal greater than
None. The relative value of an alphanumeric character or punctuation mark is determined by its hexadecimal value. For a list of ASCII hex codes, see the ASCII chart in Appendix A. A Q command without an expression always quits and returns from the subroutine. You cannot mix string and numeric expressions in the same Q command.
Notes:
7-38
There is no limit to the number of Q commands a subroutine can have, although structured programming recommends that each subroutine have only one exit path and thus one Q command.