DISPLAY

Function

Displays the specified column, variable, or literal.

Syntax

DISPLAY {any_lit|_var|_col}
[[:$]edit_mask|NUMBER|MONEY|DATE][NOLINE]

Arguments

any_lit|_var|_col

Text, number, or date to display.

edit_mask

Edits the field before displaying it. (see Edit Masks)

NUMBER

Formats any_lit|_var|_col with the NUMBER‑EDIT‑MASK of the current locale. This option is not legal with date variables.

MONEY

Formats any_lit|_var|_col with the MONEY‑EDIT‑MASK of the current locale. This option is not legal with date variables.

DATE

Formats any_lit|_var|_col with the DATE‑EDIT‑MASK of the current locale. This option is not legal with numeric variables. If DATE‑EDIT‑MASK has not been specified, then the date is displayed using the default format for that database (see Table 61, Default Formats by Database).

NOLINE

Suppresses the carriage return after displaying the field.

Description

DISPLAY can display data to a terminal. The data is displayed to the current location on the screen. If you wish to display more than one field on the same line, use NOLINE on each display except the last.

Dates can be contained in a date variable or column, or a string literal, column, or variable. When a date variable or column is displayed without an edit mask, the date appears in the following manner:

When displaying a date in a string literal, column, or variable using EDIT or DATE, the string uses 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]]]].

If you require more control over the display, use SHOW.

Examples

The following segments illustrate the various features of DISPLAY:

The following code:

!
! Display a string using an edit mask
!
display '123456789' xxx-xx-xxxx

Produces the following output:

123-45-6789

The following code:

!
! Display a number using an edit mask
!
display 1234567.89 999,999,999.99

Produces the following output:

1,234,567.89

The following code:

!
! Display a number using the default edit mask (specified in SQR.INI)
!
display 123.78

Produces the following output:

123.780000

The following code:

!
! Display a number using the locale default numeric edit mask
!
alter-locale  number-edit-mask = '99,999,999.99'
display 123456.78 number

Produces the following output:

123,456.78

The following code:

!
! Display a number using the locale default money edit mask
!
alter-locale  money-edit-mask = '$$,$$$,$$9.99'
display 123456.78 money

Produces the following output:

$123,456.78

The following code:

!
! Display 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'
display &dcol date

Produces the following output:

01-Jan-1999

The following code:

!
! Display two values on the same line
!
display 'Hello' noline
display ' World'

Produces the following output:

Hello World

The following code:

!
! Display two values on the same line with editing of the values
!
alter-locale  money-edit-mask = '$$,$$$,$$9.99'
let #taxes = 123456.78
display 'You owe ' noline
display #taxes money noline
display ' in back taxes.'

Produces the following output:

You owe $123,456.78 in back taxes.

See Also