Displays on the terminal screen.
CRT text [format]
||Optional Any MVBasic expression that resolves to a quoted string or a numeric. You can specify a single expression or a series of expressions separated by either commas (,) or colons (:). A comma inserts a tab spacing between the two strings. A colon concatenates the two strings. If text is omitted, a blank line is returned.
||Optional A code specifying how to handle text, specified as a quoted string. This format is applied to the text that immediately precedes it. Whitespace characters may be inserted between text and format.
displays one or more text
items on the terminal screen. This text
can consist of any number of text strings separated by commas or colons. Any text
may be followed by an optional format
. This format
applies only to the text
string that immediately precedes it.
does not send its output to an open PRINTER channel, which allows CRT
to be executed without using PRINTER OFF and PRINTER ON.
can consist of a single string or numeric expression, or a series of expressions alternating with separator characters. If no text
is specified, CRT
returns a blank line.
The following separators are supported:
A comma (,) used as a separator character inserts a predefined tab between to items. By default, tabs are set at ten column intervals. You can specify a comma before the first expression to indent that expression. You cannot specify a comma after the last expression; this results in a syntax error. You can specify a series of commas to specify multiple tabs; an odd number of commas increments the number of tabs. Thus, one or two commas (exp,exp
) equals one tab, three or four commas (exp,,,exp
) equals two tabs, and so forth.
A colon (:) used as a separator character concatenates two items. Specifying a colon before the first expression has no effect. Specifying a colon after the last expression enables concatenation of the results of two commands. By default, a CRT
statement ends by issuing a linefeed and carriage return. However, if you end the CRT
argument with a colon, CRT
does not issue the linefeed and carriage return, This enables you to concatenate the output of the next statement to the CRT
commands are identical. The PRINT
command is similar to CRT
, but provides additional functionality.
The optional format
argument specifies how to handle text
supports three types of format
@ function formatting
implicit formatting, using FMT function codes
implicit conversion, using OCONV function codes
You can use an @ function
with positive arguments to specify the column position and/or line position at which to print. For example, CRT @(15):"Over here!"
prints the literal string starting at column 16. You can also use the @ function with negative arguments to change screen display modes. For example, CRT @(-1):"Over here!"
clears the screen, then prints the literal string at line 1, column 1.
You can use the optional format
argument to specify display width, justification, fill characters, and zero filling or rounding for decimal digits. This is known as implicit formatting because it is equivalent to inserting a FMT
function as one of the CRT
arguments. For further details on the available format
codes, refer to the FMT
You can disable implicit formatting by specifying $OPTIONS NO.IMPLICIT.FMT
. Specifying this option prevents the evaluation of the format
argument in CRT, PRINT, or DISPLAY. It has no effect on the explicit use of the FMT
Implicit conversion performs many of the OCONV
function conversions by specifying the conversion code as the format
argument. For example, both of the following perform date conversion from internal to display format:
CRT 14100 "D"; ! "08 AUG 2006"
CRT OCONV(14100,"D"); ! "08 AUG 2006"
For further details on the available format
conversion codes, refer to the OCONV
The following examples illustrate the use of the CRT
© 1997-2019 InterSystems Corporation, Cambridge, MA