Field names

From m204wiki
Revision as of 03:47, 21 March 2013 by Alex (talk | contribs) (Automatically generated page update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Model 204 provides many features that allow you, as the file designer, a great deal of flexibility in creating a file structure that optimizes the efficiency of Model 204 at your site.

This chapter covers the options available to you when designing files, along with the associated performance issues. Understanding these options, and understanding the database and application needs of your site, helps you design efficient file structures.

This chapter discusses the following file design considerations:

  • Fields that comprise a logical record
  • Names and attributes of each field
  • Organization of the data in the file's Table B
  • Arrangement of the file's data into physical and logical files

As the file designer, your responsibility is to make informed decisions concerning these issues based on knowledge of the data and required results. In so doing, you can have a dramatic effect on the efficiency with which Model 204 runs.

Designating fields

When setting up a Model 204 file, you must first decide what fields the records will contain. A record in a personnel file, for instance, might contain a Social Security number field, a last name field, a spouse's name field, and so on.

Variable record formats

Each record is not required to have a value for every field; record format is variable. If an employee's address is unknown, for example, the address field can be left out of the record altogether and some disk space is saved. However, if preallocated fields are specified for a file, space is reserved in each record for all the preallocated fields. (See "Preallocated fields".)

Multiply occurring fields

Most types of fields can be multiply occurring, that is, have more than one value per record. For example, the CHILD field can appear several times in one record.

Field name rules

Every field in a Model 204 file has a field name by which it is referenced. The following restrictions apply to field names:

  • Field names must begin with a letter.
  • When more than one consecutive space appears in a field name, the extra spaces are ignored.
  • Field names can contain as many as 255 characters. Field names should be short enough to enter easily, but long enough to have meaning.
  • Certain restricted words and special characters either cannot be used at all or can be used only with special syntax.

Reserved characters allowed in field names with special syntax

If any of the reserved characters listed in Reserved characters allowed in field names with special syntax is embedded in a field name, the character must be part of a quoted string. When forming field names, avoid the following characters.

Reserved characters allowed with special syntax
$ > +
( < - (minus sign/hyphen)
) * ^
= / ,
... : %

Reserved characters not allowed in field names

The special characters listed in Reserved characters not allowed in field names cannot be used in field names.

Reserved characters not allowed in field names
?? @ (as delete character)
?$ # (as flush character)
? ;
&  

Note

The delete (@) and flush (#) characters used at an installation are controlled by the ERASE and FLUSH parameters, described in the Model 204 Parameter and Command Reference. If different symbols are chosen, the restriction on using these characters in field names applies to the new symbols.

Examples

Some examples of valid field names are:

A534 A' = B' ANNUAL.%INTEREST YEAR.TO.DATE JULY.3.95

Some examples of invalid field names are:

%INTEREST YEAR TO DATE USE COUNT NAME?? 3JULY95

Reserved words requiring special attention in field names

The following conditions apply to the reserved words or operators listed in Reserved words requiring special attention in field names:

  • The word can be part of an unquoted string as long as it is not surrounded by spaces:

NORTHERN SALES is acceptable but NOR SLS is not.

  • The word can be part of a quoted string as long as it does not stand alone:

A 'OR' B is acceptable but 'OR' is not.

Although you can define field names using reserved words, programs that reference those fields might not compile and you might receive errors or other unexpected results.

Reserved words requiring special attention
AFTER COUNT LIKE ORIF VALUES LT
ALL EACH NOR RECORD WHERE NE
AND EDIT NOT RECORDS WITH  
ANDIF END OCC TAB EQ  
AT FROM OCCURRENCE THEN GE  
BEFORE IN ON TO GT  
BY IS OR VALUE LE  

Using reserved words or characters in field names

If you do use reserved words or characters as part of a field name, you can reference the field names by enclosing the field name with the reserved word or character in single quotation marks. The following example uses a field name called NOR SLS:

FIND ALL RECORDS WITH 'NOR SLS' = 100000...

To delete a procedure with a reserved character:

DELETE PROC '%SAVINGS'