M!INTOUCH® 4GL Y

INTOUCH® 4GL
A Guide to the INTOUCH Language

A
Previous page... 6Table of Contents
a

Chapter 16
Creating Structures, Field Definitions with SETUP

8

16.1 SETUP--Overview



NINTOUCH works with data in any record management system. SETUP tells INTOUCH Jwhere data files are located and what record management systems are used. HOnce you have defined your structures with SETUP, you can use INTOUCH's -structure statements to manipulate the data. 

3SETUP now supports the following database engines: 







Procedures



1The following procedures are available in SETUP: 





LEach of the SETUP procedures is described in detail on the following pages. 

;

16.1.1 Entering SETUP



>To enter SETUP, type CALL SETUP at the INTOUCH prompt. 

Example 16-1 To Use SETUP


 INTOUCH   CALL SETUP  



4SETUP will ask you a number of questions including: 





Example 16-2 SETUP Prompts


WSETUP V4.2 Set Up INTOUCH 4GL Data Structures  Structure name : Database engine: Dataset : Data dictionary:         PStructure name? _______________________________________________________________   WEXIT = Exit \ = Back HELP = Help



EYou can create a new structure by entering new file names or you can =modify existing structures by selecting them at the prompts. 

AOnce you have specified the structure you want to work with, you Acan define fields in the structure or display field definitions. 6

16.2 SETUP Prompts



NThis section describes the SETUP prompts and your options for answering them. 

FWhen you are using SETUP and are at any of the prompts, you can enter FHELP or press the Help key to get information about the prompt. 

MDefault answers are provided for many of the prompts. If you want to accept Othe answer provided, press the Return key at the prompt. If you do @not want to use the default, type your answer over the default. 

IIf you want to go back to a previous prompt, use the "\" (backslash key) to back up. 

;

16.2.1 Structure Name



KEnter a structure name. This can be a new name or the name of an existing Jstructure. If you are creating a new structure, this will be the name of Athe structure file. The default extension for the file is .STR. The structure file contains: 





IYour structure name can be any VMS file specification. (See the chapter =INTOUCH Running Under VMS for information on VMS file specifications.) 





<

16.2.2 Database engine



LUse the arrow keys to select the database engine (record management system) 9used by this structure. INTOUCH supports these systems: 





(You can refer to the LINTOUCH Interfaces to Database Engines manual for more information.) 

FIf you are creating a new structure, the default will be RMS. If you Bare modifying an existing data structure, the default will be the Ldatabase engine (record management system) specified in the structure file. EFASTFILE is an INTOUCH record management system designed for speed. 





4

16.2.3 Dataset



FEnter the name of the data file (dataset) you will be using with this Kstructure. If this is a new structure, the default data file name will be @the same as the structure name. The default extension is .DAT. 

@You can use the same data file for a number of structures. For Einstance, you might use the CUSTOMER data file for both the CUSTOMER and the SALES structures: 



)          structure files      data file  $             CUSTOMER.STR         | $                         \        | $                          \       v                            \)                            CUSTOMER.DAT                            /                           /                          / '                SALES.STR              


GYour dataset name can be any VMS file specification. (See the chapter =INTOUCH Running Under VMS for information on VMS file specifications.) 





Rdb dataset

?If the database engine is Rdb, the input format will be Ldifferent. An Rdb database consists of tables. Each structure corresponds Pto one table. For Rdb, the dataset is the name of a table in the Rdb database. 

3        FORMAT:         table_name IN rdb_database  7        EXAMPLE:        employee in rdb_data:personnel 


DBMS dataset

?For a DBMS dataset, you need to specify the DBMS record Kname and the name of the DBMS root file. Optionally, you can add the name of the subschema. 

AIf the subschema is not given, the DEFAULT_SUBSCHEMA is assumed. 

G        FORMAT:         record_name IN [subschema_name FOR ] root_file  9        EXAMPLES:       part in datadisk:[parts]dbmparts  D                        part in ss0001 for datadisk:[parts]dbmparts 


INGRES dataset

=For an INGRES dataset, you need to specify the INGRES Ctable name. The INGRES database to use is specified by the symbol INT_INGRES_DBNAME. 

#        FORMAT:         table_name  !        EXAMPLE:        employee 


ADABAS dataset

;For an ADABAS dataset, you need to specify the file number and the database number. 

7        FORMAT:         file_number IN database_number          EXAMPLE:        6 IN 1 


ORACLE dataset

=For an ORACLE dataset, you need to specify the ORACLE table name. 

#        FORMAT:         table_name          EXAMPLE:        emp 


<

16.2.4 Data dictionary



MEnter the name of the definition file you will be using with this structure. KIf you are creating a new structure, the default definition file name will Dbe the same as the structure name. The default extension is .DEF. 

LAs with the data file, you can use the same definition file for a number of Istructures. In fact, you can create any combination of definition, data and structure files: 



 =structure files          data file          definition files  5      CUSTOMER.STR                      CUSTOMER.DEF )                  \                    / (                   \                  / '                    \                / (                     \              /   &                      \CUSTOMER.DAT/  $                      /            \%                     /              \&                    /                \(                   /                  \ 1          SALES.STR                    SALES.DEF  


HYour definition file name can be any VMS file specifications. (See the Echapter INTOUCH Running Under VMS for information on VMS file specifications.) 





HThere are three special definition file names allowed. If the database Hengine for this structure can supply the field information and you want :to use these native definitions, enter NONE as the Jdefinition file name and INTOUCH will use the definitions embedded in the !database engine with the fields. 





9These database engines can supply the field definitions: 





JIf you are using a database engine that supports native field definitions M(Rdb, for example) and you would like to augment the native definitions with Kadditional definitions, you can enter a definition file name prefixed with EAUG>. This will create an augmented definition file. The Jnative field names will be available along with any fields defined in the Iaugmented definition file. Typically, augmented definitions are used to 5supply report headings, prompt text and print masks. 

MFor example, if you have an Rdb table which contains of the following native fields: 

7                Name            Start           Length 7                -----           -----           ------ 5                fielda             1              10 5                fieldb            11               5 5                fieldc            16              10 


Oand you want to define a field (an index) consisting of "fielda" and "fieldb", Kyou can create an augmented data dictionary and define the index you want. 





9If you are using CDD, you can enter CDD>3and a name of a CDD/Plus Directory and recordname: 





?                       CDD>DEVDISK:[DEVINT.CDDTEST]CUSTOMER <                           ^                      ^^      ^ <                           |                      ||      | <                           +----------------------++------+ ;                              Directory name        record 9                                                    name 


+CDD/Plus access is read only at this time. 

FAfter the structure information has been entered, the SETUP Procedure GMenu will be displayed and you can select the SETUP procedure you want to perform. 

9

16.3 SETUP Procedures



Example 16-3 SETUP Procedures


WSETUP V4.2 Set Up INTOUCH 4GL Data Structures  Structure name : CUSTOMER.STR Database engine: RMS Dataset : CUSTOMER.DAT Data dictionary: CUSTOMER.DEF     7 +---Setup Procedure---+ 0 | Define fields | 3 | Show [>| 3 | Modify structure [>| 0 |---------------------| 0 | Create data file | 0 | EXIT | 0 +---------------------+   WEXIT = Exit \ = Back HELP = Help



1The following procedures are available in SETUP: 








,

Note

JDepending on the database engine chosen and the definition file selected, )you might not have all of these options. 



ITo select the SETUP procedure you want to perform, use the arrow keys to Ohighlight your selection and then press Return. You can also enter 9in the first few characters and press Return. 

9

16.4 DEFINE Procedure



KYou can use the DEFINE procedure to define the fields in a structure. The FDEFINE procedure is also used to modify and delete field definitions. 

AWhen the Define fields menu option is selected, the field &definition input screen is displayed. 

+Example 16-4 Field Definition Input Screen


WSETUP V4.2 Definitions for CUSTOMER.STR  Fieldname : Classification : Description : Data type : 4First position : length: Occurs: Semantics :   Prompt text : Report heading : Print mask : Screen mask : Help text : Access rules : Validation rules:    .Field name? _________________________________  : Enter -fieldname to delete a field WEXIT = Exit \ = Back HELP = Help



JYou will be asked first for the name of the field you wish to add, modify Gor delete. You will then be prompted for information about the field. 

7

16.4.1 Field name



KEnter the field name you wish to add, modify or delete. If you are adding Ka new field, the field name will be used to identify this field. If there @are existing fields, you can use one of the SHOW options *to get a list of the current field names. 

=If you wish to delete a field, enter a minus sign (-) *followed by the field name. For example: 

)                Field name? -phone


The field name: 





FIf you are modifying a field, the defaults for the rest of the DEFINE Iprompts will be your original responses. You can keep these defaults by Opressing the Return key at the prompt. You can change the defaults by typing over the responses. 

;

16.4.2 Classification



JEnter the field class or press Return to accept the default of none. 

The classification is optional. 

NClassification refers to a field class in the CLASSIFICATION data dictionary. 9Field classes are pre-defined commonly used data fields. 



Using Classifications



KThere are cases when you use the same field type in a record or in several Hdatasets. When this occurs, setting up a field class will save time in 3defining fields and help to ensure data integrity. 

LIf, for example, you had a home phone field, work phone field and alternate Lphone field in your record, you would need to define the three phone fields Lusing different field names but the same characteristics. The phone fields Jwould all be 10 numeric characters in length and be printed in the format (123) 456-7890. 

MTo ensure that all the phone numbers are defined exactly the same, you could Cdefine a phone class in the CLASSIFICATION data dictionary. MThe class name could be PHONE and be defined with the length (10), semantics N(num), print mask ((###~)~ ###~-####) and validations (digits; minlength 10). 

MThen, whenever you want to define a phone number type field, you would enter Ithe field name, HOME_PHONE for example, with PHONE as the classification Kand the classification data would automatically become the default answers Jto the remaining DEFINE prompts. If you did not want to use a particular Bdefault, you can simply type in a different answer at the prompt. 

KYou would also be able to use the PHONE classification when defining phone !fields in other dataset records. 

JBefore you can use field classifications, you must first define the field /classes in the CLASSIFICATION data dictionary. 



Creating Field Classes



JField classes are defined the same way as any other data field. However, Pthese fields are located in a specific data file called TTI_RUN:CLASSIFICATION. 6To create a field class, perform the following steps: 



    
  1. Get into SETUP. B
  2. Enter TTI_RUN:CLASSIFICATION as the structure name. 5 The following information will be displayed: 

    5        Structure name :  TTI_RUN:CLASSIFICATION.STR         Database engine:  RMS         Dataset        :  NONE 5        Data dictionary:  TTI_RUN:CLASSIFICATION.DEF 
    2
  3. Select the Define fields procedure. L
  4. At the field name prompt, enter the field class name you want to use  (i.e. PHONE). I
  5. Go through each of the prompts and set up the characteristics you ' want this field class to have. 



2You can set up as many field classes as you wish. 

/

Using an Alternate Classification File



IIf you do not want to use the provided TTI_RUN:CLASSIFICATION data file, Kyou can create one of your own. For example, you could create a structure Jsuch as CLASS_NAMES for your field classes. However, if you choose to do 2this, you MUST define the file as follows: 





ISETUP will then retrieve classification data from CLASS_NAMES instead of TTI_RUN:CLASSIFICATION. 



Generated Defaults



GAfter the classification prompt is answered, SETUP displays either the Hclass defaults or defaults generated by SETUP to assist you in defining the field. 

BExample 16-5 DEFINE Screen showing field class generated defaults


WSETUP V4.2 Definitions for CUSTOMER.STR  Fieldname : HOME_PHONE Classification : PHONE Description : Home phone Data type : CH 7First position : 14 length: 10 Occurs: 1 Semantics : NUM, RJ   Prompt text : Home phone Report heading : Home Phone %Print mask : (###~)~ ###~-#### Screen mask : none Help text : none Access rules : NORMAL (Validation rules: digits; minlength 10    ,Description? Home phone____________________   WEXIT = Exit \ = Back HELP = Help



<Example 16-6 DEFINE Screen showing SETUP generated defaults


WSETUP V4.2 Definitions for CUSTOMER.STR  Fieldname : HOME_PHONE Classification : none Description : Home phone Data type : CH 7First position : 14 length: Occurs: 1 Semantics : UC   Prompt text : Home phone Report heading : Home Phone Print mask : none Screen mask : none Help text : none Access rules : NORMAL Validation rules: none    ,Description? Home phone____________________   WEXIT = Exit \ = Back HELP = Help



8

16.4.3 Description



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

HIf you are adding this field, the default description is the field name 5with any "$", "%", "_" characters changed to spaces. 

9The description will be used as the default prompt text. 

6

16.4.4 Data type



CEnter the data type for this field. The data type is the internal >representation of the data. The most common type is CHO(character) which is the default. The data type will be one of the following:    !     %     q          "                                                                )  
AC ASCII counted string
AP Pointer to ASCII counted
C3 COBOL comp-3, also known as packed decimal; the C3 data type also supports the VAX DECIMAL data type
CH Character
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


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

;

16.4.5 First position



LEnter the position at which this field will start. Character positions are %numbered sequentially. For example:  Figure 16-1 Character Positions

 %                   ID        CONTACT C                   ----------------------------------------------- C                   | | | | | | | | | | | | | | | | | | | | | | | | @                   |       |         |         |         |      @         positions 1       5        10        15        20       



MIn the above diagram, the ID field starts at position 1 and ends at position 15. The CONTACT field starts at position 6, etc. 

LFields generally follow each other directly. Therefore, the first position Mof a new field is usually one more than the last position used. If the last Fposition used was ten, the next field would start at eleven. INTOUCH ;automatically defaults to the correct sequential position. 

(Defining existing RMS file fields

KIf you are defining fields for an existing RMS file, you must keep in mind Jthat the starting position of an RMS file record is 0 and in INTOUCH, the Mstarting position is 1. (RMS is 0 oriented, whereas INTOUCH is 1 oriented.) IFor example, if the RMS file field starts in position 0, when you define Lthis field in INTOUCH, you must define the field as starting in position 1. IIf the RMS field starts in position 20, you would use 21 as the starting position, etc. 



4


Next page... | 6Table of Contents