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 4) - Store values of variables

&pagelevel(3)&pagelevel

This format of the @SET statement is used to insert the contents of an integer variable, the name of a string variable or the contents of a line number variable as of a given column in printable form in a work file line or string variable.

Operation

Operands

F mode, L mode

@SET

{svarex | lvar} [,col]=CHAR{ivar | svar | lvar1}

svarex

String variable (#S0..#S20) in which a value is to be inserted.
Any characters in the corresponding positions are overwritten.

lvar

Line number variable (#L0..#L20) specifying the line to which a value is to
be written. If the line does not yet exist, it is created. Any characters in the
corresponding positions are overwritten.

col

Column as of which the line or string variable is to be written. The default
value of col is 1. If col is located after the end of the line then the line is
filled with blanks up to the column col.

CHAR ivar

Integer variable (#I0..#I20) whose content is to be inserted as a string in
the line as of column col. The conversion produces an 11 character long,
printable number starting either with a blank or a minus sign depending on
whether the integer is positive or negative.

CHAR svar

String variable (#S0..#S20) whose name is to be inserted in the specified
line or string variable.

CHAR lvar1

Line number variable whose value is to be inserted in printable form in the
specified line or string variable.

Converting the value of a line number variable always results in 9 printable
characters in the form IIII.IIII where each I represents a printable
digit. In this case, leading zeros are replaced by blanks.

If the insertion operation causes the line or string variable to exceed the maximum length of 32768 then the statement is rejected with the message EDT5474.

If the information is inserted in a line then the character set depends on the work file. If the current work file already has a character set then the value is inserted in this character set. If the work file is empty and has the character set *NONE then it is assigned the character set EDF041 prior to insertion.

If the information is inserted in a string variable then it is converted into the character set of the string variable before insertion.

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 #L0 = 1 ------------------------------------------------- (01)
1.     @SET #I0 = 123 ----------------------------------------------- (02)
1.     @SET #L0 = CHAR #I0 ------------------------------------------ (03)
1.     @SET #L0 ,13 = CHAR #S0 -------------------------------------- (04)
1.     @SET #L0 ,18 = CHAR #L0 -------------------------------------- (05)
1.     @SET #S0 = CHAR #I0 ------------------------------------------ (06)
1.     @SET #L0 = 47.11 --------------------------------------------- (07)
1.     @SET #S1 = CHAR #L0 ------------------------------------------ (08)
1.     @SET #S2 ,5 = CHAR #S0 --------------------------------------- (09)
1.     @PRINT 1,#S0-#S2 --------------------------------------------- (10)
1.0000  0000000123 #S00    1.0000
  #S00  0000000123
  #S01   47.1100
  #S02 #S00 
(1)The value 0001.0000 is assigned to the line number variable #L0.
(2)The value 123 is assigned to the integer variable #I0.
(3)The string ' 0000000123' is inserted in line 1 as of column 1.
(4)The string '#S00' is inserted in line 1 as of column 13.
(5)The string ' 1.0000' is inserted in line 1 as of column 18.
(6)The value ' 0000000123' is assigned to the string variable #S0.
(7)The value 47.11 is assigned to the line number variable #L0.
(8)The value ' 47.1100' is assigned to the string variable #S1.
(9)

The value '#S00' is assigned to the string variable #S2 starting at column 5, i.e. its value is ' #S00'.

(10)Line 1 and the string variables #S0..#S2 are output.