Format 4 of the @CREATE statement is used to read a string from the terminal or from SYSDTA
and assign it to a string variable.
Operation | Operands | L mode |
@CREATE | svarex READ [string[,...]] [,CODE = name] |
svarex string | New string variable that is to be created. One or more strings which are to be chained together in the specified order If |
name | Character set that is to be defined for the specified string variable. |
In interactive mode, the prompt formed from the operands is output at the terminal and a string is read. If the prompt formed from the operands exceeds the maximum length of 32763 bytes then it is truncated to the maximum length and error message EDT2402
is output. If string
is not specified then a string is read from SYSDTA
instead of from the terminal.
In batch mode, string
is ignored and the string is always read from SYSDTA
.
The maximum length of the read string depends on the input medium.
If the CODE
operand is not specified then the content of the string is assigned to the string variable and the communications character set is defined as its character set.
If the CODE
operand is specified then this character set is assigned to the string variable and the read string is converted into the character set name
before being assigned. If the string that is to be inserted contains characters which cannot be displayed in the character set specified in name
then these characters are replaced by a substitute character provided that such a character has been specified (see @PAR SUBSTITUTION-CHARACTER); otherwise, the @CREATE statement is rejected and error message EDT5453
is output.
Entering [F1] without text at a terminal causes the specified string variable to be created as an empty string variable. Empty input that is sent with [DUE] or another function key is ignored and the prompt is output again.
If the statement is interrupted with [K2] and the EDT session is continued with /INFORM-PROGRAM
then the processing of the statement is aborted and message EDT5501
is output.
Example 1
6. @PRINT 1.0000 HELLO 2.0000 NO-ONE IS TO LEAVE 3.0000 THE ROOM 4.0000 LINE 5.0000 IS TO BE 6. @SET #S1 = ' OUTPUT *** ' 6. @PROC 1 1. @ @CREATE #S2 READ '*** WHICH ',4,5,#S1 ----------------------- (1) 2. @ @SET #L2 = SUBSTR #S2 --------------------------------------- (2) 3. @ @PRINT #L2 4. @END 6. @DO 1 *** WHICH LINE IS TO BE OUTPUT *** 2 ------------------------------------ (3) 2.0000 NO-ONE IS TO LEAVE 6.
(1) | @CREATE...READ is to be used to create the string variable |
(2) | The input is interpreted and stored in the line number variable #L2 . |
(3) | The query output via the terminal is answered. |
Example 2
@CREATE #S01 READ 'MUELLER OR MÜLLER ?'
The prompt 'MUELLER OR MÜLLER ?'
is output at the terminal and a string is read. The content of the read string is assigned to the string variable and the communications character set is defined as its character set.
@CREATE #S02 READ 'RESIDENT IN GÜNZBURG OR DONAUWÖRTH ?',CODE=EDF041
The character set EDF041
is defined for the string variable #S02
. The prompt RESIDENT IN GÜNZBURG OR DONAUWÖRTH ?'
is output at the terminal and a string is read. This is converted into the character set EDF041
and assigned to the string variable #S02
.