Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

@SET (format 1) - Supply values for integer variables

&pagelevel(3)&pagelevel

This format of the @SET statement is used to assign values to integer variables. This value may be the result of an expression, may be obtained by converting a printable number or the content of a line number variable into an integer value, or may take the form of a line length or the binary value of a string.

Operation

Operands

F mode, L mode

@SET

ivar={ intex
        | lvar
        | LENGTH line
        | LENGTH svarex
        | SUBSTR string
        | STRING string [,CODE=name] }

ivar

intex

Integer variable (#I0..#I20) which is to be supplied with a value.

Integer expression. If the maximum negative or positive value (-2 31 ,2 31 -1)
is exceeded on an arithmetic operation then the statement is rejected with
the message EDT4946.

lvar

Line number variable (#L0..#L20) whose value is to be assigned to the
integer variable. When converted into an integer value, the content of the
line number variable is multiplied by 10000 and then assigned.

LENGTH line

Line number of a line whose length is to be assigned as a value to the
integer variable. If the line is empty then the value 0 is assigned. If the line
does not exist then, for reasons of compatibility, the value 0 is again
assigned to the integer variable.

LENGTH svarexString variable whose length is to be assigned as a value to the integer
variable.
SUBSTR string

String specifying an integer value to be assigned to the integer variable. Any plus or minus sign present in the string is taken into account during
conversion. If the sign is missing then + is assumed. If the string contains blanks then these are eliminated during conversion.

If the string is not an integer value then the statement is rejected with the error message EDT5477. If the integer value is not in the permitted range (-2 31 ,2 31 -1) then the statement is rejected with the message EDT4946.Empty strings are not permitted and result in the error EDT3907.

STRING string

String. The binary value of the first 4 bytes of the string is assigned to the
integer variable. If the string contains fewer than 4 bytes then it is left-filled
with zeros.
Empty strings are not permitted and result in the error EDT3907.

name

Character set in which the string is to be interpreted. The string is converted
into this character set before being assigned. The first 4 bytes are then
assigned without regard for character boundaries.
If the string contains characters which are invalid in the target character set
then these characters are replaced by a substitute character provided that
such a character has been specified (see @PAR SUBSTITUTION-
CHARACTER); otherwise, the statement is rejected with the error message
EDT5453.

If the operand is not specified then the character set of the specified string
(which depends on the source) is used.

In this statement, the statement name may be omitted entirely. In F mode, it is also permissible to omit the statement symbol.

Example

   1.     @SET #I0 = SUBSTR '123' --------------------------------------- (1)
   1.     @SET #L0 = 1.01 ----------------------------------------------- (2)
   1.     @SET #I1 = #L0 ------------------------------------------------ (3)
   1.     @CREATE 1 'AB' ------------------------------------------------ (4)
   1.     @SET #I2 = LENGTH 1 ------------------------------------------- (5)
   1.     @SET #I3 = 2124 + #I0 + #I1 - #I2 ----------------------------- (6)
   1.     @SET #I4 = STRING '123' --------------------------------------- (7)
   1.     @SET #I5 = STRING 'A',CODE=UTF16 ------------------------------ (8)
   1.     @STATUS = I --------------------------------------------------- (9)
#I00= 0000000123 #I01= 0000010100 #I02= 0000000002
#I03= 0000012345 #I04= 0015856371 #I05= 0000000065
#I06= 0000000000 #I07= 0000000000 #I08= 0000000000
#I09= 0000000000 #I10= 0000000000 #I11= 0000000000
#I12= 0000000000 #I13= 0000000000 #I14= 0000000000
#I15= 0000000000 #I16= 0000000000 #I17= 0000000000
#I18= 0000000000 #I19= 0000000000 #I20= 0000000000
(1)The value 123 is assigned to the integer variable #I0.
(2)The value 0001.0100 is assigned to the line number variable #L0.
(3)The value 10100, line number 1.01 * 10000, is assigned to the integer variable #I1.
(4)Line 1 is created with the content AB.
(5)The value 2, the length of line 1, is assigned to the integer variable #I2.
(6)The value of the expression is assigned to the integer variable #I3.
(7)The value X'00F1F2F3' = 15856371 is assigned to the integer variable #I4.
(8)

The value which corresponds to the Unicode code position 'A' is assigned to the integer variable #I5.

(9)The content of the integer variable is output.