SHOW

Function

Displays one or more variables or literals on the screen. Cursor control is supported for ANSI terminals.

Syntax

SHOW[cursor_position]
[CLEAR-SCREEN|CS|CLEAR-LINE|CL][any_lit|_var|_col]
[EDIT edit_mask|NUMBER|MONEY|DATE][BOLD][BLINK]
[UNDERLINE][REVERSE][NORMAL][BEEP][NOLINE]...

Arguments

cursor_position

Position to begin the display.

CLEAR-SCREEN or CS

Clears the screen and sets the cursor position to (1,1).

CLEAR-LINE or CL

Clears a line from the current cursor position to the end of the line.

any_lit|_var|_col

Information to display.

EDIT

Variables under an edit mask. If the mask contains spaces, enclose it in single quotes. For additional information regarding edit masks, see PRINT.

NUMBER

Formats any_lit|_var|_col with the NUMBER‑EDIT-MASK from the current locale. (See ALTER-LOCALE.) Not legal for date variables.

MONEY

Formats any_lit|_var|_col with the MONEY‑EDIT-MASK from the current locale. (See ALTER-LOCALE.) Not legal for date variables.

DATE

Formats any_lit|_var|_col with the DATE‑EDIT‑MASK from the current locale. (See ALTER-LOCALE.) Not legal for numeric variables. If DATE‑EDIT‑MASK is not specified, the date is displayed using the default format for that database (see Table 61, Default Formats by Database).

BOLD, BLINK, , UNDERLINE, and REVERSE

Changes the display of characters. Some terminals support two or more characteristics at the same time for the same text. To turn all special display characteristics off, use NORMAL.

NORMAL

Turns off all special display characteristics set with BOLD, BLINK, UNDERLINE, and REVERSE.

BEEP

Causes the terminal to beep.

NOLINE

Inhibits a line advance.

Description

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 and B 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 SHOW without any cursor position when you want to scroll. You cannot mix SHOW and DISPLAY while referencing relative cursor positions.

SHOW does not advance to the next line if a cursor location (...), CLEAR‑SCREEN, CLEAR-LINE, or BEEP is used. (SHOW 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 displaying a date variable or column, without an edit mask, the date is displayed according to the following rules:

When displaying a date in a string literal, column, or variable using EDIT or DATE, the string must be in the format specified by SQR_DB_DATE_FORMAT, one of the database-dependent formats in Table 61, Default Formats by Database, or the database-independent format 'SYYYYMMDD[HH24[MI[SS[NNNNNN]]]].

Examples

The following code:

!
! Show a string using an edit mask
!
let $ssn = '123456789'
show $ssn edit xxx-xx-xxxx

Produces the following output:

123-45-6789

The following code:

!
! Show a number using an edit mask
!
show 1234567.89 edit 999,999,999.99

Produces the following output:

1,234,567.89

The following code:

!
! Show a number using the default edit mask
!
show 123.78

Produces the following output:

123.780000

The following code:

!
! 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

The following code:

!
! 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

The following code:

!
! 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-1999

The following code:

!
! Show two values on the same line
!
show 'Hello' ' World'

Produces the following output:

Hello World

The following code:

!
! 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 SHOW. 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 Also