Field names: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Overview==
==Field and field group naming rules==
<p><var class="product">Model&nbsp;204</var> 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 <var class="product">Model&nbsp;204</var> at your site. </p>
<p>
<p>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.</p>
Every field and field group in a <var class="product">Model&nbsp;204</var> file has a name by which it is referenced. The following restrictions apply to these names names:</p>  
<p>This chapter discusses the following file design considerations:</p>
<p>
Note that a name can only be used once per file (a field group and field can not have the same name).</p>
<ul>
<ul>
<li>Fields that comprise a logical record</li>
<li>Names must begin with a letter.</li>
<li>Names and attributes of each field</li>
<li>When more than one consecutive space appears in a name, the extra spaces are ignored.</li>
<li>Organization of the data in the file's Table B</li>
<li>Names may contain as many as 255 characters. Names should be short enough to enter easily, but long enough to have meaning.</li>
<li>Arrangement of the file's data into physical and logical files</li>
</ul>
<p>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 <var class="product">Model&nbsp;204</var> runs.</p>
==Designating fields==
<p>When setting up a <var class="product">Model&nbsp;204</var> file, you must 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. </p>
===Variable record formats===
<p>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".)  </p>
===Multiply occurring fields===
<p>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.    </p>
 
==Field name rules==
<p>Every field in a <var class="product">Model&nbsp;204</var> file has a field name by which it is referenced. The following restrictions apply to field names:</p>
<ul>
<li>Field names must begin with a letter.</li>
<li>When more than one consecutive space appears in a field name, the extra spaces are ignored.</li>
<li>Field names can contain as many as 255 characters. Field names should be short enough to enter easily, but long enough to have meaning.</li>
<li>Certain restricted words and special characters either cannot be used at all or can be used only with special syntax.</li>
<li>Certain restricted words and special characters either cannot be used at all or can be used only with special syntax.</li>
</ul>
</ul>
===Reserved characters allowed in field names with special syntax===
<p>If any of the reserved characters listed in [[#Reserved characters allowed in field names with special syntax|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.</p>
===Reserved characters allowed in names with special syntax===
<p>
If any of the reserved characters listed in [[#Reserved characters allowed in names with special syntax|Reserved characters allowed in names with special syntax]] is embedded in a name, the character must be part of a quoted string. When forming names, avoid the following characters.</p>
<table>
<table>
<caption>Reserved characters allowed with special syntax</caption>
<caption>Reserved characters allowed with special syntax</caption>
<tr>
<tr>
<td>$</td>
<td><b>$</b></td>
<td>></td>
<td><b>></b></td>
<td>+</td>
<td><b>+</b></td>
</tr>
</tr>
<tr>
<tr>
<td>(</td>
<td><b>(</b></td>
<td>&lt;</td>
<td><b>&lt;</b></td>
<td>- (minus sign/hyphen)</td>
<td><b>-</b> (minus sign/hyphen)</td>
</tr>
</tr>
<tr>
<tr>
<td>)</td>
<td><b>)</b></td>
<td>*</td>
<td><b>*</b></td>
<td>^</td>
<td><b>^</b></td>
</tr>
</tr>
<tr>
<tr>
<td>=</td>
<td><b>=</b></td>
<td>/</td>
<td><b>/</b></td>
<td>,</td>
<td><b>,</b></td>
</tr>
</tr>
<tr>
<tr>
<td>...</td>
<td><b>...</b></td>
<td>:</td>
<td><b>:</b></td>
<td>%</td>
<td><b>%</b></td>
</tr>
</tr>
</table>
</table>
===Reserved characters not allowed in field names===
 
<p>The special characters listed in [[#Reserved characters not allowed in field names|Reserved characters not allowed in field names]] cannot be used in field names.</p>
===Reserved characters not allowed in names===
<p>
The special characters listed in [[#Reserved characters not allowed in names|Reserved characters not allowed in names]] cannot be used in names.</p>
<table>
<table>
<caption>Reserved characters not allowed in field names</caption>
<caption>Reserved characters not allowed in names</caption>
<tr>
<tr>
<td>??</td>
<td><b>??</b></td>
<td>@ (as delete character)</td>
<td><b>@</b> (as delete character)</td>
</tr>
</tr>
<tr>
<tr>
<td>?$           </td>
<td><b>?$</b> </td>
<td># (as flush character)</td>
<td><b>#</b> (as flush character)</td>
</tr>
</tr>
<tr>
<tr>
<td>?             </td>
<td><b>?</b> </td>
<td>;</td>
<td><b>;</b></td>
</tr>
</tr>
<tr>
<tr>
<td>&amp;</td>
<td><b>&amp;</b></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tr>
</table>
</table>
<p>Note</p>
<p class="note">
<p>The delete (@) and flush (#) characters used at an installation are controlled by the ERASE and FLUSH parameters, described in the <var class="product">Model&nbsp;204</var> Parameter and Command Reference. If different symbols are chosen, the restriction on using these characters in field names applies to the new symbols.</p>
<b>Note:</b>
The delete (<tt>@</tt>) and flush (<tt>#</tt>) characters used at an installation are controlled by the <var>[[ERASE parameter|ERASE]]</var> and <var>[[FLUSH parameter|FLUSH]]</var> parameters. If different symbols are chosen, the restriction on using these characters in field names applies to the new symbols.</p>
 
<b>Examples</b>
<b>Examples</b>
<p>Some examples of valid field names are:</p>
<p>
Some examples of valid field names are:</p>
<p class="code">A534
<p class="code">A534
A' = B'
A' = B'
Line 86: Line 86:
JULY.3.95
JULY.3.95
</p>
</p>
<p>Some examples of invalid field names are:</p>
<p>
Some examples of invalid field names are:</p>
<p class="code">%INTEREST
<p class="code">%INTEREST
YEAR TO DATE
YEAR TO DATE
Line 93: Line 94:
3JULY95
3JULY95
</p>
</p>
===Reserved words requiring special attention in field names===
 
<p>The following conditions apply to the reserved words or operators listed in [[#Reserved words requiring special attention in field names|Reserved words requiring special attention in field names]]: </p>
===Reserved words requiring special attention in names===
<p>
The following conditions apply to the reserved words or operators listed in [[#Reserved words requiring special attention in names|Reserved words requiring special attention in names]]: </p>
<ul>
<ul>
<li>The word can be part of an unquoted string as long as it is not surrounded by spaces:</li>
<li>The word can be part of an unquoted string as long as it is not surrounded by spaces:
<p><code>NORTHERN SALES</code> is acceptable, but <code>NOR SLS</code> is not.</p></li>
 
<li>The word can be part of a quoted string as long as it does not stand alone:
<p><code>A 'OR' B</code> is acceptable, but <code>'OR'</code> is not.</p></li>
</ul>
</ul>
<b>NORTHERN SALES is acceptable but NOR SLS is not.</b>
<p>
<ul>
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.</p>
<li>The word can be part of a quoted string as long as it does not stand alone:</li>
 
</ul>
<b>A 'OR' B is acceptable but 'OR' is not.</b>
<p>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.</p>
<table>
<table>
<caption>Reserved words requiring special attention</caption>
<caption>Reserved words requiring special attention</caption>
<tr>
<tr>
<td>AFTER</td>
<td>AFTER&nbsp;</td>
<td>COUNT</td>
<td>COUNT&nbsp;</td>
<td>LIKE</td>
<td>LIKE</td>
<td>ORIF</td>
<td>ORIF</td>
<td>VALUES</td>
<td>VALUES&nbsp;</td>
<td>LT</td>
<td>LT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
</tr>
<tr>
<tr>
<td>ALL</td>
<td>ALL</td>
Line 122: Line 127:
<td>NE</td>
<td>NE</td>
</tr>
</tr>
<tr>
<tr>
<td>AND</td>
<td>AND</td>
Line 130: Line 136:
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tr>
<tr>
<tr>
<td>ANDIF</td>
<td>ANDIF</td>
Line 138: Line 145:
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tr>
<tr>
<tr>
<td>AT</td>
<td>AT</td>
Line 146: Line 154:
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tr>
<tr>
<tr>
<td>BEFORE</td>
<td>BEFORE</td>
Line 154: Line 163:
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tr>
<tr>
<tr>
<td>BY</td>
<td>BY</td>
Line 163: Line 173:
</tr>
</tr>
</table>
</table>
<b>Using reserved words or characters in field names</b>
 
<p>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:</p>
<b>Using reserved words or characters in names</b>
<p>
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 <code>NOR SLS</code>:</p>
<p class="code">FIND ALL RECORDS WITH 'NOR SLS' = 100000...
<p class="code">FIND ALL RECORDS WITH 'NOR SLS' = 100000...
</p>
</p>
<p>To delete a procedure with a reserved character:</p>
<p>
To delete a procedure with a reserved character:</p>
<p class="code">DELETE PROC '%SAVINGS'
<p class="code">DELETE PROC '%SAVINGS'
</p>
</p>
[[Category:File manager]]
[[Category:Model 204 files]]

Latest revision as of 22:45, 9 May 2014

Field and field group naming rules

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

Note that a name can only be used once per file (a field group and field can not have the same name).

  • Names must begin with a letter.
  • When more than one consecutive space appears in a name, the extra spaces are ignored.
  • Names may contain as many as 255 characters. 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 names with special syntax

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

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

Reserved characters not allowed in names

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

Reserved characters not allowed in 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. 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 names

The following conditions apply to the reserved words or operators listed in Reserved words requiring special attention in 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 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'