SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

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 okay to leave the semantics list blank.

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.

16.3.1.10 Report Heading

The REPORT HEADING is the heading that you want to appear on reports. This heading will appear at the top of the report column containing this field's data. If you are adding a new record, the default report heading is the NAME you entered.

The heading can be up to 30 characters long.

To make a multi-line heading, separate each line of the heading with a comma (i.e., Customer,Information).

16.3.1.11 Print Mask

Enter a PRINT MASK for this data field. The print mask is used to display information entered into this field. The print mask will be used whenever you use SheerPower's PRINT statement to print this field's information.

Print masks are created with the #, @ and % characters. SETUP will automatically provide the tilde (~) character for any literal (non-masking) characters found in the entered mask. Some examples:


                                EXAMPLE 1                   EXAMPLE 2 
      Data to be masked         AB1234XY                    AB1234XY 
      Data to print as          (AB-1234-XY)                AB 1234 XY 
      Mask you enter            (##-####-##)                ## #### ## 
      SETUP displays            (##~-####~-##)              ##~ ####~ ## 

You can refer to Chapter 7, Printing and Displaying Data for more information on print masks.

16.3.1.12 Screen Mask

The SCREEN MASK is used by applications to enter data into this field.

A program can ask for the screen mask and use it in whatever manner that is desired. The format should be the same as for the print mask.

16.3.1.13 Help Text

HELP TEXT can be entered for this data field. The help text can be displayed during data entry if the user types "HELP".

Custom applications can also display this help text.

The help text:

16.3.1.14 Access Rules

Enter the ACCESS RULES for this data field. The access rules determine who will have access to this field. NORMAL allows users to read, add and change data field information.

Access rules have the following formats:


READ:read_access, WRITE:write_access 
 
NORMAL 

where read_access and write_access are each represented by a single letter from (A-Z).

NORMAL denotes READ:N, WRITE:N.

A is the most restricted access level. Z is the least restricted access level.

The access_rules are used in conjunction with the structure security level to determine whether or not a user can access the data field.

When a user attempts to access a data field, the structure security level is compared to the read or write access level defined for the data field. If the data field's access level is lower than the structure security level, access is allowed. For example:

If the structure READ access is J and the field READ access is T, the field data CAN be read. However, if the structure WRITE access is J and the field WRITE access is E, the field CANNOT be written to or changed.

16.3.1.15 Validation Rules

You can enter VALIDATION RULES for this field. The validation rules will be used to validate data entered by a data entry program.

The data entry program can access these validation rules to make sure that the data entered is valid prior to storing the data into the data field.

To add or change the validation rules, click on [CHANGE] beside the Validation Rules field. The VALIDATION RULES window will open.

Example 16-10 Validation Rules


In the example above, the field has been set with validations that it is a REQUIRED field and can contain only LETTERS.

The validation options are:


LETTERS              UCASE              LCASE               REQUIRED 
YES/NO               INTEGER            INTEGERWORD         DIGITS 
NUMBER               FULLTIME           VRULES              PRINTMASK 
EXPRESSION           CODE               MENU                ROUTINE 
DECIMALS             LENGTH             CHARACTERS          NOCHARACTERS 
ALLOW                DISALLOW           PATTERN             FILTER 
DATE                 MINLENGTH          MAXLENGTH 

When you have completed your list of validation rules, click on [OK].

Refer to Section 6.6.6, VALID(text_str, rule_str) for detailed information on the VALID function.


Previous Next Contents Index