DISPLAY
Send output to a device or file
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
DISPLAY(channel, item[, ...]) [[error_list]]
Arguments
channel
The channel of the output device or file. (n)
item
One or more of the following items separated by commas:
- Alpha expression
- Numeric expression
- Terminal-independent screen function (traditional Synergy only):
Reset the absolute position of the cursor. |
|
Clear a specific portion of the screen. |
|
Move the cursor relative to the current position. |
|
Modify one or more defined screen attributes. |
error_list
(optional) An I/O error list. If any one of the specified errors occurs as part of the DISPLAY, control is transferred to the associated label.
Discussion
The DISPLAY statement sends character-oriented output to valid output devices or files through a specified channel.
The elements of item are processed in the order that they are specified. If item is an alpha expression, the resulting text is directly transmitted to the output device.
If item is a numeric expression, the value’s corresponding ASCII character is transmitted. Appendix B: ASCII Character Set lists all the ASCII characters and their corresponding codes. If the result of item is greater than 256, it is divided by 256, and the ASCII character associated with the remainder is transmitted. For example, the result 321 is divided by 256, with a remainder of 65, and the corresponding ASCII character “A” is sent to the output device or file.
You can additionally use the DISPLAY statement to control terminal screens. Depending on the terminal on which you are operating, special functions, such as clearing CRT screens and positioning cursors, are performed by transmitting multiple-character function sequences. Synergy DBL provides terminal-independent screen function commands (see below) to eliminate hard-coding terminal-dependent screen functions in DISPLAY statements.
Don’t use DISPLAY with the low-level Synergy windowing API (W_xxx) routines, because it displays characters in a “console” window. In addition, DISPLAY should not be used for interactive programs on Windows; it should only be used for command line-type programs (for example, those used with dbs.exe). If you’re migrating software to Windows, we recommend that you upgrade your programs to use the low-level windowing routines for screen display and input instead. |
On OpenVMS, performing an OPEN to the terminal, where terminal output is redirected to a disk file, results in separate records for each DISPLAY statement. On other operating systems, Synergy DBL concatenates all such data in the file.
Terminal-independent screen function commands
(traditional Synergy only) The screen functions described in this section are based on the ANSI terminal standard. Some terminals may not use these functions or may use them differently from how they are documented here. See “Synergy DBL and the UNIX terminal database” in the “UNIX Development” chapter of your Professional Series Portability Guide (PDF) to find out what functions your terminal supports.
row
An expression representing the row to which to position the cursor. (n)
column
An expression representing the column to which to position the cursor. (n)
$SCR_POS resets the absolute position of the cursor. If either row or column is not in the range
1–255, the cursor is not moved, and no warning or error occurs.
function
One of the following options:
Clear the entire screen.
Clear from the current position to the end of the line.
Clear from the current position to the end of the screen.
Clear the current line.
Clear from the beginning of the line to the current position.
Clear from the beginning of the screen to the current position.
$SCR_CLR clears a specific portion of the screen.
$SCR_MOV(row_change, col_change)
row_change
The number of rows to move and the direction of movement. A negative value indicates movement up the screen; and a positive value indicates movement down the screen. (n)
col_change
The number of columns to move and the direction of movement. A negative value indicates movement to the left in the current row; and a positive value indicates movement to the right in the current row. (n)
$SCR_MOV moves the cursor relative to the current position. If one of the values is zero, the cursor does not move in that direction. If both values are zero, the cursor does not move.
function
One or more of the following options separated by commas:
Turn off (clear) all attributes.
Turn on bolding.
Turn on underlining.
Turn on blinking.
Turn on reverse video.
Turn on graphics.
Turn off graphics.
Save current attributes. (UNIX, OpenVMS only)
Restore attributes from last SAVE. (UNIX, OpenVMS only)
$SCR_ATT modifies one or more defined screen attributes.
See “Synergy DBL and the UNIX terminal database” in the “UNIX Development” chapter of your Professional Series Portability Guide (PDF) to check if your terminal supports the SAVE and RESTORE options.
Multiple attribute functions are processed in the order they are presented in the $SCR_ATT command.
Once an attribute is set, it remains in effect until it is cleared. You can’t clear individual screen attributes; you must clear all the attributes and then reset the ones you want. |
See also
- “Synergy DBL and the UNIX terminal database” in the “UNIX Development” chapter of your Professional Series Portability Guide (PDF) for how to find which screen functions are available on your terminal.
- The programming specifications provided by the manufacturer of your terminal to determine what special functions are available for your terminal and what the corresponding request sequences are
- The Values for ASCII line-drawing characters table for a list of decimal values for ASCII line-drawing characters
Examples
Assuming TTCHN is the channel number associated with the terminal, the following example
display(TTCHN, "Enter option: ")
sends this message to the terminal:
Enter option:
No other characters are transmitted.
In the following example, if ernum is a decimal expression and ermsg is an alpha array of error messages, this statement sends the error message associated with ernum to the specified channel. The error message is preceded by a bell character (7).
display(TTCHN, 7, "Error: ", ermsg(%ernum))
The example below first clears the entire screen, positions the cursor to row 15 and column 30, and displays the following message:
This is a test.
It then clears all screen attributes, sets the bolding and blinking attributes, positions the cursor to row 1 and column 1, and displays the message
Sorting …
display(TTCHN, $SCR_CLR(screen), $SCR_POS(15, 30), "This is a test.") display(TTCHN, $SCR_ATT(clear, bold, blink), $SCR_POS(1, 1), "Sorting ...")