OpenSTA logo OpenSTA SCL Reference
SET Command

SET Command

This command allows a value to be assigned to an integer or character variable. The values may be any integer or character values or a function reference, but their data types must match that of the variable. The values may be derived as a result of arithmetical operations.

If the variable is an integer variable, the assignment expression may be another integer variable or a numeric literal, or a complex arithmetic expression consisting of two or more integer values or variables, each separated by an operator. The following operators are supported:

operatormeaning
+addition
-subtraction
*for multiplication
/division
%modulo
&bitwise AND
|bitwise inclusive OR
^bitwise exclusive OR

The value resulting from a division operation will be an integer, any remainder will be discarded. The modulo calculation is the opposite of this operation, the variable will be set to the value of the remainder. For example:

SET A = B / C
SET D = B % C

If B = 13 and C = 2, then A will be set to 6 and D to 1.

Parentheses may be specified to determine the order of precedence. If parentheses are not specified, then the expression is evaluated from left to right with no other order of precedence applied.

When using arithmetic expressions integer overflows will cause run-time Script errors.

If the variable is a character variable, the assignment expression may consist of one or more character variables or literals. Operands are separated by the addition operator if the operands are to be added together; if the second operand is to be subtracted from the first, they are separated by the subtraction operator.

The CHARACTER function ~EXTRACT may be referenced within a SET command to extract a substring from a character variable or quoted character string into a character variable.

The integer function ~LOCATE may be referenced within a SET command to load the offset of a substring within a character variable or quoted character string into an integer variable.

The ON ERROR GOTO err-label clause can be specified to define a label to which control should be transferred in the event of an error. Example errors are an ~EXTRACT function is specified with an invalid offset, or an attempt is made to divide by zero.

Command Definition:

SET variable = operand
	{operator operand {operator operand ...}}
	{ON ERROR GOTO err-label}

variable

The name of an INTEGER or CHARACTER variable into which the result of the operation is to be placed.

operand

For SET commands with a CHARACTER variable, the operand may be a CHARACTER variable, quoted character string, or character function reference (see below). For SET commands with an INTEGER variable, the operand may be an integer function reference (see below), literal, or variable.

operator

The operation which is to be performed upon the previous and following operands. For character SET commands, it may be + to add the first operand to the second, or - to subtract the second operand from the first. For integer SET commands, all operators are valid.

The following character and integer funtions are available for use as operands within a SET command:

err-label

A label defined within the current scope of the Script to which control branches if an error occurs.

Examples:

SET String1 = String2 - "ERROR"
SET String1 = String2 + String3 + String4
SET String1 = String2 - '"END MARKER"' &
	ON ERROR GOTO ERROR_REPORT

<<<
prev page
^^^
section start
>>>
next page