Data Definition Item
Data definition items (formerly known as attribute definition items) define the attributes, that is, the characteristics of the data in a file. They specify the format and the type of processing required to generate English reports.
You can set up any number of data definition items in the file's dictionary. A data definition item is associated with an attribute in a data file item by specifying the appropriate Attribute Mark Count (AMC) in attribute 2 of the data definition item. This definition then refers to that attribute (also known as a 'line' or 'field') within items in a data file.
You can set up data definition items to:
-
Specify default output.
-
Associate attribute names with attribute numbers.
-
Perform output formatting.
-
Calculate values based on data from other attributes, or other files.
-
Perform processing via conversion codes.
The format of a data definition item is described in the topic Data Definition Item in the section File and Item Structures (User's Reference: General).
Column headings
Column headings are not displayed if an English statement contains a COL-HDR-SUPP output modifier or C command option. You specify column headings in attribute 3 of the data definition item, which can contain one of the following:
-
Heading text
This will be used as it is for the column heading. To produce a blank heading, insert the number of blanks given by the column width here. Value marks (CTRL+]) can be included to make subsequent heading text start on the next line within the column.
-
Null
The item-id of the data definition item is used for the column heading.
-
Backslash (\)
Whatever text follows the backslash is used for the column heading. If nothing follows the backslash, the column heading consists of a row of dots equal in number to the column width.
S D/CODE
If attribute 3 is null and attribute 1 of the data definition item contains S, English treats the item as though it had A in the first attribute and a backslash followed by null in the third. The S D/CODE is an older form that is still used in some systems.
Default output specification
English allows you to set up data definition items that the system uses if an English statement does not include any specification of attributes to be output. The data definition items must be named by number (1, 2, 3, and so on). These numbers represent the order in which headings and the associated data are to be output. They need not follow the sequence of the attributes in the file's items.
When English processes a statement that does not have any output specification, it looks in the dictionary for a data definition item named 1, then for an item named 2, then 3, and so on until it no longer finds an item with the next higher number. If the data definition item has an A D/CODE, the heading and data for that attribute are output. If the data definition item has an X D/CODE, however, English skips that attribute and looks for the next higher number.
So, when you set up a series of implied data definition items, put an A in the first attribute of each one. If you later wish to skip one or more of these items, change their first attribute to X. Remember that English stops looking for items when it does not find a number in sequence: if you delete an item in the middle of a series, English stops looking for any higher numbers.
X D/CODE
A data definition item with an X D/CODE is skipped only when the output specification is implied. A data definition item with a number for a name can be used explicitly in the output specification clause or in any other clause where an attribute is appropriate. When used this way, a data definition item with an X D/CODE is treated exactly like a data definition item with an A D/CODE.
Data definition item examples
Assume a PERSONNEL file with the employee badge number as item-id, last name in attribute 1, first name in attribute 2, and the title of the position in attribute 7 of each item. The data definition items for the automatic display of the column header and the associated data contain the following data:
1 2 3 Item Name 001 A 001 A 001 A Heading code 002 l 002 2 002 7 Attribute No. 003 Last Name 003 First Name 003 Title Heading text 004 004 004 005 005 005 006 006 006 007 007 007 008 008 008 009 L 009 L 009 L Alignment 010 20 010 15 010 15 Column width
Sample report
:LIST PERSONNEL PAGE 1 11:19:56 11 MAY 1994 PERSONNEL. Last Name........ First Name ..... Title...... 0023 Brown Charles Programmer 0024 Clarkson Lydia Secretary 0025 Wood Laurence Manager 3 ITEMS LISTED
If you were to change attribute 1 of data definition item 2 from A to X, that attribute would not be displayed:
:LIST PERSONNEL PAGE 1 11:19:56 11 MAY 1994 PERSONNEL. Last Name........ Title......... 0023 Brown Programmer 0024 Clarkson Secretary 0025 Wood Manager 3 ITEMS LISTED
The next example uses the ROOMS file to illustrate a heading on two lines. Note that attribute 3 has a value mark (CTRL+]) indicating where the heading break should be.
ROOM-CODE 001 A Heading option 002 l Attribute number 003 Room]Code Heading text 004 005 006 007 008 G0,l Group extraction - G Code 009 L Alignment 010 4 Column width
The group extraction - G Code - in attribute 8 is used to display only the bed code in the ROOMS file. Attribute 1 in that file contains both the bed code and the room code.
Sample report
:SORT ROOMS BY ROOM-CODE ROOM-CODE PAGE 1 10:17:15 04 MAY 1994 ROOMS..... Room Code 117 D 119 D 194 D 142 D 144 D 194 D 211 DL . . 444 ST 478 ST 600 ST 30 ITEMS LISTED
The next example uses the same data definition item as the previous example but attribute 3 is changed to illustrate the use of the backslash to suppress the heading.
ROOM-CODE 001 A Heading option 002 l Attribute number 003 \ Suppress heading 004 005 006 007 008 G0,l G code 009 L Alignment 010 4 Column width
Sample report
:SORT ROOMS BY ROOM-CODE ROOM-CODE PAGE 1 10:19:15 04 MAY 1994 ROOMS..... .... 117 D 119 D 194 D 142 D 144 D 194 D 211 DL . . 444 ST 478 ST 600 ST 30 ITEMS LISTED
Special attribute mark counts
English recognizes three special attribute mark counts (A/AMC): 0, 9998, and 9999. When attribute 2 of a data definition item contains 0, the system returns the item-id. When it contains 9998, the system returns a line count equal to the number of lines so far in a report produced by LIST or SORT. When it contains 9999, the system returns the item size.
Instead of using numbers 9998 or 9999, you can use function operators within an A or F conversion code in attribute 7 or 8 of the data definition item. Function code operand NI yields the same value as the 9998 AMC. Operand NL yields the same value as the 9999 AMC.
A/AMC = 0 Item-id
A data definition item can be set up to define an item-id attribute to allow a LIST or SORT operation to list the item-ids in a column other than the first, and to use any column heading.
Typically, when using such an attribute, you would use the ID-SUPP modifier or the I command option to suppress the item-id in the first column.
Example
Assume a PERSONNEL file with the employee badge number as item-id, last name in attribute 1, and first name in attribute 2.
The data definition items to display last names, first names and badge numbers could contain the following data:
NAME FIRST.N BADGE Item Name 001 A 001 A 001 A Heading code 002 l 002 2 002 0 Attribute No. 003 Last Name 003 First Name 003 Badge Heading text . . . 009 L 009 L 009 L Alignment 010 17 010 14 010 % Column width :SORT PERSONNEL BY NAME FIRST.N BADGE (IH) Last Name........ First Name..... Badge Brown Charles 1023 Clarkson Lydia 0573 Wood Laurence 5068 3 ITEMS LISTED
A/AMC = 9998 Line Count/NI operand
A data definition item can be set up to define an attribute that allows a LIST or SORT operation to number each line of output. If you set the A/AMC (second attribute) to 9998, English returns the current line count. The function code operand NI returns the same value.
Example
A data definition item specifying item count allows an English sentence similar to the following to be used:
ENTRYNUM 001 A 002 9998 Count specification 003 Entry]No. Column heading 004 005 006 007 008 009 R Alignment 010 5 Column width :LIST STOCK ENTRYNUM HDR-SUPP STOCK..... Entry No. 23060 1 35085 2 32080 3 23075 4
A/AMC = 9999 Item Size/NL operand
A data definition item can be set up to define an item size attribute. If you set the A/AMC (second attribute) to 9999, English returns the size of the item including the item-id, all attribute marks in the item, and the segment mark at the end of the item body. The size does not include the item header nor any pad. The function code operand NL returns the same value.
Example
A data definition item specifying item size allows an English sentence similar to the following to be used:
SIZE 001 A 002 9999 Size specification 003 Size Column heading 004 005 006 007 008 009 R Alignment 010 6 Column width :SORT STOCK BY SIZE WITH SIZE > "300" SIZE HDR-SUPP STOCK..... Size.. 23060 396 35085 404 32080 518 23075 519
Predefined data definition items
Predefined data definition items are automatically loaded into the MD when an account is created. Additional items can be created or the existing items can be customized. However, any changes may be overlaid by subsequent upgrades.
If appropriate data definition items are not included in a file's dictionary, a report can be generated using the data definition items in the account's MD. Data definition items provided with each new account include items 1 through 11 and *A1 through *A13 (see table below). In addition, Reality recognises the attribute names An, where n is the number of any attribute.
Item |
AMC |
Heading |
Align |
Width |
Notes |
---|---|---|---|---|---|
1 |
1 |
D/CODE |
L |
8 |
|
2 |
2 |
A/AMC |
L |
10 |
|
3 |
3 |
S/NAME |
L |
10 |
|
4 |
4 |
S/AMC |
R |
2 |
|
5 |
5 |
L/RET |
L |
10 |
|
6 |
6 |
L/UPD |
L |
10 |
|
7 |
7 |
V/CONV |
L |
15 |
|
8 |
8 |
V/CORR |
L |
10 |
|
9 |
9 |
V/TYP |
L |
2 |
|
10 |
10 |
V/MAX |
L |
3 |
|
11 |
11 |
V/MIN |
L |
3 |
|
*An |
n |
*An |
L |
10 |
n = 1 to 13 |
An |
n |
An |
L |
10 |
n is the number of any attribute |
Notes
- .
Note
-
Attribute 11 is not currently used, but is reserved for future extensions.
-
There are normally no data definition for items An, and they therefore use the default settings shown in the table. You can override these settings for a particular attribute by creating the corresponding data definition item (An).
Other definition items
The following predefined definition items are also provided:
Item |
Description |
---|---|
DPTR |
Returns 1 if the item is a D-pointer; otherwise 0. |
LUPD.TIME |
Returns the time of the last update of the item, in external format. |
LUPD.DATE |
Returns the Date of the last update of the item, in external format. |
LUPD.TS |
Returns the string timestamp (date and time) of the last update of the item, in external format.
|
ILUPD.TIME |
Returns the time of the last update of the item, in internal format. |
ILUPD.DATE |
Returns the Date of the last update of the item, in internal format.
|
ILUPD.TS |
Returns the string timestamp (date and time) of the last update of the item, in internal format. |
Examples
Dictionary item contents are automatically listed under the headings for predefined definition items 1 to 11 if the English sentence does not contain an output specification:
:LIST DICT INV.HQ PAGE 1 10:05:25 05 MAY 1994 INV.HQ : INV.HQ D/CODE DL attr. 1 - D-Pointer A/AMC ACCOUNTS/INV.HQ.INV.HQ attr. 2 - Control data S/NAME B3 301,1 attr. 3 - Control data V/TYP L attr. 9 - Alignment V/AMX lO attr. 10 - Column width INV.HQ : INV.LGB D/CODE DL . . .
If there are no data definition items in a file's dictionary, a report can be generated under the predefined headings as follows:
:SORT PERSONNEL 1 2 3 PAGE 1 10:46:30 05 MAY 1994 PERSONNEL. D/CODE.. A/AMC... S/NAME 0023 Brown Charles 22 Sycamore Dr. 0024 Clarkson Lydia 1001 South St. 0025 Wood Laurence 168 Belsize Ave.
An enquiry using *An within the output specification is as follows:
:SORT PERSONNEL *A1 *A2 *A3 PAGE 1 10:46:30 05 MAY 1994 PERSONNEL. *A1....... *A2....... *A3....... 0023 Brown Charles 22 Sycamore Dr. 0024 Clarkson Lydia 1001 South St. 0025 Wood Laurence 168 Belsize Ave.