DISPLAY Statement (DQL)

Use the DISPLAY statement to present the information produced from your query one row at a time as a list of columns. The DISPLAY statement allows you to:
datacom
Use the DISPLAY statement to present the information produced from your query one row at a time as a list of columns. The DISPLAY statement allows you to:
  • Present column and key names of a table in a list format.
  • Specify alternate heading names to represent columns and keys.
  • Designate how numeric column values appear in the report.
Each report page has a standard heading that includes the row number being viewed and the page within the row. When you specify a large number of columns to be displayed, 
Dataquery
 provides additional pages for each row. Column headings appear on the left side of the page with the data on the right side.
Before 
Dataquery
 sends the DISPLAY output to the terminal, it edits the data for errors relating to the DISPLAY format.
  • If the data consists of any hexadecimal values which are not acceptable to the terminal, 
    Dataquery
     translates those values to a character. This can occur when you print a compound field composed of one or more packed or binary fields.
  • To cause the compound field to be displayed as individual columns, specify YES as the value for GROUP DISPLAY in your user profile. If the compound field is composed of repeating fields, only the first occurrence is broken down and displayed unless other occurrences are explicitly requested.
 Output from queries containing a DISPLAY statement cannot be printed on a system printer unless the query is executed in batch.
If 
Dataquery
 encounters an error in a column being edited, a special error code surrounded by asterisks is reported in place of the column.
After executing a query containing a DISPLAY statement, you can page through the rows found.
A DISPLAY statement can use the following data types: CHAR NUM, DEC, BIN, FLOAT-PT SHRT, FLOAT-PT LONG, EXT, 1/2 BIN, FUL BIN, DBL CHAR, DBL MIXED, KANJI.
Topics discussed on this page include:
 
 
Syntax Diagram
►►─ DISPLAY ─┬────────┬─┬─────────────────────────────┬───────────────────────► └─ FROM ─┘ └─
table-name
─┬────────────┬─┘ └─ (
status
) ─┘ ►─┬─
key-name
────┬─┬─────────────────────────────────┬──────────────────────► └─
column-name
─┘ └─ '
heading1
─┬─────────────┬─ ' ─┘ └─ /
heading2
─┘ ►─┬──────────────────────────┬───────────────────────────────────────────────►◄ └─ PICture '
edit-pattern
' ─┘
Repeat parameters once for each key or column.
 To simplify discussion, important elements of the DISPLAY statement appear in the following separate sections.
Basic Syntax
You can create a DISPLAY statement without including headings or a PICTURE clause. The basic statement is simpler without it.
 
Syntax Diagram
 
The following is the basic syntax of DISPLAY with a PICTURE clause.
►►─ DISPLAY ─┬────────┬─┬─────────────────────────────┬───────────────────────► └─ FROM ─┘ └─
table-name
─┬────────────┬─┘ └─ (
status
) ─┘ ►─┬─
key-name
────┬─┬──────────────────────────┬─────────────────────────────►◄ └─
column-name
─┘ └─ PICture '
edit-pattern
' ─┘
This section explains each keyword in the DISPLAY format.
  •  
    FROM
    Used for readability only.
  •  
     
    table-name
     
    Specifies the 
    Datacom Datadictionary
     name of the table where 
    Dataquery
     obtains the values of the columns and keys indicated. You only need to include the table name if the column or key in the statement refers to a table which is different than the most recently named table in the query.
  •  
     
    (status)
     
    (Optional)
     If authorized, use to specify a 
    Datacom Datadictionary
     definition of a table that is being tested by programmers responsible for its maintenance. If the FIND or COUNT statement specifies a TEST status for a table, all subsequent statements in the same query reference the same status and version of the table, unless a different status is specified. The following chart describes each status you can specify.
     The status must be enclosed in parentheses, and there must be no spaces between the table name and the left parenthesis.
  •  
     
    key-name
     
    Specifies the name of a key contained in the table specified in the DISPLAY statement or the most recently named table in a previous statement.
  •  
     
    column-name
     
    Specifies the name of a column that is either in the table named in the DISPLAY statement or in the previously named table. A column also can be a result from a previous SET statement in the query. And, a column can be one occurrence in a repeating field. If that is the case, use subscripts to identify which occurrence is to be used. A typical subscript looks like this:
    SALES-RESULTS (5,2)
     
  •  
    PICTURE 'edit-pattern'
    See PICTURE Clause (DQL) for information about PICTURE clauses.
 
Example
 
The following illustrates a basic query which displays the data resulting from query execution.
FIND 10 CAI-SLSHST-REC ROWS DISPLAY FROM CAI-SLSHST-REC SLMN-ID ORD-ID
 
Output
 
A sample of the first screen of output generated from the preceding query follows:
=> ------------------------------------------------------------------------DQED0 DATAQUERY: COLUMN VALUE DISPLAY ROW 00001 PAGE 00001 ----------------------------------------------------------------------------- SLMN-ID I4790 ORD-ID 01002 ----------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> PREV ROW <PF4> NEXT ROW <PF5> NOT USED <PF6> STATS <PF7> BACKWARD <PF8> FORWARD
Alternate Output Headings
The DISPLAY statement also allows you to specify alternate headings for the displayed output.
 
Syntax Diagram
 
To assign alternate headings to display for each column or key, use the following DISPLAY format.
►►─ DISPLAY ─┬────────┬─┬─────────────────────────────┬───────────────────────► └─ FROM ─┘ └─
table-name
─┬────────────┬─┘ └─ (
status
) ─┘ ►─┬─
key-name
────┬─┬─────────────────────────────────┬──────────────────────► └─
column-name
─┘ └─ '
heading1
─┬─────────────┬─ ' ─┘ └─ /
heading2
─┘ ►─┬──────────────────────────┬───────────────────────────────────────────────►◄ └─ PICture '
edit-pattern
' ─┘
Repeat parameters once for each key or column.
The following explains each keyword in the DISPLAY syntax used to produce alternate output headings.
  •  
    'heading1 / heading2'
    Assigns an alternate column heading name for the preceding column or key. A heading name can be up to 32 characters, including blanks, and must appear within apostrophes ('). If you do not specify a heading name, 
    Dataquery
     prints an alternate heading from 
    Datacom Datadictionary
    , if your site management selected that choice as a system option; otherwise, 
    Dataquery
     prints the 
    Datacom Datadictionary
     name of the column or key. Column headings can be two lines of 22 characters each, separated by a site-specified heading separator character, such as a slash (/). See the System Profile topic on the Topic Help panel for the heading separator used at your site.
  •  
    PICTURE 'edit-pattern'
    See PICTURE Clause (DQL) for information about PICTURE clauses.
 
Example
 
The following is a sample query and query output illustrating the use of designated one- and two-line headings.
FIND 10 CAI-SLSHST-REC ROWS DISPLAY FROM CAI-SLSHST-REC SLMN-ID 'REPRESENTATIVE/ID NUMBER ORD-ID 'ORDER NUMBER'
 
Output
 
=> ------------------------------------------------------------------------DQED0 DATAQUERY: COLUMN VALUE DISPLAY ROW 00001 PAGE 00001 ----------------------------------------------------------------------------- REPRESENTATIVE ID NUMBER I4790 ORDER NUMBER 01002 ----------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> PREV ROW <PF4> NEXT ROW <PF5> NOT USED <PF6> STATS <PF7> BACKWARD <PF8> FORWARD