INTOUCH® 4GL
A Guide to the INTOUCH Language


Previous page... Table of Contents

Select how you want your file to be organized. The options are:

If you are going to be sorting and/or extracting data from the RMS file you are creating, the indexed file organization is more efficient than the sequential organization. This is especially true if you have large files.

An indexed file contains one or more indexed key fields which allow programs to locate and access file data very quickly without having to read through the file to locate records.

A sequential file has no key fields and accessing file data can be very slow and time consuming. Locating data in a sequential file requires reading every record in the file to find all occurrences of the data.

If you select Indexed file organization, you will be asked for the key fields in later prompts.

Record size

Enter the record size that you want for this data file.

The default record size is 25% larger than the actual length of the fields defined. This allows room for adding new fields to the record without having to expand the record size.

The legal record sizes depend on the database engine (file management system) you use. For RMS, sizes range from 1 to approximately 32000.


Note

Depending on the database engine and file organization, SETUP might ask for additional information.

If no additional information is required to create this data file, you can enter "Y"es at the Proceed with file creation prompt and your data file will be created using the appropriate database engine.

Primary key field

Select the field from the list of defined fields, that you want to use as the primary key field. The first field is the default.

RMS indexed files require at least one key field, the primary key field.

You can refer back to the "DEFINE Procedure" section for information on key fields.


SETUP V4.2 Creating RMS data file: CUSTOMER.DAT File organization: INDEXED Recordsize : 181 Primary key : Key 2 : +Primary Key Field Name+ Key 3 : | CUSTNBR | Key 4 : | NAME | Key 5 : | ADDR1 | Key 6 : | ADDRESS | Key 7 : | ADDR2 | Key 8 : | CITY | Key 9 : | STATE | Key 10 : | ZIP | | BALANCE | | CONTACT | | PHONE | |----------------------| | EXIT | +----------------------+ EXIT = Exit \ = Back HELP = Help

Allow duplicates

You can control whether the data to be stored in the RMS key field will be unique (only one occurrence of the data in the key field) or allow duplicates (multiple occurrences of the data in the key field).

Data access works most efficiently with unique key fields.

Normally, the PRIMARY key field is set up to allow only unique data in the field (i.e. NO duplicates) and the other key fields (ALTERNATE key fields) can be unique or not.

If you want more than one key field, select the fields you want to use as ALTERNATE key fields. Selecting All keys defined ends key field selection.

You will be asked if you want to proceed with file creation. Enter Y to create the data file.

After the file has been created, you will be returned to the SETUP procedures menu.

16.8 Defining COBOL Record Fields

The TTI_RUN:COBOL_DEF.INT program allows COBOL users to define COBOL record fields. This program processes a text file that contains a COBOL record definition statement and creates an INTOUCH data dictionary (definition file).

The program expects the text file to contain a single COBOL record definition statement. The file must be in one of the following formats:

The file name or file specification that is to be defined can be up to 63 characters in length if the screen margin is set at 80. If the margin is set to 132, 115 characters are allowed.

16.8.1 Define Example

Here is an example of how to use the TTI_RUN:COBOL_DEF program. This example shows the input file and the created file.

The sample text file COBOL_TEST.RECORD contains the following record definition statement:

01  test_rec. 
  05  code pic x. 
  05  desc pic x(20). 
  05  amount pic s9(5)v99 comp. 
  05  tbl  occurs 3 times. 
      10  tbl-code pic x(5). 
      10  tbl-desc pic x(25). 

To run the program, enter the following at the "$" prompt:
$ INTOUCH/SOURCE TTI_RUN:COBOL_DEF

The program screen will be displayed:


COBOL_DEF V4.2 Create INTOUCH Definition from COBOL Definition COBOL copy-lib: ANSI format : COBOL copy-lib? _______________________________________________________________ EXIT = Exit \ = Back HELP = Help

At the "COBOL copy-lib?" prompt, enter the file name. In this example, the file name is COBOL_TEST.RECORD.

At the "Is file in ANSI format (Y/N)? NO:_,_" prompt, press the Return key to take the "NO" default because the COBOL_TEST.RECORD file is not in ANSI format, it is in TERMINAL format.

To proceed, enter "Y" at the "Proceed with definition creation (Y/N)?" prompt.

The program processes the COBOL_TEST.RECORD file and creates the COBOL_TEST.DEF file.

You are returned to the "COBOL copy-lib?" prompt. Enter EXIT to exit the program.

Checking the Output

To see what the COBOL_TEST.DEF file looks like, you can:

  1. Get into INTOUCH by entering INTOUCH
  2. Enter CALL SETUP to activate the SETUP routine.
  3. Answer the following prompts:
    • Structure name : COBOL_TEST
    • Database engine: RMS
    • Dataset : COBOL_TEST
    • Data dictionary: COBOL_TEST

    After the prompts are answered, a COBOL_TEST.STR file is created.
  4. Use the arrow keys to select the Show menu option and the Brief field display option

The following definition listing is created:

11-Apr-1995              Definitions for: COBOL_TEST.DEF               Page:   1 
 
Field Name       Description      First  Length  Occurs  Last  Dtype  Print Mask 
---------------- ---------------- -----  ------  ------ -----  -----  ---------- 
TEST_REC         Test rec             1     115      1    115  CH     none 
      Semantics  : UC 
 
CODE             Code                 1       1      1      1  CH     none 
      Semantics  : UC 
 
DESC             Desc                 2      20      1     21  CH     none 
      Semantics  : UC 
 
AMOUNT           Amount              22       4      1     25  IN     none 
      Semantics  : NUM:2, RJ, ZF 
 
TBL_A1           Tbl a1              26      30      1     55  CH     none 
      Semantics  : NUM, RJ, ZF 
 
TBL_CODE_A1      Tbl code a1         26       5      1     30  CH     none 
      Semantics  : UC 
 
TBL_DESC_A1      Tbl desc a1         31      25      1     55  CH     none 
      Semantics  : UC 
 
TBL_A2           Tbl a2              56      30      1     85  CH     none 
      Semantics  : NUM, RJ, ZF 
 
TBL_CODE_A2      Tbl code a2         56       5      1     60  CH     none 
      Semantics  : UC 
 
TBL_DESC_A2      Tbl desc a2         61      25      1     85  CH     none 
      Semantics  : UC 
 
TBL_A3           Tbl a3              86      30      1    115  CH     none 
      Semantics  : NUM, RJ, ZF 
 
TBL_CODE_A3      Tbl code a3         86       5      1     90  CH     none 
      Semantics  : UC 
 
TBL_DESC_A3      Tbl desc a3         91      25      1    115  CH     none 
      Semantics  : UC 


Chapter 17
INTOUCH Running Under VMS

17.1 File Specifications

Every file has a file specification. The file specification is used to access the file. In INTOUCH, a legal file specification looks like this:
node::device:[directory]filename.ext;version

When you use a file name in an INTOUCH statement or command, it must be given as a string expression. If the file name is given as a constant, it must be enclosed in quotes. For example:
OLD 'ACCOUNT'

You can specify any legal OpenVMS file specification with INTOUCH. Simply name the file according to the rules described in the Command Language and DCL User's Guide of the OpenVMS documentation set.


Note

The default extension for INTOUCH programs is .INT. The default for include files is .INC.


Appendix A
Built-in Functions

INTOUCH has numerous built-in functions. This appendix describes the system and other built-in functions.

A.1 System Functions

The following functions return information about the system and user actions:

_BACK

Returns a TRUE or FALSE value. TRUE if the backslash key was pressed at the last prompt.

_CHANNEL

Returns the next available channel number.

        10  out_ch = _CHANNEL 
            OPEN #out_ch: NAME 'sys$scratch:test.lis' 
            PRINT #out_ch: 'This is a test' 
            CLOSE #out_ch 
        20  END 

_DEBUG

Returns a TRUE or FALSE value. TRUE if DEBUG is on. FALSE if DEBUG is off.

_EXIT

Returns a TRUE or FALSE value. TRUE if EXIT was entered at the last prompt.

_EXTRACTED

Tells how many records were extracted in the last extract.

        10  OPEN STRUCTURE cl: NAME 'tti_run:client' 
        20  EXTRACT STRUCTURE cl 
        30    INCLUDE cl(state) = 'CA' 
        40  END EXTRACT 
        50  PRINT 'Number of California clients:'; _EXTRACTED 
        60  END 

_HELP

Returns a TRUE or FALSE value. TRUE if HELP or a question mark (?) was entered or the Help key is pressed at the last prompt.

_INTEGER

Sometimes when the user does a CALL, an integer value is returned as a result of the CALL. _INTEGER returns any resulting integer data.

        10  LIBRARY 'LIBRTL' 
        20  CALL LIB$ICHAR('Q') 
        30  PRINT 'The integer value of "Q" is: '; _INTEGER 
        40  END 

_REAL

Some routines return a real value as the result of the CALL. The _REAL function returns any resulting real data.

        10  LIBRARY 'MTHRTL' 
        20  CALL MTH$ALOG(45.3) 
        30  PRINT 'The log is:'; _REAL 
        40  END 

_REPLY

Returns the user's reply to the last prompt. The reply is returned as a string.

_STATUS

Returns the value given to INTOUCH by the operating system, for the last operating system request. This function is useful when debugging system level errors. The _STATUS function is often used with the SYSTEXT$ function.

_STRING

Upon the completion of an INPUT MENU statement, the concept _STRING contains the menu path taken by the user when selecting the menu item. (i.e. "#2;#3" means the 3rd item of the 2nd submenu.)

_TERMINATOR

The _TERMINATOR function returns the name of the key that terminated the last INPUT statement. The values returned are:
UP Up arrow
DOWN Down arrow
RETURN Return
FIND Find (find line, word)
INS Insert
SEL Select
PREV Prev Screen
NEXT Next Screen
REM Remove
HELP Help
DO Do

PF1, PF2, PF3, PF4

KPO, KP1, KP2, KP3, KP4, KP5, KP6, KP7, KP8, KP9, MIN, COM, ENT, PER

F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, HELP, DO, F17, F18, F19, F20

A.2 Other Functions

The other non-system functions are:

ABS(num_expr)

ABS returns the absolute value of a specified numeric expression.

ACOS(num_expr)

ACOS(x) returns the angle whose COS is x. The angle is returned in radians.

ANGLE(num_expr, num_expr)

Given X and Y coordinates, returns the angle from 0,0. The angle is returned in radians.

ASCII(str_expr)

The ASCII function returns the decimal ASCII value of a string's first character. It is returned as an integer.

ASIN(num_expr)

ASIN(x) returns the angle whose SIN is x. The angle is returned in radians.

ATN(num_expr)

ATN returns the angle, in radians, of a specified tangent.

CEIL(num_expr)

CEIL(x) returns the ceiling of x. That is, the smallest integer that is not less than x.

CHANGE$(str_expr1, str_expr2, str_expr3)

CHANGE$ changes specified characters in str_expr1. Str_expr1 is the source string. Str_expr2 contains the target characters, and str_expr3 specifies the substitution characters. CHANGE$ returns the changed string.

CHANGE$ searches for the target characters within the source string and replaces these characters with the substitution characters. The substitution characters are mapped onto the target characters.

        10  LET a$ = 'bdbdbdbd' 
        20  LET b$ = 'b' 
        30  LET c$ = 'c' 
        40  LET changed$ = CHANGE$(a$, b$, c$) 
        50  PRINT a$ 
        60  PRINT changed$ 
        70  END 
 
        RNH 
        bdbdbdbd 
        cdcdcdcd 

CHARSET$[(str_expr)]

Returns the character set specified. The optional string expression can be used to specify the character set to return. The available character sets are:
UCASE all upper-case letters (A-Z)
LCASE all lower-case letters (a-z)
CONTROL all control characters (ASCII 0-31)
ASCII the ASCII character set, in order (0-255)

ASCII is the default character set for CHARSET$.

        10  LINE INPUT 'Enter your text': text$ 
        20  ! Change upper-case to lower-case 
            ct$ = CHANGE$(text$, & 
                 CHARSET$('UCASE'), & 
                 CHARSET$('LCASE')) 
            PRINT 'Lower-case version is:'; ct$ 
        30  END 

CHR$(int_expr1[, int_expr2])

CHR$ returns a string with the specified ASCII value (int_expr1) repeated the specified number of times (int_expr2). If no count is specified, a default count of one is used.

CONVERT(str_expr)

Given a string containing a mapped integer, this function returns the integer value.

        10  a$ = 'AB' 
            b = CONVERT(a$) 
        20  END 
 
        RNH 
        16961 

CONVERT$(int_expr1 [[, int_expr2], int_expr3])

Given an integer (int_expr1) and an optional length (int_expr2), which defaults to four, this function returns a string mapping of the integer.

If the optional data type (int_expr3) is 17, the returned string will be a packed floating (PF).

The following data types are supported:

Table A-1 CONVERT$ Function - Supported Data Types
Data Type Conversion Result
1 Integer (2 or 4 byte)
7 COBOL comp-3 (C3 packed decimal)
17 Packed floating (PF)

        10  a$ = CONVERT$(16961) 
            PRINT a$ 
        20  END 
        
        RNH 
        AB 

The CONVERT and CONVERT$ functions can be used in situations such as building segmented keys consisting of multiple data types.

COMPARE(str_expr1, str_expr2)

The COMPARE function compares two strings and returns a numeric value ranging from 0 (no match) to 100 (an exact match).

        10  options$ = 'LEFT,RIGHT,UP,DOWN' 
            best = 0 
            best$ = '' 
            INPUT 'Enter an option': usr_opt$ 
        20  FOR idx = 1 TO ELEMENTS(options$) 
              opt$ = ELEMENT$(options$, idx) 
              score = COMPARE(opt$, usr_opt$) 
              IF  score > best  THEN 
                best = score 
                best$ = opt$ 
              END IF 
            NEXT idx 
        30  SELECT CASE best 
            CASE 0 
              PRINT 'Unknown option: '; usr_opt$ 
            CASE 100 
              PRINT 'Option okay, it was: '; usr_opt$ 
            CASE ELSE 
              PRINT 'Misspelled option: '; usr_opt$ 
              PRINT USING 'Did you mean ? (## percent)': best$, best 
            END SELECT 
        40  END 
 
       RNH 
       Enter an option? dwn 
       Misspelled option: dwn 
       Did you mean DOWN (92 percent) 

COS(num_expr)

COS returns the cosine of an angle the user specifies in radians.

COSH(num_expr)

COSH returns the hyperbolic cosine of a passed real number.

COT(num_expr)

COT(X) is equivalent to 1/TAN(X).

CPAD$(text_str, size [, pad_str])

CPAD$ returns a new string, padded on the left and on the right with pad characters. Text_str is the string to be centered, size is the size of the new string. The default pad character is a space.

        10  PRINT CPAD$('123', 9, '0') 
        20  END 
 
        RNH 
        000123000 

CSC(num_expr)

CSC(x) is the cosecant of X. It is shorthand for 1/SIN(x).

DATE

Returns today's date in YYDDD format.

DATE$[(int_expr1, [int_expr2])]

The DATE$ function returns the date in image format. Int_expr1 is a given Julian day number, the default is today's date. Int_expr2 indicates the desired output format for the date. The Julian day---the number of days since January 1, 1600.

Table A-2 DATE$ Function - Integer Values
Value (int_expr2) Output Date Format
0 YYYYMMDD format
1 MMDDYYYY format
2 DDMMYYYY format
3 dd-Mon-yyyy format
4 Month dd, yyyy format

        PRINT DATE$(123456) gives you 
 
            19380104 
            |   | | 
           year mo day 
 
 
        PRINT DATE$ gives today's date 
 
            19910417 
            |   | | 
           year mo day 
 
 
        PRINT DATE$(123456,1) gives you 
 
            01041938 
            | |   | 
           mo day year 
                                     
 
        PRINT DATE$(123456,2) gives you 
 
            04011938 
            | |   | 
          day mo  year 
                                     
 
        PRINT DATE$(123456,3) gives you 
 
            04-Jan-1938 
 
 
        PRINT DATE$(123456,4) gives you 
 
            January 4, 1938 

To print today's date in a suitable format for a letter heading, you can use:

        PRINT DATE$(DAYS(DATE$),4) gives you 
 
            April 17, 1995 

DAYS(str_expr [, int_num])

Given a date in CCYYMMDD or YYMMDD format, returns the number of days since January 1, 1600 (this date is day 1). This number is called the Julian day.

        10  PRINT DAYS('19930403') 
        20  PRINT DAYS('930403') 
        30  END 
 
        RNH 
         143634 
         143634 

Int_num indicates the desired input format for the date. The default input format is zero. If the century is not included, it assumes 1900 as the century.

Table A-3 DAYS Function - Integer Values
Value (int_num) Input Date Format
0 CCYYMMDD or YYMMDD
1 MMDDCCYY or MMDDYY
2 DDMMCCYY or DDMMYY
3 DD-Mon-CCYY or DD-Mon-YY
4 Month DD, CCYY

        10  PRINT DAYS('19930403',0) 
            PRINT DAYS('04031993',1) 
            PRINT DAYS('03041993',2) 
            PRINT DAYS('03-Apr-1993',3) 
            PRINT DAYS('April 3, 1993',4) 
        20  END 
 
        RNH 
         143634 
         143634 
         143634 
         143634 
         143634 

DAY$[(int_expr)]

Given an integer expression specifying the number of days since January 1, 1600, DAY$ returns the day of the week. If no integer expression is given, DAY$ returns the day of the week for today's date. The day is returned as a string expression (Friday, Saturday, etc.).

DECODE(str_expr, int_expr)

Given the string representation of a number and the base that the value is in (int_expr), INTOUCH returns the value in base 10. The number is returned as a real number.

DEG(num_expr)


Next page... | Table of Contents