Default output specifications may be created in the dictionary of the referenced file and are used only when explicit output specifications are not included in an INFO/ACCESS statement. For example, assume that the default output specifications for the CUSTOMERS file are defined to include the data for FIRST-NAME, LAST-NAME, CITY, and STATE. With the new default in effect, typing:
>LIST CUSTOMERS |
is equivalent to typing:
>LIST CUSTOMERS FIRST-NAME LAST-NAME CITY STATE |
Default output specifications are defined in the file dictionary. There are three ways to define them:
By creating an @LPTR item containing an output specification phrase
By creating an @ item containing an output specification phrase
By creating a sequence of numbered Attribute Definition items
If all three of these methods are implemented in the file dictionary, the system treats them in the order shown. In all cases, the default output specifications take effect only if an INFO/ACCESS query does not include explicit output specifications.
Creating an @LPTR Phrase
A phrase is a dictionary item that may include any parameters from an INFO/ACCESS query except for a command or a file name. The use of phrases is described in Using Phrases.
Creating a phrase in the CUSTOMERS dictionary whose item-ID is @LPTR defines the default output specifications for reports sent to the printer. Once an @LPTR phrase is defined, any INFO/ACCESS statement that contains the LPTR modifier or its equivalent, the P option, and does not specify an output specification, will display data from the attributes named in the @LPTR phrase. For example, the following @LPTR phrase specifies customer’s first and last names, city, and state:
@LPTR 001 I 002 FIRST-NAME LAST-NAME 003 CITY STATE |
A definition code of I defines this file item as a phrase. When the following query is typed:
>LIST CUSTOMERS LPTR |
the results will be the same as:
>LIST CUSTOMERS FIRST-NAME LAST-NAME CITY STATE LPTR |
Creating an @ Phrase
Creating a phrase in the CUSTOMERS dictionary whose item-ID is @ defines the default output specifications for reports. If there is also an @LPTR phrase in the dictionary, the output specifications in the @ phrase will be used only for reports sent to the terminal screen; the @LPTR phrase determines what is output to the printer. If there is no @LPTR phrase in the dictionary, the @ phrase is used for reports sent either to the screen or to the printer.
For example, the user may define the following @ phrase in the CUSTOMERS dictionary:
@ 001 I 002 FIRST-NAME LAST-NAME 003 CITY STATE |
Type this command to produce the following default report:
>LIST CUSTOMERS |
|
|
|
|
Page 1 |
|
|
10:33:54 DD MMM YYYY |
|
|
|
|
|
|
CUSTOMERS... |
First Name...... |
Last Name...... |
City................ |
State |
|
|
|
|
|
HJENK7129 |
HAROLD |
JENKINS |
INDIANAPOLIS |
IN |
JBOHA5422 |
JOHN |
BOHANNON |
BOSTON |
MA |
JBROW6749 |
JAMES |
BROWN |
BOSTON |
MA |
JBUCK6488 |
JULIE |
BUCKLER |
LINCOLN |
IN |
BLEAR6803 |
BILL |
LEARY |
BOSTON |
MA |
JMASO6378 |
JULIA |
MASON |
LINCOLN |
IN |
AORLA5993 |
AMY |
ORLANDO |
VENICE |
CA |
SPIRS5289 |
SANDRA |
PIRS |
WINSTON |
NC |
MASHX5777 |
MARY |
ASH |
INDIANAPOLIS |
IN |
AEDWA5224 |
ANTHONY |
EDWARDS |
SUDBURY |
MA |
JPEER5993 |
JAN |
PEERCE |
LOS ALTOS |
CA |
RPIER5539 |
RICK |
PIERCE |
RIDGEWOOD |
NJ |
AJOHN5396 |
ANNE |
JOHNSON |
LOUISVILLE |
KY |
HJOHN7265 |
HENRY |
JOHNSON |
OMAHA |
NB |
HHIGG6849 |
HENRY |
HIGGINS |
OMAHA |
NB |
DEDGE6635 |
DAVID |
EDGECOMB |
MIAMI |
FL |
AMEAD5619 |
ANDREW |
MEADE |
SUDBURY |
MA |
BLAMP6196 |
BOB |
LAMPSON |
BOSTON |
MA |
|
|
|
|
|
18 ITEMS LISTED. |
|
|
|
Creating Dictionary Items in Numeric Sequence
If the file dictionary contains Attribute Definition items with numeric item-IDs, and if they form a consecutive numeric sequence starting with 1, these items are used as default output attributes. Each item in the sequence must contain an A code in line 1.
If an Attribute Definition item in a numeric sequence contains an X instead of an A in line 1, that attribute will not be included as one of the default output attributes. However, the attributes defined by items that follow this X item in the numeric sequence will be included in the report. This allows the user to keep the ID number of the numeric Attribute Definition item the same as the attribute number.
One way to create a numeric sequence of default output attributes is to copy an existing set of Attribute Definition items with the COPY command. For example, if the CUSTOMERS dictionary has Attribute Definition items for FIRST-NAME (Attribute 1), LAST-NAME (Attribute 2), CITY (Attribute 3), and STATE (Attribute 4), copy them, giving them the item-IDs 1, 2, 3, and 4. When the following statement is executed, the data from all four attributes is displayed by default:
>LIST CUSTOMERS |
To exclude Attribute 3, CITY, from the sequence of default output attributes, change the definition code in line 1 of the Attribute Definition item 3 from A to X. Now only Attributes 1, 2, and 4 will be displayed by default.
See Also