WRITE (Short Name: WRI)
Top  Previous  Next

Use the WRITE command to send a message to an output device or display message on screen. Recommended for R:BASE for DOS.

To display messages in R:BASE 7.x for Windows, use PAUSE 3 and PAUSE 4 commands.


write

Options
,
Indicates that this part of the command is repeatable.

'message'

Specifies a message to be displayed on the screen.

USING format

Specifies a display format for the message or variable.

.var

Specifies a dot variable of any data type, which can be used instead of a message.

=w

Specifies the display width for a column or variable.


About the WRITE Command

The WRITE command allows concatenation of several items in one command with embedded variables.

The WRITE command displays a message or variable that you place within the current QUOTES character-the default QUOTES character is the single quote ('). The quotes are not displayed when WRITE runs.

Instead of WRITE, use the FILLIN or DIALOG command to prompt a user to enter data.

If the current output device is not the screen, the AT and screen attributes options do not have any effect unless PAGEMODE is set on. For information about PAGEMODE, see the "PAGEMODE" and "SET PAGEMODE" entries.

Symbols for Formatting the Display

You can specify a format for displaying either a message or a variable. When using a display format, you can only display one item, and you must allow enough space between the quotes to properly display the formatted information. For example, if you wanted to center a text message, the format must include the centering symbol ([^]) and the space within which the text will be centered.

The following tables summarize the formatting symbols.

String Modifiers for All Messages

Use this symbol...      To do the following...
[<]         Left justify the data in the field.

[>]         Right justify the data in the field.

[^]         Center the data in the field.

String Modifiers for Messages with Numbers

Use this symbol...      To do the following...
[-]         Place a negative sign to the right of a negative number.

[CR]         Place "CR" to the right of a positive number.

[DB]         Place "DB" to the right of a negative number.

[()]         Enclose a negative number in parentheses.

Character Modifiers for Text Messages
   
Character Modifier      If character is a letter   If character is a number   If character is neither   
_         uppercase      blank         blank

|         lowercase      blank         blank

%         uppercase      number         character

?         lowercase      number         character

Character Modifiers for Numeric Messages   

Character Modifier      If character is a number   If character doesn't fill the specified format
9         number         blank

0         number         0

*         number         * if blank

Examples

The following command automatically concatenates the items and puts a space between them. An ampersand (&) or plus (+) character cannot be used for concatenations.

WRITE 'Today's date is',.#DATE

The following command displays the contents of the vmsg variable.

WRITE .vmsg 

In the following example, var1 is a numeric data type (CURRENCY, NUMERIC, INTEGER, REAL, SMALLINT, or DOUBLE). If var1 has a negative value, the number displays with DB following it to indicate a debit. The greater than symbol (>) right justifies the output.

WRITE .var1 USING '[DB,>]$99,999.99'

If the value of var1 is -$49,999.22, then the above command displays:

$49,999.22 DB

In the following example, var2 is a TEXT data type. The contents of var2 displays in uppercase and is centered in the space defined by the _ characters.

WRITE .var2 USING '[^] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _'

If the value of var2 is warning, then the above command displays:

WARNING

The following command displays the entire contents of var3, wrapping the text after the twelfth character. If SET WRAP is off, only the first 12 characters of text would be displayed.

WRITE .var3 = 12

Note: To display a message or variable containing line end characters, you must specify a width to write multiple lines.