Previous Topic: PRINT StatementNext Topic: Headings Syntax Diagram


Basic Syntax Diagram

Purpose

You can create a PRINT statement without including a title for the report. The basic statement is simpler without it.

Syntax Diagram

The following is the syntax for the basic PRINT statement.

►►─ PRINT ─┬────────┬─┬─────────────────────────────┬─┬─────┬─────────────────►
           └─ FROM ─┘ └─ table-name ─┬────────────┬─┘ └─ ( ─┘
                                     └─ (status) ─┘

 ►─┬─ key-name ────┬─┬─────┬─┬─────────────────────────────────┬──────────────►
   └─ column-name ─┘ └─ ) ─┘ └─ 'heading1 ─┬─────────────┬─ ' ─┘
                                           └─ /heading2 ─┘

 ►─┬──────────────────────────┬───────────────────────────────────────────────►◄
   └─ PICture 'edit-pattern' ─┘

Repeat parameters once for each key or column.

Explanation

This section explains each keyword in the basic PRINT format.

FROM

Used for readability only.

table-name

Specifies the Datadictionary name of the table where CA 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 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.

Note: The status must be enclosed in parentheses, and there must be no spaces between the table name and the left parenthesis.

TEST

Finds the named table in the first test version that meets the specifications.

Tnnn

(Where nnn refers to the version number of the test status you want.) Finds the named table in the specified test version.

PROD

PRODuction is the default status if not specified.

key-name

Specifies a key that belongs to the table specified in the PRINT 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 PRINT 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 within 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)

(See the CA Dataquery User Guide for more information.) The named column cannot exceed 1700 characters in length.

If a specified column is numeric, you can designate the accumulation of the values of the column by enclosing the column name within parentheses.

PICTURE 'edit-pattern'

See PICTURE Clause for information about PICTURE clauses.

Example

The following sample query contains a basic PRINT statement.

FIND 10 CAI-SLSHST-REC ROWS
    WITH SHIP-QTY > 100
  RELATED BY SLMN-ID TO CAI-ORDERS-REC
PRINT FROM CAI-ORDERS-REC ORD-ID
      FROM CAI-SLSHST-REC ITM-ID
                          SHIP-QTY
                          UNIT-PRICE

When you execute the preceding query, CA Dataquery displays in a columnar format the order number identifying the customer and the corresponding items ordered (which are greater than 100) and the price per item.

Output

=> 01/02/2010 CA Dataquery PAGE 1 15:29:32 DETAIL ORD-ID ITM-ID SHIP-QTY UNIT-PRICE ------ ---------- -------- ---------- 08811 O50006 0000203 00014.75 09811 G10013 0000164 00110.25 04222 O50006 0000934 00014.75 -------------------------------- LAST PAGE ------------------------------------ <PF1> HELP <PF2> RETURN <PF3> TOTALS ONLY <PF4> DETAIL <PF5> NO TOTALS <PF6> STATS <PF7> BACKWARD <PF8> FORWARD <PF9> NOT USED <PF10> NOT USED <PF11> LEFT <PF12> RIGHT