Command Reference 5-17
BITSHIFT
Purpose Allows bits within a value to be arithmetically shifted left or right.
Syntax BITSHIFT
direction
,
buffer-field1
,
count
[ , [
invalid label
] [ ,
valid label
] ]
Process The BITSHIFT command allows bits within a value to be arithmetically shifted left
or right. Shifts
count
bits in
buffer-field
in the direction specified by
direction
.
Count
can be 1 to 16. If
buffer-field
contains an invalid value or the count field is
out of range and invalid label is defined, control passes to that label. If the
operation is successful and
valid label
is defined, control passes to that label.
RULE: Both
buffer-field1
and
count
must be numeric.
Direction
can be one of the following:
Direction
Description
LEFT Shifts bits left
RIGHT Shifts bits right
Buffer-field1
and
count
can be one of the following:
Buffer-field1
and
count
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
Asc-field only:
Number
String
A number prefixed by
the number sign (#)
ASCII string delimited
by double quotes
SCRATCH Scratch buffer
Optional Fields
Invalid
and
valid labels
are discussed in “Script Flow" at the beginning this chapter.
Example
This example shifts the bits in TEMP1 once to the left, which has the effect of
doubling the value.
BITSHIFT LEFT, TEMP1, #1
See Also BITCLEAR
BITMASK
BITSET
BITTEST