Monarch 9460 Printer User Manual


 
Command Reference 5-37
DIVIDE
Purpose Divides the contents of one field by the contents of another.
Syntax DIVIDE
buffer-field1
,
buffer-field2
[ , [
invalid label
] [
, valid label
] ]
Process The DIVIDE command divides
buffer-field1
by
buffer-field2
and inserts the quotient
into
buffer-field2
. This command performs integer division and truncates the
remainder.
Buffer-field1
contains the dividend while
buffer-field2
is the divisor. These
variables can be one of the following:
Buffer Field1
and
2
Description
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]
Array Buffer Field
Number Number prefixed by a
number sign (#)
Rules: You cannot use two numeric literal fields. For example,
If
buffer-field1
contains a numeric literal,
buffer-field2
must contain a
field.
If
buffer-field2
contains a numeric literal,
buffer-field1
must contain a
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
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
Example 2
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
Example 3
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.
DIVIDE PRICE,#100,*ERROR2
See Also MULTIPLY