Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

16.2.4 Data dictionary

Type in the name of the DATA DICTIONARY to be used with this table. If a new table is being created, the default data dictionary name will be the same as the table name. The default extension is .DEF. This is illustrated in Section 16.2.2, Database Engine.

As with the data set, the same data dictionary can be used for a number of tables. In fact, any combination of definition, data and table files can be created:


table files            data set          data dictionary 
 
      CUSTOMER.STR                      CUSTOMER.DEF 
                  \                    / 
                   \                  / 
                    \                / 
                     \              /   
                      \CUSTOMER.ARS/  
                      /            \
                     /              \
                    /                \
                   /                  \ 
          SALES.STR                    SALES.DEF 

The data dictionary name can be any Windows file specification.

After you have selected the table and data dictionary that you will be working with, the other options in the Structure Definition window can be used to perform SETUP procedures.

16.3 SETUP - Properties and Procedures

Inside the STRUCTURE DEFINITION WINDOW click on [Properties]. The FIELDS window will appear.

Example 16-6 Structure Definition Window


The options inside the Fields window will enable you to perform the following procedures in SETUP on the selected data dictionary:

Example 16-7 Fields Window


16.3.1 Data Field Definitions

Clicking on [ADD] will open the FIELD DEFINITION window. This selection is used to add data fields to new or existing data dictionaries. Here you can enter in the following information for each data field:

Example 16-8 Field Definition Window


When you have completed adding all of the field information inside the Field Definition window, click on [DONE]. The field definitions will then be added to the DATA DICTIONARY. You will be returned to the Fields window where you can either perform other functions or choose [Finish].

If this is a new table, the new table file will be created after you click on [Finish].

16.3.1.1 Name

Enter the data field name inside the NAME input field. For example, name a data field "CUST_ID" that will store customer identification information.

The field name:

Note that the Description, Prompt Text and Report Heading fields will default to be the same as the data field name. This default may be changed.

16.3.1.2 Classification

The CLASSIFICATION input field should be left blank at this time.

16.3.1.3 Description

The Description input field will default to the same as the data field "Name" that was entered. Any "$", "%", "_" characters will be changed to spaces.

You may type in any description you want for this data field. This description is shown when viewing the data dictionary.

The description can consist of any characters on the keyboard and be up to 30 characters long.

16.3.1.4 Data Type

Beside the DATA TYPE input field, click on the down arrow to select a data type. The data type is the internal representation of the data.

The most common data type is CH (character) which is the default. Use CH as the data type when defining names, addresses, money, date/times.

The other datatypes that follow such as IN (integer), IU (integer unsigned), etc. are provided for special cases where there is pre-existing binary data that must be defined. The UN datatype is for UNTYPED DATA such as an embedded JPG image or other arbitrary binary data.

Note

When developing new applications, use the CH datatype.

The data type will be one of the following:

Table 16-1 Data Types in SETUP
Symbol Data Type
CH character
AC ASCII counted string
AP Pointer to ASCII counted
C3 COBOL comp-3, also known as packed decimal
DS Date stamp (length=8)
EB EBCDIC
FL Floating point
GF G-Float
IN Integer (signed)
IU Integer (unsigned)
PF Packed floating
PZ Packed zipcode
QS Quadword (signed)
RO Right overpunch
RS Right sign separate
UN Undefined
ZE Zoned EBCDIC
ZN Zoned numeric; used by DIBOL

Note

The DATE (DS) attribute is currently only used by applications and has no effect within Sheerpower.

16.3.1.5 Starting Position

Enter the STARTING POSITION for this data field. The first field starting position will be defaulted as position 1.

Fields generally follow each other directly. Therefore, the first position of a new data field is usually one more than the last position used. If the last position used was ten, the next data field would start at eleven. Sheerpower automatically defaults the starting position of each data field to the correct sequential position.

Defining Existing ARS File Fields

When defining data fields for an existing ARS file, keep in mind that the starting position of an ARS file record is 0 and in Sheerpower, the starting position is 1. (ARS is 0 oriented, whereas Sheerpower is 1 oriented.) For example, if the ARS file data field starts in position 0, when you define this data field in Sheerpower, you must define the data field as starting in position 1. If the ARS data field starts in position 20, you would use 21 as the starting position, etc.

16.3.1.6 Length

Enter the LENGTH required for the field. The default value shown for every data field added is 1 character. The length should be the maximum number of character positions that data in this data field may contain. Data fields can be any length. The length must be given as an integer number.

Variable Field Lengths

If a CH or UN data type field has a first position that starts at or before the end of a record (row), that field will have its length adjusted upon reference. The new length will reflect the actual end of the record (row).

For example, if you made a data field called ALL, and it started in position one with a length of 5000 bytes---and the actual record length was 1200 bytes, referencing the ALL field would return just 1200 bytes.

16.3.1.7 Occurs

Inside the OCCURS input field, type in the number of times that this data field occurs in the data record. The default number of occurrences is 1. If the data field being defined is an array, enter the number of elements in the array. Otherwise, leave the default value of 1.

16.3.1.8 Prompt Text

Enter the PROMPT TEXT for this data field. The prompt text will be used when data is entered for this field. The prompt text:

The default prompt text will be the data field name you entered for this field.

16.3.1.9 Semantics

Enter the SEMANTICS (attributes) that apply to this data field. The semantics describe what type of data will be in the field.

The default semantic is UC (uppercase). To change semantics, or to add/remove from the list, click on [Change]. The semantics window will open. Place a checkmark beside a semantic you want to add, and remove the checkmark from beside any semantic you want to remove.

For example, if a dollar amount will be stored into this field you would select MONEY. This will set the semantics for this field to NUM:2 (numeric field with two decimal places) and RJ (right justified).

Example 16-9 Semantics


Setting/defining semantics is optional. If you do not want any pre-defined semantics for the field, remove the UC semantic and click on [OK] to leave the semantics list blank and close out the dialog.

The semantics options are:

Table 16-2 Semantics Options in SETUP
Semantic Description
NUMERIC Indicates a numeric field which allows only numbers. The semantic RJ, right-justified, is automatically appended when NUMERIC is selected. If you select this you will also fill in Decimal Digits to define how many decimal places the field contains.
MONEY Specifically sets the field up as a numeric dollar field with two decimal places and right-justified.
RJ The data will be right-justified in the field.
UC All letters will be stored in upper-case format. Additionally, field comparison data will be upper-cased prior to any comparison.
ZF The data will be zero filled.
ZS Causes all leading zeros to be suppressed.
DATE[:YMD|MDY] This field contains a date. The field must be six or eight digits long. The default date format is YMD. You can enter DATE or optionally, specify the date format. The date format is currently only used by applications. Sheerpower does NOT automatically switch date values into or out of the format specified.
FULLTIME Indicates that the field contains a date-time stamp and the time value is to be preserved. By default, Sheerpower stores/retrieves only the date portion of a date stamp field.
APPLICATION:name This is a user defined semantic and is not used by Sheerpower. A user can assign a name to indicate that the field is related to a specific application (i.e. accounting). Application programs can then ask for the application name and perform some action based on the data.
DBFLD:fieldname This is a special semantic for augmented definition files only. The DBFLD semantic is used to associate an augmented field definition with an actual database field. "Fieldname" is the actual name of the field in the database.


Previous Next Contents Index