INTOUCH® 4GL
A Guide to the INTOUCH Language


Previous Contents Index

15.6 ASK #chnl_num:

FORMAT:


        ASK #chnl_num: [NAME str_var][, ZONEWIDTH num_var] [, MARGIN num_var] 
                       [, CURRENT str_var] 

EXAMPLE:


        10  OPEN #3: NAME 'storage.dat', ACCESS OUTPUT 
        20  ASK #3: ZONEWIDTH x 
            PRINT 'The current print zone width is'; x 
        30  CLOSE #3 
        40  END 
 
        RNH 
        The current print zone width is 20 

PURPOSE:

Use ASK #chnl_num to find what various characteristics a device is set to.

DESCRIPTION:

ASK returns the characteristic of the device specified and stores the value in a num_var or str_var. chnl_num is an optional channel number. If no channel number is specified, INTOUCH checks the default device. If a channel number is specified, INTOUCH checks the device associated with that channel number.

15.6.1 ASK Options

An option must be included in the ASK #chnl_num statement. The ask options currently available are described below.

ZONEWIDTH num_var

ASK #chnl_num: ZONEWIDTH finds the print zone width of the device specified and assigns the value to the numeric variable num_var.


        10  OPEN #3: NAME 'storage.dat', ACCESS OUTPUT 
        20  ASK #3: ZONEWIDTH x 
            PRINT 'The current print zone width is'; x 
        30  CLOSE #3 
        40  END 
 
        RNH 
        The current print zone width is 20 

MARGIN num_var

ASK MARGIN finds the right margin of the device specified and assigns its value to the numeric variable num_var.


        10  OPEN #3: NAME 'test_file.tmp', ACCESS OUTPUT 
        20  ASK #3: MARGIN marg 
            PRINT 'The current margin is'; marg 
        30  CLOSE #3 
        40  END 
 
        RNH 
        The current margin is 132 

CURRENT str_var

ASK #chnl_num: CURRENT is used to store a current record value into the str_var.


        10  OPEN #1: NAME 'temp.tmp', ACCESS OUTPUT 
            FOR z = 1 TO 20 
              PRINT #1: 'This is line number '; z 
            NEXT z 
            CLOSE #1 
        20  OPEN #1: NAME 'temp.tmp' 
            FOR i = 1 TO 5 
              LINE INPUT #1: a$ 
            NEXT i 
            ASK #1: CURRENT c$ 
            PRINT '5th item was: '; a$ 
        30  FOR i = 1 TO 5 
              LINE INPUT #1: a$ 
            NEXT i 
            PRINT '10th item was: '; a$ 
        40  SET #1: CURRENT c$ 
            LINE INPUT #1: a$ 
            PRINT 'Back to 5th item again: '; a$ 
        50  CLOSE #1 
        60  END      
        
        RNH 
        5th item was: This is line number  5 
        10th item was: This is line number  10 
        Back to 5th item again: This is line number  5 

NAME str_var

ASK #chnl_num: NAME asks the INTOUCH operating system for the file specification of the file open on channel #chnl_num and stores the value into str_var.


        10  out_ch = 12 
        20  OPEN #out_ch: NAME 'sys$scratch:minutes.lis', & 
                ACCESS OUTPUT 
        30  ASK #out_ch: NAME x$ 
        40  PRINT x$ 
        50  CLOSE #out_ch 
        60  END 
 
        RNH 
        USER:[TESTER]MINUTES.LIS 

15.7 SET #chnl_num: expr

FORMAT:


        SET # chnl_num: [ ZONEWIDTH num_expr ] [, MARGIN int_expr] 
                        [, CURRENT str_expr] 

EXAMPLE:


        10  OPEN #3: NAME 'storage.dat', ACCESS OUTPUT 
        20  ASK #3: ZONEWIDTH x 
            PRINT 'The current print zone width is'; x 
            SET #3: ZONEWIDTH 35 
            ASK #3: ZONEWIDTH x 
            PRINT 'The new print zone width is'; x 
        30  CLOSE #3 
        40  END 
 
        RNH 
        The current print zone width is 20 
        The new print zone width is 35 

DESCRIPTION:

SET #chnl_num sets various device characteristics. chnl_number is a channel number. If no channel number is specified, INTOUCH sets the default device (the terminal). If a channel number is specified, INTOUCH sets the device associated with that channel number.

When a device characteristic is SET, it remains set until the device is closed. Therefore, if the terminal is SET, it will remain SET until you exit from the INTOUCH environment or the SET statement is used again.

15.7.1 SET #chnl_num: Options

An option must be included with the SET #chnl_num statement. The set options currently available are described below:

ZONEWIDTH num_expr

SET #chnl_num: ZONEWIDTH sets the print zone width of the device specified to the number designated. num_expr indicates the width to set the device's print zones. See above example.

MARGIN int_expr

SET #chnl_num: MARGIN sets the right margin on the device specified to the number indicated. int_expr specifies the column to set the margin to. The margin must be greater than the zonewidth.


        10  OPEN #3: NAME 'storage.dat', ACCESS OUTPUT 
        20  SET #3: MARGIN 45 
            PRINT #3: REPEAT$('1234567',10) 
            CLOSE #3 
        30  OPEN #3: NAME 'storage.dat', ACCESS INPUT 
            DO 
              LINE INPUT #3, EOF endfile?: item$ 
              IF  endfile?  THEN  EXIT DO 
              PRINT item$ 
            LOOP 
        40  CLOSE #3 
        50  END 
 
        RNH 
        123456712345671234567123456712345671234567123 
        4567123456712345671234567 

CURRENT str_expr

SET #chnl_num: CURRENT sets the current record to that specified by str_expr. The str_expr contains the information for the record you want to make current.


        10  OPEN #1: NAME 'temp.tmp', ACCESS OUTPUT 
            FOR z = 1 TO 20 
              PRINT #1: 'This is line number '; z 
            NEXT z 
            CLOSE #1 
        20  OPEN #1: NAME 'temp.tmp' 
            FOR i = 1 TO 5 
              LINE INPUT #1: a$ 
            NEXT i 
            ASK #1: CURRENT c$ 
            PRINT '5th item was: '; a$ 
        30  FOR i = 1 TO 5 
              LINE INPUT #1: a$ 
            NEXT i 
            PRINT '10th item was: '; a$ 
        40  SET #1: CURRENT c$ 
            LINE INPUT #1: a$ 
            PRINT 'Back to 5th item again: '; a$ 
        50  CLOSE #1 
        60  END      
        
        RNH 
        5th item was: This is line number  5 
        10th item was: This is line number  10 
        Back to 5th item again: This is line number  5 

15.8 Deleting Files

15.8.1 KILL

FORMAT:


        KILL str_expr 

EXAMPLE:


        5   ! DANGER -- Executing this program will DELETE a file
 
        10  INPUT 'What file do you want to delete': file$ 
        20  KILL file$ 
        30  END 
 
        RNH 
        What file do you want to delete? 

PURPOSE:

Use KILL to delete a file from within your program.

DESCRIPTION:

KILL searches for and deletes the file specified in str_expr, the string expression. You must include the full file name with extension. If you do not include a version number, KILL will delete the most recent version only.


Chapter 16
Creating Structures, Field Definitions with SETUP

16.1 SETUP--Overview

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

SETUP now supports the following database engines:

Procedures

The following procedures are available in SETUP:

Each 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 
 

SETUP will ask you a number of questions including:

Example 16-2 SETUP Prompts


SETUP Vn.n             Set Up INTOUCH 4GL Data Structures                       
 
Structure name : 
Database engine: 
Dataset        : 
Data dictionary: 
 
 
 
 
 
 
 
 
Structure name? _______________________________________________________________ 
 
 
EXIT = Exit                                                \ = Back  HELP = Help

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

Once you have specified the structure you want to work with, you can define fields in the structure or display field definitions.

16.2 SETUP Prompts

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

When you are using SETUP and are at any of the prompts, you can enter HELP or press the [Help] key to get information about the prompt.

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

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

16.2.1 Structure Name

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

Your structure name can be any OpenVMS file specification. (See Chapter 17, INTOUCH Running Under OpenVMS, for information on OpenVMS file specifications.)

16.2.2 Database engine

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

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

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

16.2.3 Dataset

Enter the name of the data file (dataset) you will be using with this structure. 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 instance, 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              

Your dataset name can be any OpenVMS file specification. (See Chapter 17, INTOUCH Running Under OpenVMS, for information on OpenVMS file specifications.)

Rdb dataset

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


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

DBMS dataset

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

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


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

INGRES dataset

For an INGRES dataset, you need to specify the INGRES table 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.


        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

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

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


 
structure files          data file          definition files 
 
      CUSTOMER.STR                      CUSTOMER.DEF 
                  \                    / 
                   \                  / 
                    \                / 
                     \              /   
                      \CUSTOMER.DAT/  
                      /            \
                     /              \
                    /                \
                   /                  \ 
          SALES.STR                    SALES.DEF 
 

Your definition file name can be any OpenVMS file specifications. (See Chapter 17, INTOUCH Running Under OpenVMS, for information on OpenVMS file specifications.)

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

These database engines can supply the field definitions:

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

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


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

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

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


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

CDD/Plus access is read only at this time.

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

16.3 SETUP Procedures

Example 16-3 SETUP Procedures


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

The following procedures are available in SETUP:

Note

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

To select the SETUP procedure you want to perform, use the arrow keys to highlight your selection and then press [Return]. You can also enter in the first few characters and press [Return].


Previous Next Contents Index