Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Displays on the terminal screen.
CRT [text]

CRT text [format]
text 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.
format 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.
CRT 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.
CRT does not send its output to an open PRINTER channel, which allows CRT to be executed without using PRINTER OFF and PRINTER ON.
A text 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:
The DISPLAY and CRT commands are identical. The PRINT command is similar to CRT, but provides additional functionality.
The optional format argument specifies how to handle text. CRT supports three types of format arguments:
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 function.
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 function.
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 function.
The following examples illustrate the use of the CRT command:
CRT "hello","world":"!"
hello    world!
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA