Monarch 9460 Printer User Manual


 
4-4 Program Structure
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
Takes an ASCII character and returns the number corresponding to
it on the ASCII chart.
CHR
Takes a number from 0-255 and returns the corresponding
character on the ASCII chart.
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.