DISPLAY
Syntax
DISPLAY {any_lit|_var|_col} [[:$]edit_mask|NUMBER|MONEY|DATE][NOLINE]
Description
Displays the specified column, variable, or literal.
The DISPLAY command can display data to a terminal. The data is displayed to the current location on the screen. If you want 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:
-
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 DATE Column 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 listed in the TIME Column Formats table.
When the program displays a date in a string literal, column, or variable using EDIT or DATE, the string uses 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]]]].
If you require more control over the display, use the SHOW command.
Parameters
| Parameter | Description |
|---|---|
|
any_lit|_var|_col |
The text, number, or date to be displayed. |
|
edit_mask |
Causes the field to be edited before being displayed. For additional information regarding edit masks, see the PRINT command. |
|
NUMBER |
Indicates that any_lit|_var|_col is to be formatted using the NUMBER-EDIT-MASK of the current locale. This option is not valid with date variables. |
|
MONEY |
Indicates that any_lit|_var|_col is to be formatted using the MONEY-EDIT-MASK of the current locale. This option is not valid with date variables. |
|
DATE |
Indicates that any_lit|_var|_col is to be formatted using the DATE-EDIT-MASK of the current locale. This option is not valid with numeric variables. If DATE-EDIT-MASK has not been specified, the date is displayed by the default format for that database (see the Default Database Formats table). |
|
NOLINE |
Suppresses the carriage return after the field is displayed. |
Example
The following segments illustrate the various features of the DISPLAY command:
!
! Display a string using an edit mask
!
display '123456789' xxx-xx-xxxx
Produces the following output:
123-45-6789
!
! Display a number using an edit mask
!
display 1234567.89 999,999,999.99
Produces the following output:
1,234,567.89
!
! Display a number using the default edit mask (specified in PSPSPSSQR.INI)
!
display 123.78
Produces the following output:
123.780000
!
! 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
!
! 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
!
! 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-2004
!
! Display two values on the same line
!
display 'Hello' noline
display ' World'
Produces the following output:
Hello World
!
! 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 The SHOW command for information
about screen control
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