Field Option

Overview

The Field option is for editing the field definitions for a selected alias and viewing the existing data. See Viewing Field and Index Data. The Field options, Edit, Guess, and Load, along with their suboptions, are described below.

Edit

The Edit option is for editing the field definition parameters. The data associated with an alias can also be viewed. If no data dictionary alias has been selected, the DD Editor prompts for one. The Field Options screen contains the field parameters.

On this screen, move through a form and fill in the blanks. Use the up and down arrow, Enter, and <JUMP> keys to step from field to field. Field parameters are described below.

Field Name

The field name is entered automatically when changing an existing field. To change the field name, key the new name over the existing name. The name must:

  • Start with a letter.

  • Contain only letters, numbers, and underscores "_".

  • Not be a PRO/5 reserved word.

The name is automatically converted to upper case.

Identically named fields can be used to establish file relationships when building a database. For example, if an inventory file and order file are related based on a product code, the PRODUCT_CODE field name must be identical in both files.

Type

The type will be a PRO/5 data type from those listed below:

Type Code

Data Type

C

Character (string). This is the default.

N

Numeric (free-format numbers).

U

Unsigned integers (similar to type I, but the values are always interpreted as positive numbers).

I

Integers, stored in fixed-length field of 1, 2, 3, or 4 bytes.

F

IEEE Floating Point representation.

D

Binary Coded Decimal (BCD) representation.

B

Business Floating Point.

X

C Floating Point.

Y

C Double.

Press the <LIST> key here to select from a list of data types.

Length

The Length parameter defines the internal (stored) size of this field. This is a required field. The range is based on the data type:

Type Code

Length

C or N:

Up to 99999 bytes.

I or U:

1, 2, 3, or 4 bytes.

F, D, B, X, Y:

N/A (these data types are always 8 bytes).

Variable?

Data types C and N may be variable length, terminated by any valid delimiter. This field requires a Yes or No answer. The default is No.

Traditional PRO/5 data formats are typically made up of variable-length type C and N fields, delimited by the linefeed character, $0A$. The decimal equivalent of $0A$ is 10.

When defining an existing record structure that contains several line-feed delimited fields containing substrings, define all except the last substring as fixed-length. The final substring in the record is defined as variable-length, with a delimiter of 10.

Terminator

Variable-length fields must be terminated by a character that indicates the end of the field. The default is 10 ("$0A$", or linefeed).

The terminator does not have to be a linefeed. For example, programs can be written that process UNIX operating system files (with colons as field terminators) by setting Terminator=58, ":".

It is possible to set the terminator to a normal printable character (for example, 65, or "A"). However, this causes unexpected results when the character appears in data.

Precision

All numeric fields have a precision attribute that determines the accuracy of the number. This value is in the range of 1 to 14, with -1 indicating floating point (maximum precision). The default is two decimal places. The data dictionary does not automatically apply the precision to the data. The precision attribute takes effect when a value is assigned to the field.

For example, the product of EMPLOYEE.GROSS_PAY (precision of two decimal places) multiplied by the FICA rate (precision of three decimal places) is calculated using real decimal arithmetic. For example:

employee.fica_withheld=employee.gross_pay*fica_rate;

The result is rounded to two decimal places. The calculations are performed at the precision of the field the result will be assigned to. See the Numeric Precision and RangeRounding sections in the User's Reference Guide additional information.

Title

This string is used in report programs as the default column heading for this field. For example:

Customer ID

Output Mask

The output mask can be used to format data for output operations. The data dictionary does not automatically apply the mask to the data. The masking conventions are detailed under the Numeric Output and String Output Masking sections in the User's Reference Guide.

Expand

The Expand code is used to convert data from a stored format to a display and data entry format when the field is read from disk. The data dictionary does not automatically apply the Expand code to the data. The Expand code may be a CALLed program or any PRO/5 expression.

In Expand codes, the "%" character represents the current field. For example, the following PRO/5 expression may be used to convert a Julian date (stored format) to a data entry or display format (MM/DD/YY).

DATE(%:"\%Mz\%Dz\%Yz")

Delete

The Delete option is described under Deleting Field and Index Definitions.

Load

The Load option is used to load the field definition for an alias based on a template file. A template file is a PRO/5 string file (operating system native text file) containing a string template. For example:

item_num:n(4),descrip:c(60*),cost:n(10*),supplier:c(40*)

This technique can be used for defining the data dictionary for an existing application. See String Templates for additional information on string templates.

Guess

The Guess option examines an existing data file and attempts to generate field definitions for the record layout. It will only look for traditional PRO/5 data types (C for character strings or N for numeric data). Field terminators are used to guess fields in variable-length records. For fixed-length records, spaces are used to determine field separations. Fields are generically named FIELD1, FIELD2, ..., FIELD10, etc.