SHOW
Syntax
SHOW[cursor_position] [CLEAR-SCREEN|CS|CLEAR-LINE|CL][any_lit|_var|_col] [EDITedit_mask|NUMBER|MONEY|DATE][BOLD][BLINK] [UNDERLINE][REVERSE][NORMAL][BEEP][NOLINE]...
Description
Displays one or more variables or literals on the screen. In addition, cursor control is supported for ANSI terminals.
Any number of variables and screen positions can be used in a single command. Each one is processed in sequence.
Screen locations can be indicated by either fixed or relative positions in the format (A,B), where A is the line and B is the column on the screen. A, B, or both can also be numeric variables. Relative positions depend on where the previous SHOW command ended. If the line was advanced, the screen cursor is usually immediately to the right of the previously displayed value and one line down.
Fixed or relative cursor positioning can be used only within the boundaries of the terminal screen. Scrolling off the screen using relative positioning, for example (+1,1), is not supported. Instead, use a SHOW command without any cursor position when you want to scroll. Also, you cannot mix SHOW and DISPLAY commands while referencing relative cursor positions.
The SHOW command does not advance to the next line if a cursor location (...), CLEAR-SCREEN, CLEAR-LINE, or BEEP is used. (A SHOW command without any of these arguments automatically advances the line.) To add a line advance, add (+1,1) to the end of the line or use an extra empty SHOW command.
Only ANSI terminals are supported for cursor control, screen blanking, line blanking, and display characteristics.
Dates can be contained in a date variable or column, or a string literal, column, or variable. When the program displays a date variable or column without an edit mask, the date is displayed according to the following rules:
-
For DATETIME columns and SQR DATE variables, SQR uses the format specified by the SQR_DB_DATE_FORMAT setting.
If this has not been set, SQR uses the first database-dependent format as listed in the Default Database Formats table.
-
For DATE columns, SQR uses the format specified by the SQR_DB_DATE_ONLY_FORMAT setting.
If this has not been set, SQR uses the format listed in the Default Database Formats table.
-
For TIME columns, SQR uses the format specified by the SQR_DB_TIME_ONLY_FORMAT setting.
If this has not been set, SQR uses the format as listed in the TIME Column Formats table.
When displaying a date in a string literal, column, or variable using EDIT or DATE, the string must be in the format specified by the SQR_DB_DATE_FORMAT setting, one of the database-dependent formats as listed in the Default Database Formats table, or the database-independent format 'SYYYYMMDD[HH24[MI[SS[NNNNNN]]]].
Parameters
| Parameter | Description |
|---|---|
|
cursor_position |
Specifies the position on the screen to begin the display. |
|
{CLEAR-SCREEN | CS} |
Clears the screen and sets the cursor position to (1,1). |
|
{CLEAR-LINE | CL} |
Clears a line from the current cursor position to the end of the line. |
|
{any_lit | _var | _col} |
Specifies the information to be displayed. |
|
EDIT |
Shows variables under an edit mask. If the mask contains spaces, enclose it in single quotes. For additional information regarding edit masks, see the PRINT command. |
|
NUMBER |
Indicates that any_lit|_var|_col is to be formatted with the NUMBER-EDIT-MASK from the current locale. (See the ALTER-LOCALE command.) This option is not valid for date variables. |
|
MONEY |
Indicates that any_lit|_var|_col is to be formatted with the MONEY-EDIT-MASK from the current locale. (See the ALTER-LOCALE command.) This option is not valid for date variables. |
|
DATE |
Indicates that any_lit|_var|_col is to be formatted with the DATE-EDIT-MASK from the current locale. (See the ALTER-LOCALE command.) This option is not valid for numeric variables. If DATE-EDIT-MASK has not been specified, the date is displayed with the default format for that database (see the Default Database Formats table). |
|
BOLD, BLINK, UNDERLINE, and REVERSE |
Changes the display of characters on terminals that support those characteristics. Some terminals support two or more characteristics at the same time for the same text. To disable all special display characteristics, use NORMAL. |
|
NORMAL |
Disables all special display characteristics set with BOLD, BLINK, UNDERLINE, and REVERSE. |
|
BEEP |
Causes the terminal to beep. |
|
NOLINE |
Inhibits a line advance. |
Example
The following program segments illustrate the various features of the SHOW command:
!
! Show a string using an edit mask
!
let $ssn = '123456789'
show $ssn edit xxx-xx-xxxx
Produces the following output:
123-45-6789
!
! Show a number using an edit mask
!
show 1234567.89 edit 999,999,999.99
Produces the following output:
1,234,567.89
!
! Show a number using the default edit mask
!
show 123.78
Produces the following output:
123.780000
!
! Show a number using the locale default numeric edit mask
!
alter-locale number-edit-mask = '99,999,999.99'
show 123456.78 number
Produces the following output:
123,456.78
!
! Show a number using the locale default money edit mask
!
alter-locale money-edit-mask = '$$,$$$,$$8.99'
show 123456.78 money
Produces the following output:
$123,456.78
!
! Show a date column using the locale default date edit mask
!
begin-select
dcol
from tables
end-select
alter-locale date-edit-mask = 'DD-Mon-YYYY'
show &dcol date
Produces the following output:
01-Jan-2004
!
! Show two values on the same line
!
show 'Hello' ' World'
Produces the following output:
Hello World
!
! Show two values on the same line with editing of the values
!
let #taxes = 123456.78
show 'You owe ' #taxes money ' in back taxes.'
Produces the following output:
You owe $123,456.78 in back taxes.
The following program illustrates the usage of additional options of the SHOW command. Only terminals that support the ANSI escape characters can use the cursor control, screen blanking, line blanking, and display attributes.
begin-program
!
! Produces a menu for the user to select from
!
show clear-screen
(3,30) bold 'Accounting Reports for XYZ Company' normal
(+2,10) '1. Monthly Details of Accounts'
(+1,10) '2. Monthly Summary'
(+1,10) '3. Quarterly Details of Accounts'
(+1,10) '4. Quarterly Summary'
!
! Show a line of text and numerics combined
!
show (+2,1)
'The price is ' #price edit 999.99
' Total = ' #total edit 99999.99
!
! Put an error message on a particular line
!
show (24,1) clear-line 'Error in SQL. Please try again.' beep
end-program
See The LET command for information
about copying, editing, or converting fields
See The EDIT parameter of the
PRINT command for a description of the edit masks
See The ALTER-LOCALE command
for a description of the arguments NUMBER-EDIT-MASK, MONEY-EDIT-MASK,
and DATE-EDIT-MASK
See DISPLAY