Monarch 9460 User Manual

Monarch
â
9460äADK
Printer
TC9460ADKPM Rev. AC 1/08 ©2003 Paxar Americas, Inc. a subsidiary of Avery Dennison Corp. All rights reserved.
Each product and program carries a respective written warranty, the only warranty on which the customer can rely. Paxar reserves the right to make changes in the product and the programs and their availability at any time and without notice. Although Paxar has made every effort to provide complete and accurate information in this manual, Paxar shall not be liable for any omissions or inaccuracies. Any update will be incorporated in a later edition of this manual.
©2003 Paxar Americas, Inc. a subsidiary of Avery Dennison Corp. All rights reserved. No part of this publication may be reproduced, transmitted, stored in a retrieval system, or translated into any language in any form by any means, without the written permission of Paxar Americas, Inc.
Trademarks
Monarch®, Sierra Sport, and 9433 are trademarks of Paxar Americas, Inc. Paxar® is a trademark of Paxar Corporation. Avery Dennison® is a trademark of Avery Dennison Corporation. Microsoft®, Windows®, and NT® are trademarks of Microsoft Corporation.
Avery Dennison Printer Systems Division 170 Monarch Lane Miamisburg, OH 45342
TABLE OF CONTENTS
Overview ................................................................................................................................1-1
How to Use this Manual .........................................................................................................1-1
A Review of Terms................................................................................................................1-1
Using the Software .................................................................................................................2-1
System Requirements............................................................................................................2-1
Installing the Software...........................................................................................................2-1
Connecting the Printer...........................................................................................................2-1
Getting Started .....................................................................................................................2-2
Saving a File ........................................................................................................................2-4
About Projects......................................................................................................................2-4
Building Projects...................................................................................................................2-5
Changing the Download Settings ............................................................................................2-5
Downloading a Project...........................................................................................................2-7
Editing Existing Projects........................................................................................................2-7
Printer Procedures .................................................................................................................3-1
Displaying the Ready Prompt .................................................................................................3-1
No Application ...............................................................................................................3-1
Loaded Application.........................................................................................................3-1
Accessing the Toolbox...........................................................................................................3-1
Loading Applications .............................................................................................................3-2
Restarting Existing Applications..........................................................................................3-2
Loading New Applications ..................................................................................................3-2
Program Structure ..................................................................................................................4-1
Functions .............................................................................................................................4-1
Starting a Script....................................................................................................................4-2
Files and Buffers ..................................................................................................................4-2
Lookup Table Definition .....................................................................................................4-2
Temporary Storage Definition .............................................................................................4-2
Printer Definition ...............................................................................................................4-3
Arrays ..............................................................................................................................4-3
Scope of Field Names ...........................................................................................................4-3
Script Flow Control ...............................................................................................................4-3
Comments in a Script ............................................................................................................4-4
Data Storage ........................................................................................................................4-4
Data Coding .........................................................................................................................4-4
Table of Contents 1
Command Reference...............................................................................................................5-1
Programming Conventions .....................................................................................................5-1
Field Names .........................................................................................................................5-1
Keywords .............................................................................................................................5-2
Special Characters................................................................................................................5-4
Script Flow...........................................................................................................................5-4
Functional Relationships........................................................................................................5-5
Math Commands ...................................................................................................................5-5
Script Control Commands ......................................................................................................5-5
Compiler Directives...............................................................................................................5-5
Data Manipulation Commands ................................................................................................5-6
File Management Commands..................................................................................................5-7
Input/Output Commands ........................................................................................................5-7
ADD ....................................................................................................................................5-8
APPVERSION.......................................................................................................................5-9
ARGREAD..........................................................................................................................5-10
ASC...................................................................................................................................5-11
AUTOSTART ......................................................................................................................5-12
AVAILABLEDATA................................................................................................................5-13
BITCLEAR.......................................................................................................................... 5-14
BITMASK ...........................................................................................................................5-15
BITSET.............................................................................................................................. 5-16
BITSHIFT........................................................................................................................... 5-17
BITTEST ............................................................................................................................5-18
BSEARCH ..........................................................................................................................5-19
CALL .................................................................................................................................5-20
CHARTYPE ........................................................................................................................5-22
CHECK ..............................................................................................................................5-23
CHR ..................................................................................................................................5-25
CLEAR...............................................................................................................................5-26
CLOSECOMM..................................................................................................................... 5-27
COMPARE .........................................................................................................................5-28
CONCAT ............................................................................................................................5-29
CSTRIP .............................................................................................................................5-30
DATATYPE.........................................................................................................................5-31
DEC ..................................................................................................................................5-32
DEFINE .............................................................................................................................5-33
DELAY...............................................................................................................................5-35
2 Table of Contents
DISABLE............................................................................................................................5-36
DIVIDE ..............................................................................................................................5-37
ENABLE.............................................................................................................................5-38
EXIT.................................................................................................................................. 5-39
FETCH...............................................................................................................................5-40
FIELDLEN ..........................................................................................................................5-41
FIXDATA............................................................................................................................5-42
GENERATE ........................................................................................................................5-43
GET...................................................................................................................................5-44
HOTKEY ............................................................................................................................5-45
IF ......................................................................................................................................5-46
INC ...................................................................................................................................5-48
INCLUDE ...........................................................................................................................5-49
INSERT .............................................................................................................................5-50
JUMP.................................................................................................................................5-51
LABELCOUNT ....................................................................................................................5-52
LEFT .................................................................................................................................5-53
LINKFILE ...........................................................................................................................5-54
LOCATE.............................................................................................................................5-55
LOWER..............................................................................................................................5-56
LSTRIP..............................................................................................................................5-57
MACRO..............................................................................................................................5-58
MID ...................................................................................................................................5-60
MOVE................................................................................................................................ 5-61
MULTIPLY.......................................................................................................................... 5-63
OPENCOMM.......................................................................................................................5-64
PAD...................................................................................................................................5-65
PARSE ..............................................................................................................................5-66
PRINT................................................................................................................................5-67
QUERY ..............................................................................................................................5-68
READ ................................................................................................................................5-70
RESTORESCREEN .............................................................................................................5-71
RETURN ............................................................................................................................ 5-72
RIGHT ...............................................................................................................................5-73
RSTRIP .............................................................................................................................5-74
SAVESCREEN.................................................................................................................... 5-75
SEEK................................................................................................................................. 5-76
SUB...................................................................................................................................5-77
Table of Contents 3
SWITCH.............................................................................................................................5-78
SYSSET.............................................................................................................................5-80
TOKEN ..............................................................................................................................5-82
TSTRIP..............................................................................................................................5-83
UPPER ..............................................................................................................................5-84
VALIDATE..........................................................................................................................5-85
WHILE ............................................................................................................................... 5-86
Sample Script........................................................................................................................ A-1
4 Table of Contents
OVERVIEW
The Application Development Kit II (ADK2) is a product for Microsoft Windows 95/98/Me/NT/2000. It allows you to create an application program to run on the printer. You write the script with the ADK2 command language.
You can program the printer to:
print labels or tags
print data streams written for other printers
You can define lookup tables for the script running on the printer. It also allows you to define records such as temporary storage buffers.
This manual is written for the Monarch Sierra Sport 2 9460 printer. Refer to the printer’s
Operator’s Handbook Reference Manual
or
Quick Reference
for data stream information.
for printer-specific information. Refer to the
1
Packet
How to Use this Manual
This manual contains the following information.
Chapter 1 Overview
Chapter 2 Using the Software
Chapter 3 Printer Procedures
Chapter 4 Program Structure
Chapter 5 Command Reference
Appendix A Sample Script
Introduces ADK2.
Tells you how to use the software for entering, editing, compiling, and printing your script.
Explains tasks done on the printer separate from the application.
Tells you how to write the script’s source code.
Describes the commands you use to write your script.
Lists a sample script.
A Review of Terms
Throughout this manual, you will see references to the different terms that you must be aware of before programming an ADK-version 9460 printer.
A
file
is a collection of related data, stored together in one unit. There are three types of files:
scripts, formats, and lookup tables.
A
script
is a type of file. It is the source code for a program that runs on the printer.
project
A project must have at least one script, but formats and lookup tables are optional.
An
is a collection of related files. The files can be a scripts, formats, or lookup tables. A
application
is a project that has been built into a form executable by the printer.
Overview 1-1
1-2 Overview
USING THE SOFTWARE
This chapter explains how to
start a new project.
build a project into an application.
download an application.
System Requirements
Here are the recommended system requirements.
Recommended
Computer Personal computer with Microsoft Windows 95/98/Me/NT/2000
Processor Pentium – 150 Mhz
Memory 32 Meg
Disk space 5-10 Meg
Communications Port Serial
Printer Monarch Sierra Sport 2
Installing the Software
2
1. From the Start menu, run the file SETUP.EXE.
2. Respond to the prompts as necessary.
Connecting the Printer
Connect your printer to the PC using either a DB9 to 9 pin (part 12029314) or DB9 to 25-pin (part
12029315) serial communications cable. For more information about connecting the cable, refer to your
Operator’s Handbook
or
Quick Reference
.
Using the Software 2-1
Getting Started
1. Start the ADK2 software. You will see
Project Tree
Builder Output
The screen has three major sections: the Project Tree, Working Area, and Builder Output. You can use the V
The Project Tree lists all the files in the open project. See “About Projects” for more
The Working Area is the text editor for the files in the project.
The Builder Output lists any errors or messages that appear when you build the
iew menu to change which areas appear on your screen.
information.
project.
Working Area
2. Start a new Project: Select New from the Project Menu.
3. Enter a name for the Project. Press f . You will see the Project Properties screen.
4. Accept the default directories or change the directories.
5. Select 9460 from the Printer Type box. Press f . The project file structure is set up. You
return to the Main screen.
2-2 Using the Software
6. Select New from the File Menu to start writing a script. Initial comments are automatically added
in the Working Area of the screen.
As you type your script, the ADK2 keywords appear in blue and the script text also appears in different colors, depending on what the text item is. To change the keyword colors, the text to upper or lower case, or show white space, right mouse click in the Working Area of the screen and make the appropriate selection. If you select Properties, you will see
7. Make any changes you want to the text color and tab sizes, enable line numbering, etc. Click
f when finished.
8. Finish writing your script.
Using the Software 2-3
Saving a File
Select Save from the File menu. The default sub-directory is \Scripts in the selected project directory. The file is saved with .CFS extension (configuration source). The first time you save the file, it will prompt you if you want to add this file as a script in the currently open project.
About Projects
The Project Tree lists all the files in the open project. The project tree contains the following directories: scripts, formats, and lookups.
Scripts Multiple scripts can be included in the \Scripts directory for use in the current project.
1. Highlight the \Scripts directory.
2. Right mouse click and select Add Files to Folder.
3. Locate and select the script to add. Click Open.
NOTE: One script must be marked as the Main script before building.
Highlight the script. Right mouse click and select M You must use the INCLUDE command in the script to include the other scripts.
Example:
Define SCRATCH, 5000, A INCLUDE c:\ADKProjects\MyStore\Scripts\price.cfs Function Start Begin . . .
ark as Main.
Formats Add format files to the \Formats directory for use in the current project.
1. Highlight the \Formats directory.
2. Right mouse click and select Add Files to Folder.
3. Locate and select the format to add. Click Open.
NOTE: You must use the LINKFILE command in the script to include the
format.
Example:
Define SCRATCH, 5000, A LINKFILE c:\ADKProjects\MyStore\Formats\shipping.fmt Function Start Begin . . .
2-4 Using the Software
Lookups Add lookup tables to the \Lookups directory for use in the current project.
1. Highlight the \Lookups directory.
2. Right mouse click and select Add Files to Folder.
3. Locate and select the lookup table to add. Click Open.
NOTE: If you do not use the LOOKUPDEF command in the script, when the
script is downloaded, you are prompted for the lookup file.
Example:
Define SCRATCH, 5000, A LOOKUPDEF c:\ADKProjects\MyStore\Lookups\prices.txt Function Start Begin . . .
Building Projects
When a script has been marked as the Main script, you are ready to build.
1. Select Build from the Project Menu.
2. The Builder Output portion of the screen shows different types of messages: Build Successful,
Build Aborted, Syntax Error, etc. A successfully built project file is saved with a .CFU extension.
NOTE: You can select P
roperties from the Project Menu to change file extension.
3. Specify the download settings.
4. Download the built file to the printer.
Changing the Download Settings
Before downloading a project to the printer, make sure the download settings at the PC match those at the printer.
To change the PC’s download settings:
1. Select Download Settings from the Project Menu.
2. Select the communications port (COM1, LPT1-2, or TCP/IP).
3. Click Settings.
Using the Software 2-5
If you select COM1 - COM4:
4. Make changes as needed to the Baud, Parity, Data Bits, Stop Bits, and Flow Control. Click f
twice.
NOTE: Changing these parameters only affects your PC, not the connected printer. Refer
to your printer’s documentation for more information about changing the printer’s communications parameters.
If you select LPT1 – LPT2:
Compatible mode is for uni-directional communications. With this mode, you can send files to your printer, but you will not receive printer status information. Select this mode if you are unsure of your printer’s parallel port configuration or your PC’s parallel port configuration.
IEEE1284 mode is for bi-directional communications. With this mode, you can send files to your printer and receive printer status information, such as error messages.
Only select this mode if:
your printer supports IEEE-1284 and it is enabled.
your computer supports ECP mode and ECP mode is enabled on your computer’s
parallel port. This is typically selected in your computer’s BIOS setup, which is normally accessed whenever you turn on your computer.
This screen appears differently for Microsoft Windows NT® and Windows® 2000 users.
Windows NT:
For Windows 2000:
Use the Direct Memory Access (DMA) channel assigned to your LPT port. The DMA normally defaults to 3. This can be changed in your computer’s BIOS setup.
Use the Direct Memory Access (DMA) channel assigned to your LPT port. The DMA normally defaults to 3. Enable the LPT port’s Interrupts using Device Manager.
5. Make a choice and click f when finished.
2-6 Using the Software
If you select TCPIP:
4. Enter your printer’s TCP/IP Address. See your System Administrator for more information.
5. Enter your printer’s TCP/IP Port (typically 9100). See your System Administrator for more
information.
6. Determine appropriate bi-directional setting:
Disabled/Unchecked is for uni-directional communications. With this
mode, you can send files to your printer, but you will not receive printer status information. Disable/Uncheck this selection if you are unsure of your printer’s parallel port configuration.
Enabled/Checked is for bi-directional communications. With this mode,
you can send files to your printer and receive printer status information, such as error messages. Only select this mode if your printer is set for IEEE1284 mode. Refer to your printer’s manual for more information.
7. Click f to exit the Download Configuration screen.
Downloading a Project
After the project has been built, you are ready to download it to the printer.
1. Verify that the download settings are the same at both the PC and printer. See “Changing the
Download Settings,” for more information.
2. Select Download from the Project Menu. Messages appear as the file is downloaded to the
printer.
Editing Existing Projects
1. Select Open from the Project Menu and locate the project file. It as a .CFP extension.
2. Make any changes to your script, format, or lookup file(s).
3. Save your changes.
4. Re-build the project.
5. Download the project to the printer.
When you close the ADK2 software, it saves the current views and which project files are open. When you re-open the project, the software restores the views and the previously opened project files.
Using the Software 2-7
2-8 Using the Software
PRINTER PROCEDURES
Applications should be written so that they run continuously when the machine is on. However, there may be instances where you need to “go behind the scenes” to troubleshoot the printer, reload an application, perform maintenance or set parameters.
3
Displaying the Ready Prompt
Before doing anything, you must display the Ready prompt on the printer.
Ready
p X
How you do this depends on whether the printer has an application loaded.
No Application
When there is no application in the printer, the Ready prompt appears automatically when you turn on the printer.
Loaded Application
To display the Ready prompt with a loaded application:
1. Turn on the printer. In a moment, the battery charge indicator appears.
E B F
2. Press the F key with the batter charge indicator on the screen. The following menu appears:
Start Appl. Online
E D
3. Choose Online. The Ready prompt appears.
NOTE: Online is different from Online Diagnostics in the tool box.
Accessing the Toolbox
You may need to run diagnostic tests, perform maintenance or set parameters on the printers. To do this, access the toolbox, as follows:
1. From the Ready prompt, press the left A button (under the p icon).
Ready
p X
2. The battery charge indicator appears.
E B F
R X T
Printer Procedures 3-1
3. Press the right A button (under the T icon). The following menu appears.
Tool Box Language Exit
E D
4. Choose Tool Box.
Note: When you exit the tool box, the Ready prompt appears.
5. Use the tool box to perform the tasks you need to do. See the
more information.
System Administrator’s Guide
for
Loading Applications
After you use the tool box, you must restart the existing application or load a new one.
Restarting Existing Applications
To restart the application (after using the tool box):
1. From the Ready prompt, press the right A key (under the X icon). The following menu appears.
Start Appl. Online
E D
2. Choose Start Appl.
Loading New Applications
To load a new application, see Chapter 2, “Using the Software.”
3-2 Printer Procedures
PROGRAM STRUCTURE
This chapter discusses program flow control, buffer definitions, and other useful information for writing your script.
Below is a sample of what a script may look like.
DEFINE TEMPORARY, RegPrice, 6, A DEFINE TEMPORARY, NewPrice, 6, A
DEFINE PRINTER, PrtRegPrice, 7, A DEFINE PRINTER, PrtNewPrice, 7, A
FUNCTION Start BEGIN CALL InitApp CALL GetRegPrice CALL GetNewPrice CALL PrintTags END
FUNCTION InitApp BEGIN CLEAR Printer CLEAR RegPrice . . . END . . .
4
Functions
A function is an independent group of statements usually performing a specific task. You execute a function with the CALL command. See Appendix A, "Sample Script," for a sample script.
Rule: Each function must have a BEGIN and an END.
FUNCTION function-name BEGIN . function-body . END
Program Structure 4-1
Starting a Script
Every script has the primary function START. The START function is the starting point of your program. Script execution control starts with the first command in START, and stops when the last command in START is performed.
FUNCTION START BEGIN . program-body . END
Files and Buffers
The Lookup table is a collection of records. Data is stored in the printer as an ASCII flat file.
You can tell the printer how to store defined buffers in memory. You can define the following buffers:
Scratch buffer
Lookup table buffer
Temporary storage buffer
Printer buffer
Array buffer
A buffer may contain up to 255 separate fields, each field being 1 to 999 bytes long.
Use the DEFINE command to specify the field definitions. Field-type, field-name, field-length, and data-type are the fields used to define the buffer. See Chapter 5, "Command Reference," for more information.
Lookup Table Definition
The lookup buffer is the working area for data downloaded to the printer. The lookup table definition tells the printer how the lookup records are received from the PC. The printer allocates buffer space for the record when it receives the definition.
The number of records stored depends on the size of each record and the script's size.
Temporary Storage Definition
The temporary storage buffer is used as a temporary storage for arithmetic operations and temporary variables.
4-2 Program Structure
Printer Definition
The printer buffer is used to store data to print.
Rule: The field lengths in the printer buffer must equal the length of the largest
corresponding field in the formats. For example, if...
the length of Field 1 of Format 1 is 7 the length of Field 1 of Format 2 is 22 the length of Field 1 of Format 3 is 12
Then, the first field's length in the printer buffer must be 22.
Arrays
You can use an array to store data similar to temporary storage. An array is a series of elements with the same data type. Arrays can be either numeric or alphanumeric. You can access an element of an array by providing the array name and an index value. This index value can be a numeric literal, a numeric buffer-field, or the input buffer. For example, Prices [4] points to the Prices array's fourth element.
In addition to the information for the DEFINE command listed above, you must also list the number of elements in the array (the maximum index value). See Chapter 5, "Command Reference," for more information.
Scope of Field Names
Keep in mind the following information.
You can access all variables globally.
Field names and labels can be up to 255 characters long. However, the first 12 characters must
be unique.
Script Flow Control
You can branch the flow of command control in different ways. The order in which the commands appear in the script controls the program's flow. At times, control is passed to another command through the use of valid labels, invalid labels, and the JUMP command. See Chapter 5, "Command Reference," for information about JUMP.
When a command fails, control passes to an invalid label, if you defined one. For example, the invalid label may show a message on the printer display. If the script does not identify an invalid label, control passes to the next line following the executing command. Similarly, when execution is successful, control passes to a valid label, if you defined one. And, if you did not define a valid label, control passes to the next line.
Rule: Precede all valid and invalid labels by an asterisk, (*). For example,
ADD CONTROL , TEMP1 , *ERROR2, *SUCCESS2
Program Structure 4-3
Comments in a Script
You must precede comments by a semicolon. The software treats them as a single white space and ignores them.
;********************************************************* ;* ;* Description ;* This is the main entry point of ;* the script. Gets the Date and ;* then starts processing. ;* ;*********************************************************
Data Storage
Although you can define a buffer field as being numeric or alphanumeric, the printer stores both kinds of data as ASCII characters, as follows:
Data Type Description
Alphanumeric Sequences of any ASCII characters.
Numeric
Sequences of numeric ASCII characters. For example, the printer stores 91 as the two-byte alphanumeric string "91."
Data Coding
To streamline the amount of data you store or pass to and from the printer, you can encode the data.
For example, you could encode a number as high as 255 by storing the corresponding character from the ASCII chart. For example, 91 (a two-byte character string, according to printer data storage rules) could appear as [, the ninety-first character on the ASCII chart.
There are two commands you can use in your script when encoding and decoding data according to this method.
Command Description
ASC
CHR
Consider the following code sample.
DEFINE TEMPORARY, QTY1, 3, A ; Alpha Temp. field DEFINE TEMPORARY, QTY2, 3, N ; Numeric Temp. field MOVE "}", QTY1 ; Now contains "}" ASC QTY1, QTY2 ; Decodes "}" to 125 INC QTY2 ; Increments 125 to 126 CHR QTY2, QTY1 ; Encodes 126 to "~"
This sample demonstrates how to decode a number, use the number in a computation, and encode the result back to a character.
Takes an ASCII character and returns the number corresponding to it on the ASCII chart.
Takes a number from 0-255 and returns the corresponding character on the ASCII chart.
4-4 Program Structure
COMMAND REFERENCE
This chapter lists, in alphabetical order, the commands you use to write your script. Each command is discussed in detail to include the correct syntax.
5
Programming Conventions
The commands use the following conventions.
KEYWORDS
Place holders
[optional]
Example
*label
Repeating Items
Missing Items
You must type the upper-case text. CALL function-name
Text in italics are place holders. CLEAR item
Optional items appear in brackets. CHECK item [,[<MI>invalid label] [,valid label]]
Text in bold courier font are examples of the command in use. ADD WHOLESALE , TEMP2
Text with an asterisk, "*", is a label signifying a place to jump to in the script. ADD CONTROL , TEMP1 , *ERROR2
Horizontal ellipsis dots following an item in a syntax description indicate more of the same item may appear. FETCH COMM
Vertical ellipsis dots used in examples and syntax descriptions indicate a portion of the code is omitted. Ex. ADD WHOLESALE, TEMP2
. . . ADD TEMP2, TEMP1
Field Names
The logical field names used in the command sections are examples. For example, TEMP1 is used throughout this chapter as an example of a temporary buffer field name.
Command Reference 5-1
Keywords
The following keywords are reserved by the compiler. Do not use them as identifiers.
1200 DTRDTE NONE
1200 19.2K 2400
4800 9600 ADD
APPEND APPVERSION ARGREAD
ARRAY ASC AUTOSTART
AVAILABLEDATA BACKLIGHT BATTERY
BAUDRATE BEEP BEGIN
BITCLEAR BITMASK BITSET
BITSHIFT BITTEST BSEARCH
CALL CASE CHARTYPE
CHECK CHR CLEAR
CLOSECOMM COMM COMM2
COMPARE CONCAT CONTINUOUS
CSTRIP CURRENT CURRENCY
DATABITS DATACOLLECT DATACOLLECTFILE
DATATYPE DATE DATELEN
DEC DEFINE DELAY
DELIMITER DISABLE DISPLAY
DIVIDE DOWNLOAD DTRDTE
ECHOBELL ELSE ELSEIF
ENABLE END ENDIF
ENDSWITCH ENDWHILE ENTER
EVEN EXECUTE EXIT
F1 F2 F3
F4 F5 F6
FAILSAFE FETCH FIELDLEN
FIXDATA FORMAT FUNCTION
GENERATE GET HEADER
HOTKEY IF IMAGEBUFFER
IMAGEFIELD INC INCLUDE
INPUT INPUTTEMPLATE INSERT
JUMP KEYBOARD LABELCOUNT
5-2 Command Reference
LEFT LINKFILE LINKFMT
LOCATE LOOKUP LOOKUPDEF
LOOKUPFILE LOOKUPSIZE LOWER
LSTRIP MACRO MARK
MID MOVE MULTIPLE
MULTIPLY NONE NUMBERPRINTED
ODD ONDEMAND OPENCOMM
PACKRECORDS PAD PARITY
PARSE PRINT PRINTER
PROMPTS QUERY RAM
RAVAIL RCLOSE READ
RECORDDELETE RESPONSE RESTORESCREEN
RETURN REVVID RIGHT
ROPEN RREAD RSTRIP
RTSCTS RWRITE SAVESCREEN
SCANLEN SCANNER SCRATCH
SEEK SETDATE SHUTDOWN
SKIP SPACE START
STATUSPOLLING STOPBITS STRIPS
SUB SUSPEND SWITCH
SYSSET SYMBOL TEMPORARY
TOKEN TRIGGER TRIGGERENABLE
TSTRIP UPLOAD UPLOADDEF
UPPER VALIDATE WHILE
WRITE XONXOFF
NOTE: Not all of these keywords apply to the 9460 printer; however, they are still reserved
by the compiler.
Command Reference 5-3
Special Characters
The following special characters are reserved for the printer. Do not use them in your script.
{ left brace
_ underscore
| pipe or split vertical bar
} right brace
~ tilde
\ backslash
` grave accent
However, you can use these characters in a string with quotation marks.
Use the tilde character (~) along with the corresponding ASCII code in strings to represent non­printable characters. For example, ~013 represents a carriage return.
The tilde sequence also works for using a double quote in a quoted string in a command parameter. For example, to move a double quote (") to the scratch buffer, enter:
MOVE "~034", SCRATCH
Script Flow
Script flow branches out to other functions and labels, depending on whether a command was successful or if it failed.
When a label is defined...
If a command was successful and a valid label is defined, control passes to that label.
If a command fails and an invalid label is defined, control passes to that label.
When a label is NOT defined...
If a command was successful, control passes to the next line.
If a command fails, control passes to the next line.
5-4 Command Reference
Functional Relationships
Some commands logically work together or are related in function. The commands are discussed in the following functional groups.
Math Commands
ADD Adds the numeric values of two fields.
DEC Decrements numeric fields.
DIVIDE Divides the contents of one field by the contents of another.
INC Increments numeric fields.
MULTIPLY Multiplies the contents of one field by the contents of another field.
SUB
Subtracts the contents of one field from the contents of another field.
Script Control Commands
CALL Calls a section of code as a subroutine.
CHECK Checks the status of system parameters.
DELAY Delays the current script for a specified time.
EXIT
IF
JUMP Transfers control to a label.
RETURN Exits a subroutine.
SWITCH
SYSSET Sets system parameters.
WHILE
Leaves the current script. If the printer re-enters the script, control passes to the script's first line.
Performs a series of one or more commands based on the existence of a condition.
Branches to a set of commands, based on the value of a variable.
Repeats a series of one or more commands based on the existence of a condition.
Compiler Directives
DEFINE Defines the field definitions for the buffers.
INCLUDE Inserts the source statements in the file into the current script.
LINKFILE Links formats to the script so they can download to the printer.
MACRO Defines or invokes a program for a repeating process.
Command Reference 5-5
Data Manipulation Commands
ARGREAD Extracts an argument from a comma-delimited string.
ASC
BITCLEAR Sets the specified bit to zero.
BITMASK Allows bit logical operations on buffers.
BITSET Sets the specified bit to one.
BITSHIFT
BITTEST Checks the specified bit to see if the bit is a one or a zero.
CHARTYPE Allows you to limit the character type for an input buffer.
CHR
CLEAR Clears buffers or files.
COMPARE Compares the contents of two fields.
CONCAT Appends the contents of one field to another.
CSTRIP Extracts specific characters for a string.
DATATYPE Restricts the type of data for the GET command.
FIELDLEN Places the length of one field into another.
Converts ASCII data from a numeric format to an alphanumeric format.
Allows bits within a value to be arithmetically shifted left or right.
Converts ASCII data from an alphanumeric format to a numeric format.
GENERATE Creates a check digit.
INSERT Inserts data from one buffer into another.
LEFT Extracts the left-most characters from a string.
LOWER Converts characters in a field to lower-case.
LSTRIP
MID Extracts a sub-field from a string.
MOVE Copies contents of one field to another field.
PAD Adds characters to a field to fill it out.
PARSE Processes an MPCL data stream.
RIGHT Extracts the right-most characters from a string.
RSTRIP
TOKEN Extracts character-delimited sub-fields from a string.
TSTRIP Strips characters from a field based upon a template.
UPPER Converts characters in a field to upper-case.
Strips specified left-most characters from one field and copies the remaining characters to another.
Strips specified right-most characters from one field and copies the remaining characters to another.
VALIDATE Validates a check digit.
5-6 Command Reference
File Management Commands
APPVERSION Sets the script name and version number.
BSEARCH
QUERY
READ
SEEK Positions the current record within the lookup file.
Performs a binary search on a sorted lookup table for a record containing a specific value.
Searches a lookup file to find a record containing a specific value.
Copies the current record from the lookup file into the appropriate working buffer.
Input/Output Commands
AUTOSTART Executes the script immediately after download is complete.
AVAILABLEDATA Checks the communications port for available data.
CLOSECOMM Closes the communications port.
DISABLE Turns off a particular hot key.
ENABLE Turns on a particular hot key.
FETCH
FIXDATA Defines fixed data for an input buffer.
Retrieves one character from the communications port and places it in the input buffer.
GET Retrieves data from the communications port.
HOTKEY Defines a particular hot key.
LABELCOUNT Tracks the number of labels printed.
LOCATE
OPENCOMM Opens the communications port.
PRINT Prints the printer buffer's contents in the format specified.
RESTORESCREEN Re-displays the saved contents of the screen.
SAVESCREEN Saves the screen’s current contents.
Moves the cursor to a particular position on the printer’s Screen.
Command Reference 5-7
ADD
Purpose Adds the numeric values of two fields.
Syntax ADD
Process The ADD command sums
buffer-field2
The
Rules: Both fields must be numeric.
The DEFINE command defines the index.
Optional Fields
Invalid
chapter.
buffer-field1
.
buffer-field
Buffer-field 1
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index] Array Buffer Field
Buffer-field1
and
valid labels
,
buffer-field2
fields can be one of the following:
and
2
only: Number prefixed by
are discussed in "Script Flow" at the beginning of this
[ , [
invalid label
buffer-field1
] [ ,
and
buffer-field2
Description
Field
the number sign (#)
valid label
and places the result into
] ]
Example 1
Example 2
See Also DEC
This example adds the contents of WHOLESALE to TEMP2. Control passes to the next line.
ADD WHOLESALE,TEMP2
This example assigns TEMP1 the sum of CONTROL and TEMP1. If TEMP1 overflows, control passes to the invalid label *ERROR2. If TEMP1 does not overflow, control passes to the next line.
ADD CONTROL,TEMP1,*ERROR2
INC SUB MULTIPLY DIVIDE
5-8 Command Reference
APPVERSION
Purpose Sets the version string of the ADK application.
Syntax APPVERSION
Process The APPVERSION command has
Example
string2
String1
This example displays AP11 on the screen’s first line and VER 1.0 on the second line.
APPVERSION “AP11”, “VER 1.0”
on the screen’s second line.
and
string1
string2
”, “
string2
can be up to 16 characters long.
string1
appear on the screen’s first line and
Command Reference 5-9
ARGREAD
Purpose Extracts field data from one field and places it in another.
Syntax ARGREAD
Process The ARGREAD command extracts data from
The
raw-data, destination, and index
Raw-Data, Destination, and
raw-data, destination, index
fields can be one the following:
Description
[ , [
Index
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Optional Fields
Example
Raw-data field
String
Index field
Number
Invalid
chapter.
Assuming PARAMLIST contains SSN,Name,Item, the following example extracts SSN and places it in the PARAM1 variable.
and
valid labels
only:
only:
ASCII string delimited by double quotes.
Number prefixed by a number sign (#). Range is 1-99.
are discussed in "Script Flow" at the beginning of this
invalid label
raw-data
and places it in
] [ ,
valid label
] ]
destination
.
ARGREAD PARAMLIST, PARAM1, #1
5-10 Command Reference
ASC
Purpose Converts numeric data to alphanumeric data.
Syntax ASC
Process The ASC command converts numeric data from
The
Example
int-field, asc-field
alphanumeric data in
int-field and asc-field
Int-field and Asc-field
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name [index] Array Buffer Field
SCRATCH Scratch Buffer
Int-field
Number
The following example converts numeric data from the TAINT field, converts it into alphanumeric data, and stores the result in TAASCII.
ASC TAINT, TAASCII
only:
asc-field
.
fields can be one the following:
Description
Number prefixed by a number sign (#).
int-field
and places the resulting
See Also CHR
Command Reference 5-11
AUTOSTART
Purpose Starts the application immediately after it is downloaded to the printer.
Syntax AUTOSTART
Process The AUTOSTART command starts the application immediately after it is
downloaded to the printer. Place it anywhere in the application code, but use it only once.
Example
This example specifies that the application should start immediately after download to the printer.
AUTOSTART
5-12 Command Reference
AVAILABLEDATA
Purpose Checks for data at a device.
Syntax AVAILABLEDATA
Process The AVAILABLE command checks for data at a
The
device
field can be one the following:
Device
KEYBOARD Keypad
COMM Communications Port
Optional Fields
Example
Invalid
chapter.
In the following example, control passes to code at label *CHARLN if the application detects data on the communications port.
AVAILABLEDATA COMM, , *CHARLN
and
valid labels
device
[ , [
invalid label
Description
are discussed in "Script Flow" at the beginning of this
] [ ,
valid label
device
.
] ]
Command Reference 5-13
BITCLEAR
Purpose Sets the specified bit to zero.
Syntax BITCLEAR
Process The BITCLEAR command sets the specified bit by
zero. defined, control passes to that label.
Buffer-field
Asc-field
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: Number
String
SCRATCH Scratch buffer
buffer-field, bit-position
Bit-position
and
can be 0 to 15. If
bit-position
and
Int-field
[ , [
invalid label
bit-position
can be one of the following:
Description
Temporary Buffer Field
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
is out of range and
] [ ,
valid label
bit-position
] ]
in
buffer-field
invalid label
to
is
Optional Fields
Example
See Also BITMASK
Invalid
This example sets bit number two of TEMP1 to zero.
BITCLEAR TEMP1, #2
BITSET BITSHIFT BITTEST
and
valid labels
are discussed in “Script Flow" at the beginning this chapter.
5-14 Command Reference
BITMASK
Purpose Allows bit logical operations on buffers.
Syntax BITSET
use the above syntax for logical AND/OR or logical exclusive OR.
BITMASK
use the above syntax for Invert.
Process The BITMASK command allows bit logical operations on
exclusive OR take the value in contents of
The INVERT operation inverts all bits in
field2
successful and
RULE: Both
Operation
operation, buffer-field1, buffer-field2
operation, buffer-field1
[ , [
invalid label
buffer-field2
buffer-field1
and
invalid label
valid label
buffer-field1
can be one of the following:
and
Operation
AND Logical And
OR Logical Or
XOR Logical Exclusive Or
INVERT Invert all bits
. The result is stored in
are defined, control passes to that label. If the operation is
is defined, control passes to that label.
buffer-field2
must be numeric.
Description
[ , [
invalid label
] [ ,
valid label
and logically combine it with the
buffer-field1
buffer-field1
. If
] [ ,
valid label
] ]
buffer-field1
.
buffer-field1
] ]
. AND/OR and
or
buffer-
Buffer-field1
Buffer-field1 field2
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: Number String
SCRATCH Scratch buffer
Optional Fields
Example
See Also BITCLEAR
Invalid
This example strips the high 8 bits from TEMP1.
BITMASK AND, TEMP1, #255
BITSET BITSHIFT BITTEST
and
and
buffer-field2
and
Buffer-
valid labels
can be one of the following:
Description
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
are discussed in “Script Flow" at the beginning this chapter.
Command Reference 5-15
BITSET
Purpose Sets the specified bit to one.
Syntax BITSET
Process The BITSET command sets the specified bit by
Bit-position
defined, control passes to that label.
RULE: Both
Buffer-field
buffer-field1, bit-position
can be 0 to 15. If
buffer-field1
and
Buffer-field
and
bit-position
bit-position
and
[ , [
invalid label
bit-position
must be numeric.
can be one of the following:
Description
is out of range and
bit-position
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: Number
String
Temporary Buffer Field
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
] [ ,
valid label
bit-position
] ]
in
buffer-field invalid label
to one.
is
SCRATCH Scratch buffer
Optional Fields
Example
See Also BITCLEAR
Invalid
This example sets bit number two of TEMP1 to one.
BITSET TEMP1, #2
BITMASK BITSHIFT BITTEST
and
valid labels
are discussed in “Script Flow" at the beginning this chapter.
5-16 Command Reference
BITSHIFT
Purpose Allows bits within a value to be arithmetically shifted left or right.
Syntax BITSHIFT
Process The BITSHIFT command allows bits within a value to be arithmetically shifted left
or right. Shifts
Count
out of range and invalid label is defined, control passes to that label. If the operation is successful and
RULE: Both
Direction
Direction
LEFT Shifts bits left
RIGHT Shifts bits right
Buffer-field1
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
direction, buffer-field1, count
count
bits in
can be 1 to 16. If
buffer-field
buffer-field
valid label
buffer-field1
can be one of the following:
and
and
count
must be numeric.
count
can be one of the following:
and
count
[ , [
invalid label
in the direction specified by
contains an invalid value or the count field is
is defined, control passes to that label.
Description
Description
Temporary Buffer Field
] [ ,
valid label
] ]
direction
.
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: Number
String
SCRATCH Scratch buffer
Optional Fields
Example
See Also BITCLEAR
Invalid
This example shifts the bits in TEMP1 once to the left, which has the effect of doubling the value.
BITSHIFT LEFT, TEMP1, #1
BITMASK BITSET BITTEST
and
valid labels
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
are discussed in “Script Flow" at the beginning this chapter.
Command Reference 5-17
BITTEST
Purpose Checks the specified bit to see if the bit is a one or a zero.
Syntax BITTEST
Process The BITTEST command checks the specified bit by
position invalid label position
Buffer-field1
Buffer-field1
buffer-field1, bit-position
can be 0 to 15. If the bit specified by
is defined, control passes to that label. If the bit specified by
is one (set) and
and
bit-position
and
valid label
can be one of the following:
[ , [
invalid label
bit-position
is defined, control passes to that label.
Description
bit-position
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: Number
String
Temporary Buffer Field
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
] [ ,
valid label
bit-position
is zero (cleared) and
] ]
in
buffer-field1. Bit-
bit-
SCRATCH Scratch buffer
Optional Fields
Example
See Also BITCLEAR
Invalid
This example checks bit number two of TEMP1 and if it is zero (cleared), control passes to CLEARED. If the bit is one (set), control passes to the next line.
BITTEST TEMP1, #2, *CLEARED
BITMASK BITSET BITSHIFT
and
valid labels
are discussed in “Script Flow" at the beginning this chapter.
5-18 Command Reference
BSEARCH
Purpose Performs a binary search on a sorted lookup table to find a record containing a
specific value.
Syntax BSEARCH
Process The BSEARCH
which lookup table to use by the field you specify (every field name must be unique over all lookup tables).
Optional Fields If the search is successful, the pointer points to the record and control passes to
valid label
control passes to line.
NOTE: You must sort the lookup table before downloading it to the printer.
Lookup-field
Value
Value
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
lookup-field, value
command searches
(if defined). If the search is unsuccessful, the pointer is undefined and
invalid label
is the search field's logical name in the lookup table.
is the value you are searching the field for and can be one of the following:
[ , [
invalid label
lookup-field
(if defined). Otherwise, control passes to the next
Description
Temporary Buffer Field
Array Buffer Field
] [ ,
for
valid label
value
] ]
. The script determines
Number
String
Lookup-field
Optional Fields
Example
Invalid
This example searches CONTROL_ID for the input buffer's contents. If no match is found, control transfers to the *ERROR_ID label.
BSEARCH CONTROL_ID, INPUT, *ERROR_ID
and
valid labels
and
A number prefixed by the number sign (#) A one-character ASCII string delimited by double quotes
value
must have the same data type.
are discussed in “Script Flow" at the beginning this chapter.
Command Reference 5-19
CALL
Purpose Calls a section of code as a subroutine.
Syntax CALL
Process The CALL command executes an out-of-line function. After execution, control
returns to the command following the CALL command. The CALL function allows parameters to passed to the called function. The called function must have a DEFINE LOCAL for local storage for each parameter that is passed to it. The parameters will be placed from left to right with the leftmost parameter placed in the first DEFINE LOCAL variable.
Rules: You may nest up to 25 CALL commands.
The
function-name
[ (
param1, param2, …,paramX
) ]
function-name
param
Param
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
String
Number
fields can be one of the following:
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes. Number prefixed by a number sign (#).
Example 1
Scratch Scratch buffer
This example calls the subroutine COMPUTE_TAX.
CALL COMPUTE_TAX
5-20 Command Reference
Example 2
This example shows the use of local variables. The function ADDNUM has two local variables defined that receive the parameters passed from the call. The first parameter (#5) is placed in the TfirstNum field and the second parameter (#6) is placed in the TsecondNum field. The TSum variable is defined as a global Temporary variable and is accessible from any functions in the script.
DEFINE TEMPORARY, TSum, 10, N FUNCTION START BEGIN . . . CALL ADDNUM (#5, #6) . . . END
FUNCTION ADDNUM BEGIN DEFINE LOCAL,TfirstNum, 10, N DEFINE LOCAL, TsecondNum, 10, N ADD TfirstNum, TsecondNum MOVE TsecondNum, Tsum END
See Also RETURN
Command Reference 5-21
CHARTYPE
Purpose Allows you to limit the character type for an input buffer.
Syntax CHARTYPE
Process The CHARTYPE command restricts the character type applied to an input buffer
using
NOTE: This command does not affect the FETCH command.
Type
type
describes the contents of
Type
S Set of allowable characters for input field
T Template mask for input buffer
Buffer-field1
template mask. It can be one of the following:
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
type
,
buffer-field1
and
buffer-field1
Description
contains either a set of allowable characters for the input field or a
.
buffer-field1
Description
Temporary Buffer Field
. It can be one of the following:
Logical Field Name (Field1) [Index]
Number
String
Valid characters for a template mask are:
Type
* Any valid character
# Numeric
@ Alpha character
- Skip input for fixed data
Example
See Also FIXDATA
This example restricts a template input field to accept one alphanumeric character, four numeric characters, fixed data followed by two more numeric characters. For example, $9999.99.
CHARTYPE T,"@####_##"
Description
Array Buffer Field
A number prefixed by the number sign (#) ASCII string delimited by double quotes
5-22 Command Reference
CHECK
Purpose Checks the status of a specified system parameter.
Syntax CHECK
Process The CHECK command checks the status of
Item
Buffer-field
the parameter is returned. Following are the possible status values:
item
[,
buffer-field
can be one of the following:
Item
BATTERY Battery Voltage
COMM Communications Port
PRINT Print
is required if
Description
] [ , [
invalid label
item
is COMM or PRINT. It is a field where the status of
Item Value Description
COMM 0 OK
1 User Aborted
400 Invalid Packet Received
406 Response Time-out
410 Parity Error
411 Communications Error
(framing, overrun)
] [ ,
item
.
valid label
] ]
413 Input Buffer Full (XON not
acknowledged)
PRINT 0 Good
1 User Aborted
750 Hot Printed
751 Jam
762 Battery Voltage Too Low to
Print
770 Motor not Ready
771 Format not Found
Command Reference 5-23
Buffer-field
can be one of the following:
Optional Fields
Example
Buffer-field
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Invalid
chapter.
This example checks the battery level. If the level is low, control of the application branches to the *LOWBATTERY label.
CHECK BATTERY, *LOWBATTERY
and
valid labels
are discussed in "Script Flow" at the beginning of this
Description
Temporary Buffer Field
5-24 Command Reference
CHR
Purpose Converts alphanumeric data to numeric data.
Syntax CHR
Process The CHR command converts
Asc-field and Int-field
asc-field, int-field
format, placing the result in
respectively. They can be one of the following:
contain the data to translate and the translated data,
Asc-field and Int-field
INPUT Input Buffer
SCRATCH Scratch Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Asc-field only: String
Example
This example takes alphanumeric data from the TAASCII field, converts it into numeric data, and stores the result in the TAINT field.
asc-field
int-field
(containing alphanumeric data) to a numeric
.
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes
CHR TAASCII, TAINT
See Also ASC
Command Reference 5-25
CLEAR
Purpose Deletes data from data items.
Syntax CLEAR
Process The CLEAR command deletes data from
line.
NOTE: You must define a buffer before you can clear it.
Item
item
is the data item to clear. It can be one of the following:
Item
PRINTER Printer Buffer
INPUT Input Buffer
DISPLAY Printer’s Screen
TEMPORARY Temporary Buffer Record
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (Field1) [Index]
Logical Field Name (PR1) Printer Buffer Field
NUMBERPRINTED Number of labels printed
Description
Temporary Buffer Field
Array Buffer Field
item
. Control always passes to the next
Example 1
Example 2
INPUTTEMPLATE Input Template, Chartype, and DataType settings
SCRATCH Scratch Buffer
COMM Communications port
This example clears the Printer Buffer and passes control to the next line.
CLEAR PRINTER
This example clears temporary buffer field TEMP1 and passes control to the next line.
CLEAR TEMP1
5-26 Command Reference
CLOSECOMM
Purpose Closes either the primary or secondary communications port.
Syntax CLOSECOMM
Process The CLOSECOMM command closes communications port referenced by
It can contain 1 for the primary port or 2 for the secondary port.
Commport
Commport
INPUT Input Buffer
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Number A number prefixed by
Example
See Also OPENCOMM
This example closes the primary communications port.
CLOSECOMM #1
commport
is the communications port to close. It can be one of the following:
Description
Temporary Buffer Field
a pound (#) sign.
commport
.
Command Reference 5-27
COMPARE
Purpose Compares the contents of two fields.
Syntax COMPARE
Process The COMPARE command compares the two buffer fields, based on
Modifier
Modifier
GT Greater than operator
GE Greater than or equal to operator
LT Less than operator
LE Less than or equal to operator
EQ Equal to operator
The
buffer-field
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
buffer-field1
can be one of the following:
Description
fields can be one of the following:
and
,
2
modifier
Description
Temporary Buffer Field
,
buffer-field2
[ , [
invalid label
] [
, valid label
modifier
.
] ]
Rule: B
Optional Fields
Rules: If the comparison is true, control passes to
Example
Logical Field Name (Field1) [Index]
String
Number
uffer-field1
is numeric,
Invalid
chapter.
no
valid label
If the comparison is false, control passes to is no
invalid label
This example compares TEMP1 and TRUCK_ID for equality. If they are equal, control passes to *TRUCK_IN. If they are not equal, control passes to *JUMP_5.
COMPARE TEMP1,EQ,TRUCK_ID,*JUMP_5,*TRUCK_IN
and
buffer-field2
and
valid labels
buffer-field2
must also be numeric.
are discussed in “Script Flow" at the beginning of this
.
.
Array Buffer Field
ASCII string delimited by double quotes A number prefixed by the number sign (#)
must be the same type. For example, if
valid label
invalid label
or to the next line if there is
or to the next line if there
buffer-field1
5-28 Command Reference
CONCAT
Purpose Appends the contents of one field to another.
Syntax CONCAT
Process The CONCAT command copies
contents.
Source
can be one of the following:
Source
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Source
String
Number
Destination
SCRATCH
source
Source
is the data to append
only:
,
destination
's contents do not change.
and
Destination
only:
. Destination
[ , [
invalid label
source
's contents to the end of
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes A number prefixed by the number sign (#)
Scratch Buffer Field
] [ ,
is the resulting data
valid label
] ]
destination
.
These variables
's
You can concatenate numeric fields and alphanumeric fields in any combination.
Optional Fields Invalid and valid labels are discussed in “Script Flow" at the beginning of this
chapter.
Example
This example appends the SKU to the end of BC_FIELD.
CONCAT SKU,BC_FIELD
Command Reference 5-29
CSTRIP
Purpose Strips data from a field.
Syntax CSTRIP
Process The CSTRIP command strips data specified in
These variables
field-buffer1
,
field-buffer2
can be one of the following:
Field-buffer1 and Field-
[ , [
invalid label
Description
] [ ,
valid label
field-buffer2
from
] ]
field-buffer1
buffer2
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Field-buffer2 only
String
Optional Fields Invalid and valid labels are discussed in “Script Flow" at the beginning of this
chapter.
Example
See Also RSTRIP
This example removes all dashes from the SHIP_NO field.
CSTRIP SHIP_NO, “-“
LSTRIP TSTRIP
:
Temporary Buffer Field
ASCII string delimited by double quotes.
.
5-30 Command Reference
DATATYPE
Purpose Restricts the type of data the GET statement can retrieve.
Syntax DATATYPE
Process The DATATYPE command restricts the GET statement to only read data of type
data-type
Data-type
NUMERIC Numeric Only (0-9)
ALPHA Alpha only (A-Z, a-z)
SYMBOLS Symbols only
ALPHANUMERIC Alphanumeric (0-9, A-
NUMSYM Numeric and Symbols
ALPHASYM Alpha and Symbols
ALPHANUMSYM Alphanumeric and
ALL All characters
Example
This example removes all dashes from the SHIP_NO field.
DATATYPE ALPHANUMERIC
data-type
.
Data-type
can contain one of the following values.
Description
Z, a-z)
Symbols
accepted (00-FFh)
Command Reference 5-31
DEC
Purpose Decrements numeric fields by one.
Syntax DEC
Process The DEC command decrements
decrements an alphanumeric field.
Buffer-field
Rule: You can decrement only numeric fields.
Optional Fields
If you decrement an uninitialized field, control passes to
Example
Invalid
chapter.
This example decrements TEMP_SKU and passes control to the next line.
buffer-field
[ , [
invalid label
] [
, valid label
buffer-field
is one of the following:
Buffer Field
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
and
valid labels
are discussed in “Script Flow" at the beginning of this
Description
Temporary Buffer Field
Array Buffer Field
] ]
. A translation error occurs if the script
invalid label
.
DEC TEMP_SKU
See Also ADD
INC SUB DEC MULTIPLY DIVIDE
5-32 Command Reference
DEFINE
Purpose Defines the field definitions for the buffers.
Syntax To define a SCRATCH buffer...
DEFINE field-type , field-length , data-type
To define TEMPORARY or PRINTER buffers...
DEFINE field-type , field-name , field-length [ , data-type ]
To define an ARRAY buffer...
DEFINE field-type , field-name , field-length , number-of-elements [ , data-type ]
To define a LOOKUP buffer...
DEFINE field-type , [ logical-name ] field-name , field-length [ , data-type ]
Process The DEFINE command defines temporary, lookup, printer, array, and scratch buffer
fields.
Field-type
can be one of the following:
Buffer Field
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
SCRATCH Scratch Buffer
Field-name
other identifier.
Field-length
you're defining a scratch buffer, the maximum is 65535.
NOTE: Although individual lookup table fields can be up to 2800 bytes long, lookup table
records cannot exceed 128K.
If a DEFINE TEMPORARY statement is placed inside the BEGIN-END pair of a
function, that variable can only be referenced within that function and not by any other function.
is the field's logical name and is under the same restrictions as any
is the buffer field's size in bytes. Enter a value from 1 to 2800. If
Description
Temporary Buffer Field
Array Buffer Field
Optional Fields
Number-of-elements
Data-type
NOTE: If
Logical-name
(over all lookup tables used by the script) and in parentheses. The default name is lookup.
(for numeric). The default is A.
field-type
is used to define multiple lookup tables. Each name must be unique
is required when the
is the kind of data the buffer field holds. Enter A (for alphanumeric) or N
is PRINTER,
data-typ
field-type
e must be A.
is set to ARRAY.
Command Reference 5-33
Example 1
This example defines the temporary buffer field CURR_QTY as a numeric field with a length of 4 bytes.
DEFINE TEMPORARY,CURR_QTY,4,N
Example 2
This example shows the use of local variables. The function ADDNUM has two local variables defined that receive the parameters passed from the call. The fist parameter (#5) is placed in the TfirstNum field and the second parameter (#6) is placed in the TsecondNum field. The Tsum variable is defined as a global Temporary variable and is accessible from any functions in the script.
DEFINE TEMPORARY, Tsum, 10, N FUNCTION START BEGIN . . . CALL ADDNUM (#5, #6) . . . END
FUNCTION ADDNUM BEGIN DEFINE LOCAL, TfirstNum, 10, N DEFINE LOCAL, TsecondNum, 10, N ADD TfirstNum, TsecoundNum MOVE TsecondNum, Tsum END
5-34 Command Reference
DELAY
Purpose Delays the current script for a specified time.
Syntax DELAY #
Process The DELAY command suspends the printer's current script for the number of tenths
of seconds specified by
Interval
Interval
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Number Number prefixed by a
Rule: The
Example 1
This example suspends the current script for two seconds.
DELAY #20
interval
interval
can be one of the following:
interval
must be numeric.
. The
interval
Description
Temporary Buffer Field
Array Buffer Field
number sign (#)
range is 1 - 255.
Example 2
This example suspends the current script for the number of tenths of seconds in TIMEOUT.
DELAY TIMEOUT
Command Reference 5-35
DISABLE
Purpose Turns off the specified hot keys.
Syntax DISABLE
Process The DISABLE command turns off the specified hot keys. You must turn on the hot
keys (with the ENABLE command) before using this command.
Hotkey1, hotkey2, and hotkey3
Hotkey1, Hotkey2, and
hotkey1
[,
hotkey2
][,
hotkey3
can be one of the following:
]
Description
Hotkey3
F1 Function Key 1
F2 Function Key 2
F3 Function Key 3
ALL All function keys
Example
See Also ENABLE
This example disables the F1, F2, and F3 hot keys.
DISABLE F1, F2, F3
HOTKEY
5-36 Command Reference
DIVIDE
Purpose Divides the contents of one field by the contents of another.
Syntax DIVIDE
Process The DIVIDE command divides
into remainder.
Buffer-field1
variables can be one of the following:
Rules: You cannot use two numeric literal fields. For example,
buffer-field1
buffer-field2
contains the dividend while
Buffer Field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Number Number prefixed by a
If
buffer-field1
field.
,
buffer-field2
. This command performs integer division and truncates the
and
2
contains a numeric literal,
[ , [
invalid label
buffer-field1
by
buffer-field2
Description
Temporary Buffer Field
Array Buffer Field
number sign (#)
] [
, valid label
buffer-field2
is the divisor. These
buffer-field2
] ]
and inserts the quotient
must contain a
If
buffer-field2
field.
When you use a numeric literal, the script places the result in the field that is not a
numeric literal.
Optional Fields Invalid and valid labels are discussed in “Script Flow" at the beginning of this
chapter.
Example 1
Example 2
Example 3
This example divides the contents of WHOLESALE by the contents of TEMP2. The quotient is inserted into TEMP2. Control passes to the next line.
DIVIDE WHOLESALE,TEMP2
This example divides the contents of CONTROL by the contents of TEMP1, inserting the quotient into TEMP1. If an overflow condition occurs, control passes to *ERROR2.
DIVIDE CONTROL,TEMP1,*ERROR2
This example divides the contents of PRICE by 100. This operation is a method of converting cents to dollars. If an overflow condition occurs, control passes to *ERROR2.
contains a numeric literal,
buffer-field1
must contain a
DIVIDE PRICE,#100,*ERROR2
See Also MULTIPLY
Command Reference 5-37
ENABLE
Purpose Turns on the specified hot keys.
Syntax DISABLE
Process The DISABLE command turns on the specified hot keys. You must turn on the hot
keys (with the ENABLE command) before using this command (the default is off).
Hotkey1, hotkey2, and hotkey3
Hotkey1, Hotkey2, and
hotkey1
[,
hotkey2
][,
hotkey3
can be one of the following:
]
Description
Hotkey3
F1 Function Key 1
F2 Function Key 2
F3 Function Key 3
ALL All function keys
Example
See Also DISABLE
This example disables the F1, F2, and F3 hot keys.
ENABLE F1, F2, F3
HOTKEY
5-38 Command Reference
EXIT
Purpose Leaves the current script.
Syntax EXIT
Process The EXIT command returns control back to normal printer operation unless you
specify AUTOSTART.
To restart the script, enable the script through the printer’s control panel.
Example
This example shows the script's termination.
EXIT
Command Reference 5-39
FETCH
Purpose Retrieves one character from up to two sources and places it in the Input Buffer.
Syntax FETCH
Process The FETCH command retrieves one character from
places these characters in the Input Buffer.
NOTE: The DATATYPE and CHARTYPE commands do not affect this command.
Characters retrieved from the keyboard will be either 1, 2, or 3, depending on
Optional Fields Invalid and valid labels are discussed in “Script Flow" at the beginning of this
Example
See Also GET
Src1
which hot key was pressed.
chapter.
This example retrieves one character from the communications port and passes control to the next line.
FETCH COMM
src1 [ , src2
] [ , [
invalid label
] [
, valid label
] ]
src1
and
src2
can be one of the following:
Src1
and
Src2
COMM Communications port
KEYBOARD Keypad
Description
and optionally,
src2
. It
5-40 Command Reference
FIELDLEN
Purpose Places the length of a field into another field.
Syntax FIELDLEN
Process The FIELDLEN command calculates the length of
buffer-field2
The
buffer-field
Buffer Field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
String
Number
Rule:
Buffer-field2
buffer-field1
.
fields can be one of the following:
only:
must be numeric.
and
,
buffer-field2
2
[ , [
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes. Number prefixed by a number sign (#)
invalid label
] [
, valid label
buffer-field1
] ]
and places it in
Optional Fields
Example 1
Invalid
chapter.
This example places the length of WHOLESALE into TEMP2. Control passes to the next line.
FIELDLEN WHOLESALE,TEMP2
and
valid labels
are discussed in “Script Flow" at the beginning of this
Command Reference 5-41
FIXDATA
Purpose Defines fixed data for an input buffer.
Syntax FIXDATA
Process The FIXDATA command defines fixed data for the input buffer. Use this command
with the CHARTYPE command, which provides a template. string inserted into the input buffer.
Buffer-field1
Buffer Field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
String
Number
Rules: Spaces in a string represent fixed spaces.
An underscore, "_", is a place holder for variable data.
buffer-field1
can be one of the following:
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes Number prefixed by a number sign (#)
Buffer-field1
contains a
Example
See Also CHARTYPE
This example creates a template for a telephone number. The CHARTYPE command could define the variable characters as numeric.
FIXDATA "(___) ___-___"
TSTRIP
5-42 Command Reference
GENERATE
Purpose Generates a check digit.
Syntax GENERATE
Process The GENERATE command generates a check digit for the value in
Type
specifies the check digit scheme to use.
Buffer-field
Buffer-field and Type
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Buffer-field
Logical Field Name (Field1) [Index]
Type Only:
Rule: When it is a buffer field,
Following are the meanings of each value
1 Reserved 13 Custom Check Digit 9
buffer-field, type
and
type
can be one of the following:
only:
Number Number (from 1-24)
[ , [
invalid label
Description
Array Buffer Field
prefixed by a number sign (#).
type
must be numeric.
] [
type
, valid label
can have.
] ]
buffer-field
.
Optional Fields
Example
2 Sum of Digits 14 Custom Check Digit 10
3 Sum of Products 15 UPCA Check Digit
4 Reserved 16 UPCE Check Digit
5 Custom Check Digit 1 17 EAN8 Check Digit
6 Custom Check Digit 2 18 EAN13 Check Digit
7 Custom Check Digit 3 19 LAC Check Digit
8 Custom Check Digit 4 20 Code 39 Check Digit
9 Custom Check Digit 5 21 MSI Check Digit
10 Custom Check Digit 6 22 Postnet Check Digit
11 Custom Check Digit 7 23 UPC Price Check Digit
12 Custom Check Digit 8 24 EAN Price Check Digit
Invalid
chapter.
This example generates a check digit in the input buffer by using the Sum of Digits check digit scheme.
GENERATE INPUT, #2
and
valid labels
are discussed in “Script Flow" at the beginning of this
Command Reference 5-43
GET
Purpose Retrieves data from up to two input devices.
Syntax GET
Process The GET command retrieves data from
Minimum
src1 [, src2], minimum, maximum
the input buffer.
Src1
and
src2
can be one of the following:
Src1 and Src2
COMM Communications port
KEYBOARD Keypad
and
maximum
6, a valid entry for that field is 4 to 6 characters. The valid range for
maximum
Minimum
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
is 0 - 512 characters. These fields can be one of the following:
and
represent the field length. If
Maximum
Description
Description
Temporary Buffer Field
Array Buffer Field
[
, type
] [ , [
invalid label
src1, and optionally, src2,
minimum
is 4 and
] [
, valid label
and places it in
maximum
minimum
and
] ]
is
Number Number prefixed by a
NOTE: Use the FETCH command if both
Optional Fields
Type
specifies the input's character type as:
Type
N Numeric only
A Alphanumeric
Type
Alphanumeric is the default for
Examplef
See Also FETCH
overrides what you set up with the DATATYPE and CHARTYPE commands.
DATATYPE or CHARTYPE).
Invalid
chapter.
This example retrieves data from the communications port.
GET COMM,#0,#255
and
valid labels
are discussed in “Script Flow" at the beginning of this
number sign (#)
minimum
Description
type
(only when you do not set up a
and
maximum
equal zero.
type
with
5-44 Command Reference
HOTKEY
Purpose Defines hot keys.
Syntax HOTKEY
Process The HOTKEY command defines
function-name
Key
Key
F1 Function Key 1
F2 Function Key 2
F3 Function Key 3
Example
See Also DISABLE
This example specifies that, when the operator presses F3, the application calls the QUERY_LOOKUP function.
HOTKEY F3, QUERY_LOOKUP
ENABLE
key, function-name
when the operator presses it.
can be one of the following:
Description
key
, specifying that the application should call
Command Reference 5-45
IF
Purpose Performs a series of one or more commands if a certain condition exists.
Syntax IF
Process The IF command directs script flow by determining if a condition or series of
buffer-field1 comparison buffer-field2
. . . [ELSEIF . . . [ELSE] . . . ENDIF
conditions exist. A condition is specified by comparing buffer fields. If the comparison is true (the condition exists), the script executes the commands on the lines following the condition. If the comparison is not true (the condition does not exist), control passes to the
line after the ENDIF.
next ELSEIF.
first line after the ELSE.
buffer-field2 comparison buffer-field4
]
You may nest IFs, but every IF must have a corresponding ENDIF.
NOTE: Do not use IF inside a macro.
The
buffer-fields
Buffer-fields
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
String
Number
can be one of the following:
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes Number prefixed by a number sign (#)
5-46 Command Reference
Comparison
can be one of the following:
Comparison
= Equals
== Equals
<> Not equal
!= Not equal
> Greater than
>= Greater than or equal
< Less than
<= Less than or equal
Optional Fields ELSEIF provides another set of commands to execute if another condition exists.
For example,
IF NAME == "JOHNSON" INC JCOUNT ELSEIF NAME == "SMITH" INC SCOUNT ENDIF
counts the number of records where NAME is Johnson or Smith. The first condition
is (NAME equals Johnson). The second condition is (NAME equals SMITH).
Description
Use ELSE to provide a final set of commands to execute if no conditions exist.
Example
See Also COMPARE
This example checks the value of TASTATE. If it contains OHIO, the first MOVE command copies TASTATE to PASTATE. Otherwise, the second MOVE command copies the string "Out of State" to PASTATE.
IF TASTATE == "OHIO" MOVE TASTATE,PASTATE ELSE MOVE "Out of State",PASTATE ENDIF
SWITCH WHILE
Command Reference 5-47
INC
Purpose Increments numeric fields by one.
Syntax INC
Process The INC command increments
Buffer-field
Rule:
Optional Fields
If you increment an uninitialized field, the software sets
buffer-field
Buffer Field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field
alphanumeric field.
Invalid
chapter.
passes to
and
[ , [
invalid label
can be one of the following:
must be numeric. A translation error occurs if you increment an
valid labels
invalid label
are discussed in “Script Flow" at the beginning of this
. If the field overflows, control also passes to
] [
, valid label
buffer-field
Description
Temporary Buffer Field
Array Buffer Field
.
] ]
buffer-field
to 1 and control
invalid label
.
Example
See Also ADD
This example increments COUNT01.
INC COUNT01
DEC SUB MULTIPLY DIVIDE
5-48 Command Reference
INCLUDE
Purpose Inserts another source file into the script.
Syntax INCLUDE
Process The INCLUDE command signals the compiler to insert the source statements
located in the file
Rule: Nested INCLUDE statements are not allowed. But, multiple INCLUDE statements
in one file are allowed.
Example 1
Example 2
This example inserts the source file TRUCKIN.ULT into the current script.
INCLUDE TRUCKIN.ULT
This example inserts the source file SPECIAL.ULT into the current script.
INCLUDE C:\PROGS\SAMPLE\SPECIAL.ULT
pathname
pathname
, into the current script.
Command Reference 5-49
INSERT
Purpose Inserts data from one buffer into another.
Syntax INSERT
[
,
[
Process The INSERT command inserts data from
position
The
Overwrite-flag
overwrite-flag , buffer-field1 , buffer-field2 , position
invalid label
.
Overwrite-flag
I Insert data into field, pushing
O Overwrite existing data in field
buffer-field
Buffer Field1
] [
, valid label
can be one of the following:
Description
existing data over
fields can be one of the following:
and
] ]
Description
position
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Temporary Buffer Field
buffer-field1
into
bufferfield2
at a specified
Logical Field Name (Field1) [Index]
Buffer-field1
only: Number
Buffer-field1
String
Rule:
Optional Fields If there is not enough room in
Invalid
Example
See Also VALIDATE
Position
chapter.
This example inserts "This text will be inserted" into ASZPRICE at position POSNUM.
INSERT I,"This text will be inserted",ASZPRICE,POSNUM
must be numeric.
and
and
position
only:
valid labels
are discussed in “Script Flow" at the beginning of this
Array Buffer Field
Number prefixed by a number sign (#)
ASCII string delimited by double quotes
buffer-field2
, control passes to
invalid label
.
5-50 Command Reference
JUMP
Purpose JUMP transfers control to another location.
Syntax JUMP
Process The JUMP command unconditionally transfers control to the specified label. If the
script is re-entered, control passes to the script's first line.
Rule: You cannot jump out of a function.
Example
See Also CALL
This example transfers control to the label *REQUEST_SKU.
JUMP *REQUEST_SKU
label
Command Reference 5-51
LABELCOUNT
Purpose Sets a field to the current number of labels printed.
Syntax LABELCOUNT
Process The LABELCOUNT command sets
printed.
Buffer-field1
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Optional Fields
Example
Invalid
chapter.
This example sets NUMOFLABELS to the number of labels the printer has printed.
LABELCOUNT NUMOFLABELS
and
buffer-field1 [ , [ invalid label
field can be one of the following:
Description
Temporary Buffer Field
Array Buffer Field
valid labels
are discussed in "Script Flow" at the beginning of this
] [
buffer-field1
, valid label
to the current number of labels
] ]
5-52 Command Reference
LEFT
Purpose Extracts the left-most character from a string.
Syntax LEFT
Process The LEFT command extracts the left-most characters from
them into
The
buffer-field1
buffer-field2
buffer-field
fields can be one of the following:
Buffer-field1 2
,
buffer-field2
.
Length
and
,
length [ , [ invalid label
specifies the number of characters.
Description
Length
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
only: Number
Buffer-field1
String
and
only:
length
Temporary Buffer Field
Array Buffer Field
Number prefixed by a number sign (#)
ASCII string delimited by double quotes
] [
, valid label
buffer-field1
] ]
and copies
Rule:
Optional Fields
Example 1
Example 2
See Also
Length
Invalid
chapter.
This example extracts the five left-most characters from SHIP_NO and copies them to SKU.
LEFT SHIP_NO,SKU,#5
This example extracts the NUMCHARS left-most characters from SHIP_NO and copies them to SKU.
LEFT SHIP_NO,SKU,NUMCHARS
LSTRIP MID RIGHT RSTRIP
must be numeric.
and
valid labels
are discussed in "Script Flow" at the beginning of this
Command Reference 5-53
LINKFILE
Purpose Links formats, files, or packets to the script.
Syntax For files or packets created using a text editor.
LINKFILE
Process The LINKFILE command links formats to the script. You can include any number of
files in the download datastream. The LINKFILE command downloads formats, files, or packets created using a text editor.
These commands add a line to the .CFU file's header which tells the transfer
program to download the file specified by specify a path, the transfer program looks for a format in the \PLATFORM\FORMATS directory.
Rule: Link files before FUNCTION START.
Example 1
This example downloads CHCKDGIT.PKT (created in MPCL with a text editor) to the printer.
LINKFILE CHCKDGIT.PKT
file-name
format-name\file-name
. If you do not
5-54 Command Reference
LOCATE
Purpose Moves the cursor to a specified position on the printer’s screen.
Syntax LOCATE
Process The LOCATE command moves the cursor to the (
on the printer’s screen. The range for ranges are 1-15 (for rows 1 and 2) and 1-20 (for row 3).
Example
Row-position and col-position
This example moves the cursor to the first row and second column of the screen.
LOCATE #1, #2
row-position, col-position
row-position
can be one of the following:
Source
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Number A number prefixed by
Description
Temporary Buffer Field
the number sign (#).
row-position, col-position
is 1-3. For
col-position
) position
the
Command Reference 5-55
LOWER
Purpose Converts characters in a field from upper-case to lower-case.
Syntax LOWER
Process The LOWER command converts characters in
Example
See Also
Source
This example converts any upper case characters in TEMP_SKU to lower-case characters.
LOWER TEMP_SKU
UPPER
source
can be one of the following:
Source
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Description
Temporary Buffer Field
Array Buffer Field
source
to lower-case characters.
5-56 Command Reference
LSTRIP
Purpose Strips characters from a field, and copies the remaining characters to another field.
Syntax LSTRIP
Process The LSTRIP command strips the left-most characters from
the remaining characters to to strip.
Field-buffer1, field-buffer2
field-buffer1, field-buffer2, field-buffer3 [ , [ invalid label
Field-buffer1, Field-
field-buffer2
, and
field-buffer3
Description
.
Field-buffer3
can be one of the following:
is the number of characters
Buffer2, and Field­Buffer3
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Field-buffer1 buffer2
String
Field-buffer3
Number
only:
and
only:
Field-
Temporary Buffer Field
ASCII string delimited by double quotes.
Number prefixed by a number sign (#)
] [
, valid label
field-buffer1
] ]
and copies
Optional Fields
Example
See Also
Invalid
chapter.
This example strips the five left-most characters from the SHIP_NO field and copies the remaining characters to the SKU field.
LSTRIP SHIP_NO, SKU, #5
TSTRIP RSTRIP CSTRIP
and
valid labels
are discussed in "Script Flow" at the beginning of this
Command Reference 5-57
MACRO
Purpose Defines or invokes a single command the software expands to multiple commands
during script translation.
Syntax To define the macro ...
MACRO
BEGIN
macro-body
END
To invoke the macro ...
macro-name
Process The MACRO command defines or invokes a macro. A macro is a single command
the software expands to multiple commands during script translation. Each time a macro command appears, the software inserts the commands it generates into the script.
NOTE: Do Not use IF, SWITCH, or WHILE inside a macro.
Defining the Macro ...
The
commands defining what the macro does. The keywords BEGIN and END define
macro-body
boundary.
Keep macros in a separate macro file you include in the source script using the
INCLUDE command.
Rule: You must define macros before invoking them.
macro-name
arg1 , arg2 , ... , arg99
macro-name
's boundary and limit the scope of control transfer to within the
is an identifier naming the macro. The
macro-body
contains the
Invoking the Macro ...
The macro matches arguments. The first argument replaces %1, the second
argument replaces %2, and so on, up to %99 arguments.
Labels are handled differently in macros. The label names inside the macro body
should use this form:
*macro-label-name$
where
eight characters. This restriction helps avoid duplicate labels if a macro appears within a function more than once.
As the compiler expands each macro ...
it expands the labels.
it expands each dollar sign ($) into a unique three-digit number.
macro-label-name
is a unique name for the macro. The label can be up to
5-58 Command Reference
Example
This example defines a macro (PTRIDLE) to check the status of the printer.
DEFINE TEMPORARY, tEnqStatus, 3 DEFINE TEMPORARY, tPrinterOK, 1, N
MACRO PTRIDLE BEGIN MOVE #0, %1 CHECK ENQSTATUS, tEnqStatus COMPARE tEnqStatus, EQ, "A@", *PI_END_$ MOVE #1, %1 *PI_END_$ END
Command Reference 5-59
MID
Purpose Extracts a sub-field from a string.
Syntax MID
Process The MID command extracts a sub-field from
Buffer-field1, buffer-field2, start
buffer-field1
field2
; starting with the
,
Buffer-field1, 2, Start
buffer-field2
start
position and extracting
and
,
start
,
length [ , [ invalid label
, and
length
Description
Length
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
String
Buffer-field1, start, length
Number
only:
and
only:
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes
Number prefixed by a number sign (#)
] [
, valid label
buffer-field1
can be one the following:
and copies it into
length
number of characters.
] ]
buffer-
Rules:
Optional Fields
If
Example 1
Example 2
See Also
Length
Invalid
chapter. The exception is as follows:
control passes to that label.
This example extracts a five-character substring starting at position 5 of LOCATION and copies it into TEMP1.
MID LOCATION,TEMP1,#5,#5
This example extracts a substring of LengthNum characters starting at position StartNum of LOCATION and copies it into TEMP1.
MID LOCATION,TEMP1,StartNum,LengthNum
LEFT LSTRIP RIGHT RSTRIP
and
Start
and
valid labels
buffer-field2
overflows,
must be numeric.
are discussed in "Script Flow" at the beginning of this
start
is greater than
length
, or
invalid label
is defined,
5-60 Command Reference
MOVE
Purpose Copies data between fields.
Syntax MOVE
Process The MOVE command copies data between fields. The contents of
the contents of
Source
source, destination
destination
can be one of the following:
Source
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
String
only:
Buffer-field1, start, length
Number
only:
[ , [
invalid label
with no effect on
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes
and
Number prefixed by a number sign (#)
] [
, valid label
source
.
] ]
source
replaces
SCRATCH Scratch Buffer
Command Reference 5-61
Destination
can be one of the following:
Destination
INPUT Input Buffer
DISPLAY The Printer’s Screen
SCRATCH Scratch Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1, start, length
Number
Buffer-field1
String
You can move a numeric field into an alphanumeric field. However, you cannot
move an alphanumeric field into a numeric field.
only:
only:
and
Description
Temporary Buffer Field
Array Buffer Field
Number prefixed by a number sign (#)
ASCII string delimited by double quotes
Optional Fields
Example 1
Invalid
chapter.
This example copies the data from the Input Buffer to CONTROL_ID.
MOVE INPUT,CONTROL_ID
and
valid labels
are discussed in "Script Flow" at the beginning of this
5-62 Command Reference
MULTIPLY
Purpose Multiplies the contents of one field by the contents of another.
Syntax MULTIPLY
[ ,
valid label
Process The MULTIPLY command multiplies
product into
The maximum value for the
429,496,795.
The
buffer-field
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
Number
buffer-field1
] ]
buffer-field2
,
buffer-field2
.
buffer-field1, buffer-field2
fields can be one the following:
and
2
only:
Description
Temporary Buffer Field
Array Buffer Field
Number prefixed by a number sign (#)
[ , [
invalid label
buffer-field1
]
by
buffer-field2
, and the result is
, inserting the
Rule: The
Optional Fields
Example
See Also
buffer-field
Invalid
chapter.
This example multiplies PRICE by TEMP1, inserting the product into TEMP1. If TEMP1 overflows, control passes to *ERROR2. If TEMP1 does not overflow, control passes to the next line.
MULTIPLY PRICE,TEMP1,*ERROR2
DIVIDE INC SUB ADD DEC
and
fields must be numeric.
valid labels
are discussed in "Script Flow" at the beginning of this
Command Reference 5-63
OPENCOMM
Purpose Opens either the primary or secondary communications port. The port stays open
until it is closed with CLOSECOMM.
Syntax OPENCOMM
Process The OPENCOMM command opens the communications port referenced by
commport
Timeout
data during a GET or FETCH. If a timeout occurs, control passes to the GET or FETCH invalid label. A
defines the length of time (0-255, in seconds) that the printer waits for
Commport
Commport and Timeout
INPUT Input Buffer
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Number A number prefixed by
Example
This example opens the primary communications port, and times out after 120 seconds.
commport, timeout
(1 for the primary port or 2 for the secondary port).
timeout
and
timeout
must be numeric and can be one of the following:
of 0 means the port waits indefinitely for data.
Description
Temporary Buffer Field
a pound (#) sign.
See Also
OPENCOMM #1, #120
CLOSECOMM
5-64 Command Reference
PAD
Purpose Pads data in a field.
Syntax PAD
Process The PAD command pads data in
Direction
direction
with
pad-character
data is seven characters and the length is ten, three characters are added to the field.
,
pad-field
.
can be one of the following:
,
pad-character
Max-length
Direction
L Pad left
R Pad right
Pad-field, pad-character
, and
max-length
Pad-field, Pad-character,
and
Max-length
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
,
max-length
pad-field
indicates the field's length. For example, if the
Description
Description
Temporary Buffer Field
, in the direction specified by
can be one of the following:
direction
,
Rule: If
Example 1
Example 2
Pad-field
Logical Field Name (Field1) [Index]
Pad-character length
Number
Pad-character
String
max-length
This example inserts asterisks (*) to the left of the data in PRICEFIELD.
PAD L,PRICEFIELD,"*",LPRICE
This example inserts blanks to the right of the data.
PAD R,LDESC," ",#2
only:
and
max-
only:
only:
is a buffer field, it must be numeric.
Array Buffer Field
Number prefixed by a number sign (#)
ASCII string delimited by double quotes. Must be one character long
Command Reference 5-65
PARSE
Purpose Processes an MPCL data stream in the scratch buffer.
Syntax PARSE [
Process The PARSE command invokes the printer's MPCL parser to analyze and process
the scratch buffer's contents.
In general, the PARSE command will out perform (speed to label out) the PRINT
command. If you have the option of using either command (PARSE or PRINT), PARSE is the better option.
NOTE: You must place an MPCL data stream in the scratch buffer before calling this
command.
Avoid using the PARSE command to send individual characters; use the CONCAT
command to append data into the scratch buffer. Then send all the data at once using the PARSE command.
Optional Fields
Example
Invalid
chapter.
This example moves an MPCL data stream to the scratch buffer, then processes the data stream.
MOVE "{F,1,A,N,E,200,200,”FMT1”¦”, SCRATCH CONCAT "C,146,50,0,10,2,1,B,L,0,0,"PAT'S PARTS",1¦", SCRATCH CONCAT "T,1,10,V,100,50,0,1013,3,1,B,L,0,0,1¦", SCRATCH CONCAT "T,2,15,V,80,25,0,10,1,1,B,L,0,0,1¦", SCRATCH CONCAT "L,V,67,1,0,180,10,"" ¦", SCRATCH CONCAT "B,3,12,F,12,43,1,2,50,1,L,0¦}", SCRATCH PARSE
[ invalid label
and
valid labels
] [
, valid label
are discussed in "Script Flow" at the beginning of this
] ]
NOTE: You cannot nest double quotes. You must use ~034 instead of a double quote. In
the above example, use ~034FMT1~034 for "FMT1".
5-66 Command Reference
PRINT
Purpose Prints the Printer Buffer's contents, by a source field, in the format specified.
Syntax PRINT [ CONTINUOUS ] #
[
, [ invalid label
Process The PRINT command images and prints the format specified by
Format-number
than 255 cannot be constants. If Use this method to avoid reimaging the data.
Quantity
printing each label. However, the printer does not pause when you use CONTINUOUS and labels in
represents the number of labels to print. The printer pauses before
quantity
Format-number
Format-number
] [
, valid label
contains a format number between 0 and 999. Numbers greater
quantity
.
Quantity
and
quantit
and
format-number,
] ]
format-number
is greater than 1; it prints one strip with the number of can be 1-99 (the default is 1).
y can be one of the following:
Description
[ quantity ]
equals 0, the same image prints.
quantity
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Temporary Buffer Field
Array Buffer Field
format-number
.
Rule:
Optional Fields
Example
Number Number prefixed by a
number sign (#)
Format-number
Invalid
chapter.
This example prints the Printer Buffer's contents using Format 2 and then passes control to the next line if successful. If the operator presses an exception key, control passes to *Exception.
PRINT #2,*Exception
and
and
quantity
valid labels
must be numeric.
are discussed in "Script Flow" at the beginning of this
Command Reference 5-67
QUERY
Purpose Searches the lookup file to find a specified record.
Syntax QUERY
Process The QUERY command searches the lookup file to find a record containing a
specific value.
NOTE: If multiple records contain the value, the command reads the first record fitting the
criteria.
Buffer-field1
Comparison
buffer-field1
specifies the buffer to search and can be one of the following:
Buffer-field1
Logical Field Name (LU1) Lookup Buffer Field
defines the type of query and can be one of the following:
Comparison
EQ Contents of
LT Contents of
LE Contents of
,
comparison
Description
to the contents of
than the contents of
than or equal to the contents of
buffer-field2
,
buffer-field2 [ , [ invalid label
Description
buffer-field1
is equal
buffer-field2
buffer-field1
is less
buffer-field2
buffer-field1
is less
] [
, valid label
] ]
GT Contents of
GE Contents of
Buffer-field2
the following:
specifies the buffer holding the value to search on and can be one of
Buffer-field2
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
String
buffer-field1
than the contents of
buffer-field1
than or equal to the contents of
buffer-field2
Description
Temporary Buffer Field
Array Buffer Field
ASCII string delimited by double quotes Must be one character long
is greater
buffer-field2
is greater
Number Number prefixed by a
number sign (#)
If the query is successful and finds the record, the pointer is set to that record.
5-68 Command Reference
Rule:
Buffer-field1
is numeric, If the record is not found, the pointer is undefined. The script must execute the command again to ensure a valid record pointer.
and
buffer-field2
buffer-field2
must be the same type. For example, if
must be numeric.
buffer-field1
Optional Fields
If the search fails to find the requested field or it detects end of file, control passes
Example
See Also
Invalid
chapter. The exception is as follows:
to
This example searches the CONTROL_ID field for an exact match with the Input Buffer's contents. If there is no match, control passes to *ERROR_ID. Otherwise, control passes to the *PROCESS_ID.
QUERY CONTROL_ID,EQ,INPUT,*ERROR_ID,*PROCESS_ID
READ SEEK
and
valid labels
invalid label
are discussed in "Script Flow" at the beginning of this
.
Command Reference 5-69
READ
Purpose Copies the current record from the lookup file into the appropriate working buffer.
Syntax READ
Process The READ command copies the current record into the appropriate working buffer,
specified by pointer advances to the next table to read.
Record
Rule: A successful read increments the file pointer to the next record.
Optional Fields
If there is no record to read or the current record is pointing to a different record
Example
Invalid
chapter. The exception is as follows:
type, and
This example shows how the software copies the current lookup table record into the lookup table buffer. Control passes to the next line.
READ LOOKUP
record [ ( table-name )
record
can be one of the following:
Record
LOOKUP Copies the Lookup Table record into the Lookup
and
valid labels
invalid label
. After the script copies the current record into the buffer, the
Description
Buffer
are discussed in "Script Flow" at the beginning of this
is defined, control passes to that label.
] [ , [
record
invalid label
in the file.
] [
, valid label
Table-name
] ]
selects which lookup
See Also
BSEARCH QUERY SEEK
5-70 Command Reference
RESTORESCREEN
Purpose Re-displays a previously-saved screen.
Syntax RESTORESCREEN
Process The RESTORESCREEN command restores the contents of a previously saved
screen to the screen, overwriting the current screen’s contents. The SAVESCREEN command saved the original screen and stored it in the internal screen buffer.
Example
See Also
This example restores contents of the original screen (containing “1234567890”) to the screen, overwriting the screen’s current contents.
CLEAR DISPLAY MOVE “1234567890”, DISPLAY SAVESCREEN CLEAR DISPLAY MOVE “0987654321”, DISPLAY RESTORESCREEN
SAVESCREEN
Command Reference 5-71
RETURN
Purpose Breaks out of a subroutine.
Syntax RETURN
Process The RETURN command breaks out of a subroutine. It transfers control back to the
command following the CALL activating the subroutine.
NOTE: Using END in a subroutine also implies a RETURN. Therefore, the RETURN
command is not required as the last command of a subroutine.
Example
See Also
This example breaks out of a subroutine.
COMPARE FSIZE,EQ,#12,,*GOODDATA RETURN
CALL
5-72 Command Reference
RIGHT
Purpose Extracts the right-most characters from a string.
Syntax RIGHT
[
, valid label
Process The RIGHT command extracts the right-most characters from
specified by
The
buffer-field1
] ]
length
buffer-field
, and copies them into
fields can be one of the following:
Buffer-field1, 2
,
buffer-field2
and
,
length [ , [ invalid label
buffer-field2
Description
]
.
length
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Buffer-field1
String
Buffer-field1
only: Number
only:
and
length
Temporary Buffer Field
ASCII string delimited by double quotes. Must be one character long
Number prefixed by a number sign (#)
buffer-field1
,
Rule:
Optional Fields
Example 1
Example 2
See Also
Length
Invalid
chapter.
This example extracts the five right-most characters from SHIP_NO and copies them to SKU.
RIGHT SHIP_NO,SKU,#5
This example extracts the NUMCHARS right-most characters from SHIP_NO and copies them to SKU.
RIGHT SHIP_NO,SKU,NUMCHARS
LEFT LSTRIP MID RSTRIP
must be numeric.
and
valid labels
are discussed in "Script Flow" at the beginning of this
Command Reference 5-73
RSTRIP
Purpose Strips characters from a field, and copies the remaining characters to another field.
Syntax RSTRIP
Process The RSTRIP command strips the right-most characters from
copies the remaining characters to characters to strip.
Buffer-field1, buffer-field2
buffer-field1, buffer-field2, length [ , [ invalid label
buffer-field2
, and length can be one of the following:
Buffer-field1, Buffer-field2
and
Length
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Field-buffer1 buffer2
String
Length
Number
only:
only:
and
Field-
,
Description
Temporary Buffer Field
ASCII string delimited by double quotes.
Number prefixed by a number sign (#)
.
Length
is the number of
] [
, valid label
buffer-field1
] ]
and
Optional Fields
Example
See Also
Invalid
chapter.
This example strips the five right-most characters from the SHIP_NO field and copies the remaining characters to the SKU field.
RSTRIP SHIP_NO, SKU, #5
LSTRIP CSTRIP TSTRIP
and
valid labels
are discussed in "Script Flow" at the beginning of this
5-74 Command Reference
SAVESCREEN
Purpose Saves the contents of the current screen.
Syntax SAVESCREEN
Process The SAVESCREEN command moves the contents of the current screen to the
internal screen buffer. The RESTORESCREEN command re-displays the saved screen.
NOTE: The internal screen buffer is cleared (and therefore the screen is lost) when the
READY prompt appears, you calibrate the printer, or the application ends.
Example
See Also
This example displays “1234567890” on the screen and saves it.
CLEAR DISPLAY MOVE “1234567890”, DISPLAY SAVESCREEN
RESTORESCREEN
Command Reference 5-75
SEEK
Purpose Positions the record pointer within the lookup table.
Syntax SEEK
Process The SEEK command positions the record pointer within the lookup table, according
to
Modifier
File-type
Table-name
modifier
modifier
specifies the current record's placement and can be one of the following:
Modifier
NEXT Advance to next
PREVIOUS Move to previous
START Reset to beginning of
END Advance to last
specifies the type of file and can be one of the following:
File-type
LOOKUPFILE Lookup Table File
,
file-type [ ( table-name )
.
Description
record
record
file
record
Description
selects which lookup table to seek.
] [ , [
invalid label
] [
, valid label
] ]
Optional Fields
Example 1
See Also
Invalid
chapter. The exceptions are as follows: If the NEXT modifier advances the current record past the end of the file, or the PREVIOUS modifier moves the current record before the beginning of the file, control passes to When the selected file is empty, any modifier triggers an end of file condition. Then, control passes to
This example advances the current record in the lookup table by one record, and if an end of file condition occurs, control passes to *EOF_LABEL.
SEEK NEXT,LOOKUPFILE,*EOF_LABEL
QUERY READ
and
valid labels
are discussed in "Script Flow" at the beginning of this
invalid label
(if defined).|
invalid label
(if defined).
5-76 Command Reference
SUB
Purpose Subtracts the contents of one field from the contents of another.
Syntax SUB
Process The SUB command subtracts the contents of
The
Rule: Only numeric fields are allowed.
Optional Fields
buffer-field1
buffer-field2
buffer-field
Buffer-field1
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index]
Buffer-field1
Number
Invalid
chapter. The exception is as follows:
and
valid labels
,
buffer-field2 [ , [ invalid label
, inserting the result into
fields can be one the following:
and
2
only:
are discussed in "Script Flow" at the beginning of this
buffer-field2
Description
Temporary Buffer Field
Array Buffer Field
Number prefixed by a number sign (#)
] [
, valid label
buffer-field1
.
] ]
from the contents of
If
Example
See Also
buffer-field2
label.
This example subtracts the contents of CONTROL_ID from TEMP1. Then, control passes to the next line.
SUB CONTROL_ID,TEMP1
ADD DEC INC MULTIPLY DIVIDE
becomes negative and
invalid label
is defined, control passes to that
Command Reference 5-77
SWITCH
Purpose Directs script flow by branching to a set of commands based on the value of a
variable.
Syntax SWITCH
CASE . . . CASE . . . DEFAULT . . . ENDSWITCH
Process The SWITCH command directs script flow by branching to a set of commands
based on the value of a variable. The command compares
buffer-field
executes the commands following the CASE command. Execution stops when the script reaches the next CASE, DEFAULT, or ENDSWITCH.
If no
after DEFAULT.
buffer-field1
buffer-field
buffer-field
listed with each case command. If the fields are equal, the script
buffer-field
fields match
buffer-field1
buffer-field1
, the script executes the set of commands
to the
NOTE: There is no BREAK command to terminate CASE blocks, so this command does not
support CASE fall-through. Also, Do Not use SWITCH inside a macro.
The
buffer-field
fields can be one of the following:
Buffer-field
INPUT Input Buffer
Logical Field Name (TEMP1)
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Number
String
Description
Temporary Buffer Field
Number prefixed by a number sign (#) ASCII string delimited by double quotes. Must be one character long
5-78 Command Reference
Loading...