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 30 of 34

MCL-Designer for Phaser Series User's Guide, pages 247 to 256

Pages 247 to 256 of 288

The original document is the PDF (3.0 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 P360 and Symbol P460

Page 247

MCL-Code Reference Guide

Examples VC | &A1 | A 1 ” $ ? | +1 | VCERR Compares variable A1 with following pattern: first character must be ‘A’. second character must be ‘1’. third character must be Alphabetic (A-Z, a-z ). fourth character must be numeric ( 1-9 ). fifth character is not tested. If matched, go to next line ( +1) else go to label VCERR.

7-79

Page 248

MCL-Designer for Phaser Series User’s Guide

Variable Extract (VE) Function Extracts all characters of the defined field and stores them in variable. (Fields are delimited by the separator defined in the command).

Syntax VE | variable | text | fieldnr | separator where: Variable = the name of the receiving variable. Text = the text to store in variable. Fieldnr = field number to be extracted. Separator = character defining the beginning and end of each field. If no separator is used, all text is stored in the variable.

Affected System Variables &99 =

“0” if no error, “1” if field not found (or field does not exist).

Note If “ | ” is the separator, use “\7C” to specify the “ | ” character.

Example VE | A1 | JOHN + ANDREW + PETER | 2 | + Extracts the second field from the text. Fields are separated by “+” (After execution: A1 = “ANDREW”). VE | A0 | &A1 | 2 | \7C

7-80

Extract the second field from the text in variable A1, using '|' as the separator character,and place the result in variable A0.

Page 249

MCL-Code Reference Guide

Variable Format (VF) Function Formats the data in a variable as a string of characters or numbers.

Syntax VF | type | destination | origin [| sign | zero | int | dec] where:

Type = type of format. C =characters. D = numbers. I = Integer. N = Numeric.

Destination = the name of the receiving variable. Origin = the original string to be formatted (may be a variable reference). Only with numeric format:

Sign = add sign to the number S = add ‘+’ or ‘-’ before number. B = add space or ‘-’ before number. N = no sign.

Zero = fill the number with a specified character. Z = fill with ‘0” before number. B = fill with space before number N = remove all “0” and space before number. Anything else = fill with specified character before number

Int = number of digits of integer part. Dec = number of digits of decimal part.

7-81

Page 250

MCL-Designer for Phaser Series User’s Guide

Affected System Variables &99 =

“0” if no error, 1 otherwise.

&98 =

“+” if result >= 0 ( only with numeric formatting ). “-” if result < 0 ( only with numeric formatting ).

Notes 1. When data is defined as characters (C), all non significant zeroes and spaces on the left and right of the variable are deleted. 2. If the data contains decimal numbers, the zero just before the decimal point is not deleted. 3. When the data is defined as a number (D), the integer part is 7 digits in length and the decimal part is 4 digits in length. 4. When the data is defined as a number (I), the return value is coded in 5 characters.

Examples Format C (characters) VF | C | A1 | &B0

Format the data in variable B0 as characters and store the result in variable A1. Example: Before execution: B0 = “0000125.3500” After execution: A1 = “125.35” Example: Before execution : B0 = “0000000.3500” After execution : A1 = “0.35” Example: Before execution : B0 = “0000100.0000” After execution : A1 = “100” Example: Before execution : B0 = “0000000.0000” After execution : A1 = “0” Example: Before execution : B0 = “00100” After execution : A1 = “100”

7-82

Page 251

MCL-Code Reference Guide

Format D (numbers) VF | D | A1 | &F1

Formats the data in F1 as numbers with decimals, and stores the result in variable A1. Example: Before execution : F1 = “100” After execution : A1 = “0000100.0000”

VF | D | G1 | &A0 Formats the data in A0 as numbers with decimals, and stores the result in variable G1. Example: Before execution : A0 = “122.57” After execution : G1 = “0000122.5700”

Format I (Integers) VF | I | A1 | 4

A1 returns 00004.

Format N (numeric) VF | N | A0 | +123747.7489 | S | B | 9 | 6

A0 returns +. . .123747.748900 where the ‘.’ represents a space.

VF | N | A0 | +123747.7489 | S | B | 4 | 6

A0 returns +9999.999999 (an overflow condition).

VF | N | A0 | +123747.7489 | S | Z | 9 | 6

A0 returns +000123747.748900

VF | N | A0 | +123747.7489 | S | N | 9 | 6

A0 returns +123747.748900

VF | N | A0 | +123747.7489 | S | B | 9 | 6

A0 returns +. . .123747.748900

VF | N | A0 | +123747.7489 | B | B | 9 | 6

A0 returns . . .123747.748900

VF | N | A0 | +123747.7489 | B | Z | 9 | 6

A0 returns 000123747.748900

7-83

Page 252

MCL-Designer for Phaser Series User’s Guide

Variable Justify (VJ) Function Justifies the data in a variable to the left or to the right, and fills gaps with characters.

Syntax VJ | type | destination | origin | length | character where:

Type = type of justification. L = left. R = right.

Destination = the name of the receiving variable. Origin = the original string to be formatted (may be a variable reference). Length = the total length of the justified data. Character = the character with which to fill the field (any ASCII character may be used).

Affected System Variables &99 =

“0” if no error occurs, 1 otherwise.

Notes 1. If a space is used as an ASCII character, it must be coded as “\20”. 2. If the length parameter is less than the length of the origin string, the origin will be copied to destination unchanged.

7-84

Page 253

MCL-Code Reference Guide

Examples VJ | L | A1 | &A0 | 10 | * Left -justifies variable A0 for a length of 10 characters and fill with asterisks (*) Example: Before execution : A0 = “HELLO” After execution : A1 = “HELLO*****” VJ | R | A1 | &A0 | 6 | $ Right-justifies variable A0 for a length of 6 characters and fill with “$” Example: Before execution : A0 = “100” After execution : A1 = “$$$100”

7-85

Page 254

MCL-Designer for Phaser Series User’s Guide

Variable Length (VL) Function Computes the size of a text string and stores it in a variable.

Syntax VL | variable | text where:

Variable = the variable receiving the computed length. Text = the text to evaluate.

Affected System Variables None

Notes None

Examples VL | A1 | HELLO_WORLD Computes the size of “HELLO_WORLD and stores it in variable A1 (after execution: A1 = “11”). VL | A1 | &B0

7-86

Computes the size of the text in variable B0 and stores the result in variable A1. Example: Before execution: B0 = “GOODBYE” After execution: A1 = “7”.

Page 255

MCL-Code Reference Guide

Variable Move (VM) Function Replaces the current contents of a variable with text.

Syntax VM | variable | text where:

Variable = the name of the receiving variable. Text = the text to store in variable.

Affected System Variables &99

= 0, if no error occurs, 1 otherwise.

Examples VM | A1 | HELLO

Stores the word “HELLO” in variable A1. After execution : A1 = “HELLO”

VM | A0 | &A1 WORLD Concatenates the contents of variable A1 with the word “WORLD”, and stores the result in variable A0. Example: Before execution: A1 = “HELLO”. After execution: A0 = “HELLO WORLD”

7-87

Page 256

MCL-Designer for Phaser Series User’s Guide

Variable Operation - Arithmetic (VO) Function Executes arithmetic operation on number1 and number2, and stores the result in variable.

Syntax VO | type | variable | number1 | number2 where:

Variable = the name of the receiving variable. Number1 = the first operand. Number2 = the second operand. Type = Operation to perform: + to add. - to subtract. * to multiply. / to divide. % to compute Modulo.

Affected System Variables &98 = the sign of the result.

&97 = remainder of divide operation.

&96 = the sign of the remainder

Notes 1. When arithmetic operations with decimal positions are needed, the formatting of the result may be required. 2. Addition, Subtraction, Multiplication and Division operations work on integer (0 to 65535) and decimal numbers. 3. Modulo operation only works on integers (0 to 65535). 4. The remainder of the divide command is stored in variable &97. You can use the modulo operation to get this result directly. 5. In case of overflow, the output is equal to 99999 and the system variable 99 = 1.

7-88