Creating Dictionary Entries

An item in the dictionary has the following format:

Item-ID

Name

Line

Description

D/CODE

Definition Code

1

Entry identifier.

A/AMC

Attribute Number

2

Attribute Mark Count.

S/NAME

Column Heading

3

Report heading or tag.

S/AMC

Structure

4

Controlling and Dependent attributes.

 

Not Used

5

 

 

Not Used

6

 

V/CONV

Conversion Code

7

Conversion specification.

V/CORR

Correlative Code

8

Correlative specification.

V/TYP

Type

9

Justification and wrap.

V/MAX

Column Width

10

Width of display field.

Only the Definition Code and attribute number are required. Note that lines 5 and 6 are empty. Each specification is reviewed in the next section.

Dictionary items can be created using either the line editor (EDIT or ED) or the full screen editor (DOC-EDIT or DE). If you use the line editor to create entries, you will find that in insert mode you cannot insert empty lines by pressing ENTER. (Pressing ENTER on an empty line exits insert mode; the screen editor uses the ESC key to exit insert mode and avoids this problem.) There are two ways around it: one is to enter a single character on any line that you want empty and later use the R command to find that character and replace it.

Perhaps the best way is to use CTRL+^ to insert attribute marks for each empty line. The following example demonstrates this method to create a dictionary entry named CUST-ID.

>ED DICT ORDERS CUST-ID

NEW ITEM

.I

001+A

002+1

003+Customer ID^^^

004+ML(#-####-####)^

005+L

006+12

007<RETURN>

.F

TOP

.P

001 A

002 1

003 Customer ID

004  

005

006

007 ML(#-####-####)

008

009 L

010 12

.FI

When the editor buffer is updated and displayed, the new listing shows that the attribute marks have been interpreted as new lines.

The subsequent sections look at each of the dictionary specifications in more detail.

Naming the Attribute Definition Item

Each entry in the dictionary requires a unique name. This name is the item-ID of the Attribute Definition item. The name usually serves as a logical reference to the data contained in an attribute in the data file item.

For instance, if the first attribute of an item contains a customer’s first name, then the name of the Attribute Definition item might be FIRST-NAME. Since these names are often used in INFO/ACCESS commands, they should be reasonably descriptive.

Identifying the Entry (Line 1)

Each entry in a dictionary is identified by a Definition Code or

A

Attribute Definition item. References the contents of an attribute in the data file.

S

Synonym Definition item. Attribute synonyms are usually created to define default output specifications for INFO/ACCESS.

I

Phrase definition. Phrases can be used to store parts of an INFO/ACCESS command.

X

Placeholder that maintains the sequence of default output attributes but produces no output.

D-pointers are also found in the dictionary. These are created by the CREATE-FILE processor and should not be modified by users.

Attribute Number (Line 2)

The attribute number or A/AMC is an integer that specifies the sequential position of an attribute in a data file item. For example, LAST-NAME is assigned an attribute number of 2, which identifies it as the second attribute in a CUSTOMERS data file item.

The table below summarizes the attribute numbers of the items in the CUSTOMERS dictionary:

Attribute

Attribute Number

FIRST-NAME

1

LAST-NAME

2

STREET

3

CITY

4

STATE

5

PHONE

6

ZIP

7

An attribute number of 0 (zero) refers to the item-IDs in the data file. When creating synonyms, you can specify an AMC of 0, the AMC of a referenced attribute, or any number greater than the last attribute number specified. An arbitrarily high attribute number can be assigned to any entry so that it can be referenced in correlative expressions.

An attribute number of 9998 or 9999 has a special meaning. In an INFO/ACCESS report, an entry with an attribute number of 9998 displays a running count of items in the report; 9999 displays the size of each item in bytes. If line 1 identifies a phrase, then the contents of the phrase begin on line 2.

Column Heading (Line 3)

This parameter defines the column heading or S/NAME that appears when the attribute is included in an INFO/ACCESS report. For example, the column heading for LAST-NAME is defined in initial caps and does not include a hyphen:

Last Name

If no column heading is specified, the item-ID of the Attribute Definition item is used.

In a columnar report, the column heading appears at the top of a column, identifying its contents. If it is not specified, the name of the attribute is used. If a backslash (\) is specified, no heading is output. To specify a multiline heading, use CTRL+] to indicate a line break.

Associating MultiValued Attributes (Line 4)

The Structure specification (S/AMC) is used to define an association between multiple values of two or more attributes. When an association is created, each value in the Controlling attribute corresponds to a value in each of the Dependent attributes. Each set of related values can be printed as a single line in an INFO/ACCESS report.

The C and D codes specify a Controlling or Dependent association, respectively.

C structure code

Links a Controlling attribute to one or more Dependent attributes.

D structure code

Links a Dependent attribute to a single Controlling attribute.

The CUSTOMERS file does not have MultiValued attributes.

Conversion (Line 7)

A conversion is an expression that is applied to data just before the data appears in a report. For example, a conversion code could format dollar amounts to insert a decimal point and a dollar sign ($). This means that these characters do not have to be stored with the amount.

Correlative (Line 8)

A correlative is an expression that specifies arithmetic and other types of preprocessing to be performed on data before it is otherwise processed. It derives its value by processing stored data.

Justification (Line 9)

The Justification specification (V/TYP) determines the alignment of columnar data in reports, as follows:

L

Left-justified (generally the case for alphabetic data). If data exceeds the length defined by the maximum column width, it wraps to the next line, beginning at the first character over the maximum length.

R

Right-justified (generally the case for numeric data).

T

Text left-justified. This type of justification is used for textual data. If data exceeds the length defined by the maximum column width, it wraps to the next line, starting at a blank space.

Justification also affects how data is to be sorted. If left-justified or right-justified, data is first justified then sorted from left to right. For example, given the data 10, 9, and 90 the following sorting occurs:

Left

Right

10

9

9

10

90

90

Column Width (Line 10)

The Column Width specification (V/MAX) specifies the maximum width of the display field in characters. Data exceeding this specification is wrapped on the next line depending upon V/TYP specification. Note that this is an output specification and does not affect the storage of data.

The column width specification is particularly important because the sum of the display width of specified attributes when compared to the line length of the terminal or printer determines whether a report is printed in columns or vertically.

Synonyms can be created to specify alternative display formats. For instance, an attribute containing a parts description might require a 40-character display field; this might be too wide to include with other information in a columnar report. A synonym might be defined that differs from the Attribute Definition only in that it specifies a smaller display width. If the width of the column heading exceeds the column width specification, the display field is the width of the column heading. If the length of the column heading is less than the display field, dots (.) are used to pad the column heading.

See Also

Creating a File

Selecting a File Name

Selecting a Modulo

Using CREATE-FILE

Creating Data Items