3.29 WRITE

Use WRITE to display messages on the workstation screen when a user logs in to the network. Text that you want to display must be enclosed in quotation marks (" ").

There are several ways to display variables in the text message. The way you enter the variable in the WRITE command determines the display format, as follows:

  • If you type the identifier variable as shown, with no special punctuation, only the variable is displayed on the screen.

  • If you enclose the identifier variable inside quotation marks, precede the variable with a percent sign (%) and type it in uppercase letters. This method is often used to combine regular text with an identifier variable, because both the text and the variable can be enclosed in the same quotation marks.

  • To join several text strings and identifier variables into a single display without enclosing the variables in quotation marks, use a semicolon (;) between the text and the variables.

  • If you have several WRITE commands, each one appears on a separate line on the user's workstation. However, if you put a semicolon at the end of all but the last WRITE commands, the commands all appear as one continuous sentence or paragraph (although they might wrap onto additional lines on the workstation's screen).

Text strings can include the following special characters:

Character

Meaning

\r

Causes a carriage return

\n

Starts a new line of text

\"

Displays a quotation mark on the screen

\7

Makes a beep sound

In addition to the semicolon, you can use other operators to form compound strings (in other words, to join text and identifier variables into one command). These operators are listed in the following table, in order of precedence:

Operator

Meaning

* / %

Multiply, divide

+ -

Add, subtract

>> <<

Shift left or right (1000 >> 3 becomes 1)

Command Format

WRITE "[text][%identifier]" [;][identifier]

Replace text with the words you want to display on the screen.

Replace identifier with a variable you want to display, such as a user's login name. See Section 3.2, Using Identifier Variables for a complete list of variables.

Examples

To display the message Hello, add the following line to the login script:

WRITE "Hello"

To display the user's surname along with a greeting, add the identifier LAST_NAME to the command. To do this, either join the text and the identifier with a semicolon (;) or include the variable in the quotation marks with the text.

For example, either of the following lines displays Hello, Smith when user Bob Smith logs in:

WRITE "Hello, ";LAST_NAME
WRITE "Hello, %LAST_NAME"

To make a beep sound occur while the phrase Good morning appears on the screen, add the following line to the login script:

WRITE "Good %GREETING_TIME \7"