SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index


Chapter 16
Database Setup

16.1 SETUP--Overview

SheerPower works with data in any database engine. SETUP tells SheerPower where data files are located and what database engines are used. Structures and definitions are the description of the data layout and it’s characteristics. Once structures have been defined with SETUP, SheerPower's structure statements can be used to manipulate the data.

SETUP supports the following database engines:

ARS
ODBC
FASTFILE
See Chapter 17, SheerPower and ODBC for instruction on using ODBC with SheerPower.

16.1.1 Entering SETUP

SETUP is entered by selecting SheerPower on the toolbar, then selecting Setup Data Structures.

Example 16-1 Entering SETUP


The OPEN STRUCTURE dialog box will open. If this is an existing structure, select the folder where it is stored, then select the file name.

If you are creating a new structure, choose the folder where it is to be stored and type in the file name.

Click on [Open] to open the structure.

Example 16-2 Open Structure


Once the structure has been opened, the STRUCTURE DEFINITION window will be displayed.

Example 16-3 Structure Definition Window


16.2 SETUP Structure Definition

This section describes the SETUP structure definition fields and options for answering them. Data fields inside the structure can be defined or modified. Field definitions can also be displayed in multiple formats.

Default answers are provided for many of the structure definition fields. You may either accept the default answer, or type in different information.

16.2.1 Structure Name

The NAME of the structure will default to be the same name as the file that you opened or created. The default extension for the file is .STR. The structure file contains:

The structure name can be any Windows file specification.

Clicking on the [...]button to the left of the structure NAME field will reopen the Open Structure dialog box. This allows you to choose a different structure name.

16.2.2 Database Engine

Click on the down arrow beside the DATABASE field to select the DATABASE ENGINE used by this structure.

Example 16-4 Selecting Database Engine


If this is a new structure, the default database engine will be ARS.

When modifying an existing data structure, the default will be the database engine specified in the structure file when it was originally setup.

16.2.3 Data Set

Inside the DATA SET field, type in the name of the DATA SET that will be used with this structure. If this is a new structure, the default data set name will be the same as the structure name. The default extension is .ARS.

Example 16-5 Data Set


The same data set can be used for a number of structures. For instance, you might use the CUSTOMER data set for both a CUSTOMER and a SALES structure:


          structure files      data set 
 
             CUSTOMER.STR         | 
                         \        | 
                          \       v 
                           \
                            CUSTOMER.ARS 
                           / 
                          / 
                         / 
                SALES.STR              

This can be useful when there are multiple uses for a set of data, but the access and definitions required should be different for each structure.

The data set name can be any Windows file specification.

16.2.4 Data dictionary

Type in the name of the DATA DICTIONARY to be used with this structure. If a new structure is being created, the default data dictionary name will be the same as the structure 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 structures. In fact, any combination of definition, data and structure files can be created:


structure 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 structure 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 structure, the new structure 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), ... are provided for special cases where there is pre-existing binary data that must be defined.

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.


Previous Next Contents Index