Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 28 of 47

PDT 1100 Terminal Programmer's Guide: Chapter 10 Statement Reference, pages 251 to 260

Pages 251 to 260 of 413, from PDT 1100 Terminal Programmer's Guide

The original document is the PDF (3.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Symbol PDT-1100

Page 251

Function Reference

ASC Function Name: ASCii code

Type: String Function

Description Returns the ASCII code value of a given character.

Syntax ASC(stringexpression)

Notes ASC returns the ASCII code value of the first character of stringexpression, which is an integer from 0 to 255. (For the ASCII character codes, refer to Appendix C, Character Sets.) !

If stringexpression is a null string, this function returns the value 0.

Reference Functions

CHR$

11-3

Page 252

PDT 1100 Terminal Programmer’s Guide

BCC$ Function Name: Block Check Character

Type: String Function

Description Returns a block check character (BCC) of a data block.

Syntax BCC$(datablock, checktype)

where: datablock = A string expression. checktype = A numeric expression which returns a value from 0 to 2.

Notes BCC$ calculates a block check character (BCC) of datablock according to the block checking method specified by checktype, and returns the BCC. checktype is 0, 1, or 2 which specifies SUM, XOR, or CRC-16, respectively, as described below.

!

Table 11-1. Block Checking Method and Description checktype

Block No. of checking chars for method BCC

BCC

Generative polynomial

0

SUM

1

Lowest one byte of the sum of all character codes contained in a datablock.

1

XOR

1

One byte gained by XORing all character codes contained in a datablock.

2

CRC-16

2

Two bytes gained from the cyclic redundancy X16 +X15 +X2 +1 check operation applied to bit series of all characters in datablock with the bit order in each byte inverted.

11-4

Page 253

Function Reference

!

BCC$ performs block checking and generates a BCC for a data block.

Execution Error Error code

Meaning

05h

Parameter out of range (checktype is out of range.)

11-5

Page 254

PDT 1100 Terminal Programmer’s Guide

CHKDGT$ Function Name: CHecK DiGiT

Type: String Function

Description Returns a check digit of bar code data.

Syntax CHKDGT$(barcodedata, CDtype)

where: barcodedata and CDtype = String expressions.

Notes CHKDGT$ calculates a check digit (CD) of barcodedata according to the calculation method specified by CDtype and returns it as one-character string. CDtype is A, I, M or N, which specifies the bar code type and the corresponding calculation method as listed below.

CDtype

Bar Code Type

A

EAN and UPC

I

ITF (Interleaved 2 of 5) MOD-10 (Modulo arithmetic-10)

M

Code-39

MOD-43 (Modulo arithmetic-43)

N

NW-7 (Codabar)

MOD-16 (Modulo arithmetic-16)

CDtype may be in lowercase.

11-6

Calculation Method MOD-10 (Modulo arithmetic-10)

Page 255

Function Reference

When CDtype is A (EAN or UPC), this function identifies the EAN or UPC of barcodedata depending upon the data length (number of digits) as listed below. Data length of barcodedata Universal Product Codes 13

EAN-13 or UPC-A

8

EAN-8

7

UPC-E

If the data length is a value other than 13, 8, and 7, this function returns a null string. !

To check that the CD is correct, pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. IF CHKDGT$(“49400458”,”A”)=”8” Sample coding: THEN...

!

To add a CD to bar code data, pass barcodedata followed by a dummy character to a CHKDGT$ as shown below. The returned value will become the CD to be replaced with the dummy character. PRINT “4940045”+CHKDGT$(“4940045”+”0”,”A”) Sample coding: 49400458

When CDtype is I (ITF), the length of barcodedata must be an even number of two or more digits. If not, this function returns a null string. !

To check that the CD is correct, pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. IF CHKDGT$(“123457”,”I”)=”7” Sample coding: THEN...

!

To add a CD to bar code data, pass barcodedata followed by a dummy character to a CHKDGT$ as shown below. The returned value becomes the CD to be replaced with the dummy character. PRINT “12345”+CHKDGT$(“12345”+”0”,”I”) Sample coding: 123457

When CDtype is M (Code 39), the length of barcodedata must be two or more digits not including start and stop characters. If not, this function returns a null string.

11-7

Page 256

PDT 1100 Terminal Programmer’s Guide

!

To check that the CD is correct, pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. IF CHKDGT$(“CODE39W”,”M”)=”W” Sample coding: THEN...

!

To add a CD to bar code data, pass barcodedata followed by a dummy character to a CHKDGT$ as shown below. The returned value will become the CD to be replaced with the dummy character. PRINT “CODE39”+CHKDGT$(“CODE39”+”0”,”M”) Sample coding: CODE39W

When CDtype is N (NW-7), the length of barcodedata must be three digits or more including start and stop characters. If not, this function returns a null string. !

To check that the CD is correct, pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. IF CHKDGT$(“a0123-a”,”N”)=”-” Sample coding: THEN...

!

To add a CD to bar code data, pass barcodedata followed by a dummy character and include start and stop characters to a CHKDGT$ as shown below. The returned value becomes the CD to be replaced with the dummy character. ld%=LEN(“a0123a”) Sample coding: PRINT LEFT$(“a0123a”,ld%-1)+CHKDGT$ (“a01230a”,”N”)+RIGHT$(“a0123a”,1) a0123-a

Execution Error Error code

Meaning

05h

Parameter out of range (CDtype is out of range.)

Reference Statements

11-8

OPEN “BAR:”

Page 257

Function Reference

CHR$ Function Name: CHaRacter code

Type: String Function

Description Returns the character corresponding to a given ASCII code.

Syntax CHR$(characode)

where: characode = A numeric expression which returns a value from 0 to 255.

Notes CHR$ converts a numerical ASCII code specified by characode into the equivalent single-byte character. This function sends control codes (e.g., ENQ and ACK) to a communications device file or displays a double quotation mark or other characters having special meanings in the BASIC 3.0.

Execution Error Error code

Meaning

05h

Parameter out of range ( characode is out of range.)

Example !

To output an ACK code to a communications device file, use CHR$(&H06). The ASCII value for the ACK code is &H06. PRINT #1,CHR$(&H06);

!

!

To display control codes from 8 (08h) to 31 (1Fh), refer to the program examples shown in the PRINT statement. To display double quotation marks around a string, use CHR$(34) as shown below. The ASCII value for a double quotation mark is 34 (22h).

11-9

Page 258

PDT 1100 Terminal Programmer’s Guide

PRINT CHR$(34);”bar code”;CHR$(&H22) “bar code”

Reference Statements

PRINT

Functions

ASC

11-10

Page 259

Function Reference

COUNTRY$ Function Name: COUNTRY

Type: I/O Function

Description Sets a national character set or returns a current country code.

Syntax Syntax 1 (Setting a national character set) COUNTRY$=“countrycode”

Syntax 2 (Returning a country code) COUNTRY$ where: countrycode = A string expression--A, D, E, F, G, I, J, N, S, or W

Notes Syntax 1 COUNTRY$ sets a national character set specified by countrycode. The national character set is assigned to codes from 32 (20h) to 127 (7Fh). (Refer to National Character Sets on page C-3.) !

“countrycode” specifies one of the following national character sets: countrycode

National character set

A

America (default)

D

Denmark

E

England

F

France

G

Germany

11-11

Page 260

PDT 1100 Terminal Programmer’s Guide

!

! !

! ! !

I

Italy

J

Japan (default)

N

Norway

S

Spain

W

Sweden

After setting a national character set, you may display it for codes from 32 (20h) to 127 (7Fh) on the LCD. If “countrycode” is omitted, the default national character set is America (code A) . “countrycode” set by this function is effective in the programs chained by CHAIN statements. If “countrycode” has more than one character, only the first takes effect. If “countrycode” is a letter other than those listed above, the function is ignored. “countrycode” may be in lowercase. COUNTRY$=“j”

Syntax 2 COUNTRY$ returns a current country code as an uppercase alphabetic letter.

11-12