Hardware manual

Commands and Functions M-Q Impact Reference Guide
Datalogic Automation Inc. 5-22
NOW
This function returns the local Impact device time and date expressed as seconds. (See“FORMATDATE” on
page 5-14.) Example:
thistime_string = FORMATDATE ("MM-DD-YY HH:mm:ss",NOW) yields
thistime_string = 2-27-12 11:56:19
OCT()
This function returns the octal value of the integer argument as a string. Example:
oct_string = OCT(255) yields oct_string = 377
ODD()
This function returns a True value if the argument is an odd number. If the argument is undef, the result is
undef. Example:
mycheck_bool = ODD(3) yields mycheck_bool = True
ON ERROR GOTO
This command defines the label for an error handling entry point. If the argument is NULL, error handling is
turned off. Example:
ON ERROR GOTO mylabel
ON ERROR RESUME
If this function is called, when an error occurs the program will try to continue execution at the argument
label, or the next statement if the argument is "next." Example:
ON ERROR RESUME next
ON ERROR RESUME mylabel
OPEN
(CPM Only)
Open - Output
This function opens a file so you can read from or write to it. This example opens a file named myfile.txt for
writing in the current directory, assigns the number 1 to it, writes the string "This is the first line" into it, then
closes the file. A new file is opened and any existing file with the same name is replaced. IMPORTANT: File
names are case sensitive.
open "myfile.txt" for output as 1
print#1,"This is the first line\n"
close 1
Anytime you refer to the file you need to use the file number assigned when the file is opened. For example,
the command Print#1 writes to file number 1 and the command Close 1, closes file number 1.
The "\n" characters at the end of the print command write a "newline" character at the end of the text so that
each line written to the file is a separate line. If you don’t use the newline character, the file will be a contin-
uous string.
Open - Append