INTOUCH® 4GL
A Guide to the INTOUCH Language


Previous page... Table of Contents

9.15.9 ASK SYSTEM, PASS: SUCCESS

FORMAT:

        ASK SYSTEM, PASS: SUCCESS num_var 

EXAMPLE:

        10  OPEN #1: NAME 'report.lis', ACCESS OUTPUT 
            PRINT #1: 'sample report' 
            CLOSE #1 
            PASS 'PRINT/HOLD REPORT.LIS' 
            ASK SYSTEM, PASS: SUCCESS okay 
            IF  okay  THEN 
              PRINT 'Report queued for printing' 
            ELSE 
              PRINT 'Unable to queue report for printing' 
            END IF 
        20  END 
 
        RNH 
        Report queued for printing 

DESCRIPTION:

This statement asks the operating system to return a TRUE (1) if true or FALSE (0) if false indicating whether or not the last PASS command executed successfully.

9.15.10 ASK SYSTEM: PROCESS

FORMAT:

        ASK SYSTEM: PROCESS str_var 

EXAMPLE:

        10  ASK SYSTEM: PROCESS process$ 
        20  PRINT 'Process is: '; process$ 
        30  END 
 
        RNH 
        Process is: TESTER_13B_3 

DESCRIPTION:

ASK SYSTEM: PROCESS str_var asks the operating system for the current process name.

9.15.11 SET SYSTEM: PROCESS

FORMAT:

        SET SYSTEM: PROCESS str_expr 

EXAMPLE:

        10  ASK SYSTEM: PROCESS process$ 
            curr_process$ = process$ 
            PRINT 'Current process is: '; curr_process$ 
        20  new_process$ = 'DO_TEST' 
            SET SYSTEM: PROCESS new_process$ 
            ASK SYSTEM: PROCESS process$ 
            PRINT 'New process is: '; process$ 
        30  SET SYSTEM: PROCESS curr_process$ 
            ASK SYSTEM: PROCESS process$ 
            PRINT 'Old process restored: '; process$ 
        40  END 
 
        RNH 
        Current process is: TESTER_13B_3 
        New process is: DO_TEST 
        Old process restored: TESTER_13B_3 

DESCRIPTION:

SET SYSTEM: PROCESS str_expr changes the operating system process name to str_expr.

9.15.12 ASK SYSTEM: RIGHTS

FORMAT:

        ASK SYSTEM: RIGHTS str_var 

EXAMPLE:

        10  ASK SYSTEM: RIGHTS process_rights$ 
            PRINT 'Your process rights are: '; process_rights$ 
        20  END 
 
        RNH 
        Your process rights are: FAST_ACCESS,TEST_ACCESS 

DESCRIPTION:

ASK SYSTEM: RIGHTS asks the operating system to return a list of the rights explicitly granted to the calling process.

9.15.13 ASK SYSTEM, SYMBOL: VALUE

FORMAT:

        ASK SYSTEM, SYMBOL str_expr: VALUE str_var 

EXAMPLE:

        10  ASK SYSTEM, SYMBOL 'INTOUCH': VALUE symbol$ 
            PRINT 'Value of symbol INTOUCH is: '; symbol$ 
        20  END 
 
        RNH 
        Value of symbol INTOUCH is: $intouch_image: 

DESCRIPTION:

This statement asks the operating system to translate the symbol name in str_expr and place the result into the variable specified by str_var.

9.15.14 SET SYSTEM, SYMBOL: VALUE

FORMAT:

        SET SYSTEM, SYMBOL str_expr1: VALUE str_expr2 

EXAMPLE:

        10  SET SYSTEM, SYMBOL 'mysym': VALUE 'hello' 
            ASK SYSTEM, SYMBOL 'mysym': VALUE z$ 
            PRINT 'Symbol set to '; z$ 
        20  END 
 
        RNH 
        Symbol set to HELLO 

DESCRIPTION:

This statement sets the operating system symbol name in str_expr1 to the value in str_expr2.

9.15.15 ASK SYSTEM: USER

FORMAT:

        ASK SYSTEM: USER str_var 

EXAMPLE:

        10  ASK SYSTEM : USER uname$ 
        20  PRINT 'User is: '; uname$ 
        30  END 
 
        RNH 
        User is: TESTER 

PURPOSE:

This statement returns the operating system name or ID for the user. Under VMS this is the Username.

9.16 ASK | SET WINDOW

There are various ASK WINDOW and SET WINDOW statements. These are described in the following sections. The ASK/SET WINDOW statements ask about and reset different screen features.

9.16.1 ASK WINDOW AREA

FORMAT:

        ASK WINDOW AREA row, col, row, col: DATA str_var 

EXAMPLE:

        10  CLEAR 
        20  PRINT AT 10, 4: 'Mary had a'; 
            PRINT AT 11, 4: 'little lamb'; 
        30  ASK WINDOW AREA 10, 4, 11, 15: DATA x$ 
        40  PRINT 
            PRINT x$ 
        50  END 
 
        RNH 
           Mary had a 
           little lamb 
        Mary had a 
                  little lamb 

DESCRIPTION:

This statement reads the text displayed on the screen within the area defined by the given upper-left/lower-right coordinates into a string variable, str_var. The coordinates are specified by upper-left row, upper-left column, lower-right row, lower-right column. The statement returns a <LF> delimited string. No screen attributes are stored.

9.16.2 SET WINDOW AREA

FORMAT:

        SET WINDOW AREA row, col, row, col: DATA str_expr 

EXAMPLE:

        10  CLEAR 
        20  x$ = 'Mary had a' + chr$(10) + 'little lamb' 
        30  SET WINDOW AREA 6, 5, 7, 15: DATA x$ 
        40  END 
 
        RNH 
 
            Mary had a 
            little lamb 

DESCRIPTION:

This statement sets the screen within the area defined by the given upper-left/lower-right coordinates to the specified string. This is the mirror image of ASK WINDOW AREA row, col, row, col: DATA str_var.

9.16.3 ASK WINDOW: COLUMN

FORMAT:

        ASK WINDOW: COLUMN num_var 

EXAMPLE:

        10  CLEAR 
            PRINT AT 5,10:; 
        20  ASK WINDOW: COLUMN cur_col 
        30  PRINT 'Cursor is at column'; cur_col 
        40  END 
 
        RNH 
        Cursor is at column 10 

DESCRIPTION:

This statement returns the current column of the cursor's position.

9.16.4 SET WINDOW: COLUMN

FORMAT:

        SET WINDOW: COLUMN num_expr 

EXAMPLE:

        10  CLEAR 
            PRINT AT 5,10:; 
        20  SET WINDOW: COLUMN 4 
        30  PRINT 'Hi!' 
        40  END 
 
        RNH 
           Hi! 

DESCRIPTION:

This statement positions the cursor at the num_expr column within the current row.

9.16.5 ASK | SET WINDOW: CURRENT

FORMAT:

        ASK WINDOW: CURRENT str_var 
        SET WINDOW: CURRENT str_var 

EXAMPLE:

        10  CLEAR 
            PRINT AT 1,20, UNDERLINE: 'Sample screen' 
        20  DO 
              LINE INPUT 'Name', AT 5,1, LENGTH 30: name$       
              IF  _BACK  OR  _EXIT  THEN  EXIT DO 
              IF  _HELP  THEN 
                ASK WINDOW: CURRENT old_w$ 
                CLEAR AREA BOX: 1, 5, 10, 50 
                PRINT AT 3, 10, REVERSE: 'This is some help' 
                DELAY 
                SET WINDOW: CURRENT old_w$ 
                REPEAT DO 
              END IF 
        30  END DO 
        40  END 
 
        RNH 
 
            +--------------------------------------------+ 
            |                                            | 
            |    This is some help                       | 
            |                                            | 
        Name|                                            | 
            |                                            | 
            |                                            | 
            +--------------------------------------------+ 
 
 
                        Press the RETURN key to continue 

DESCRIPTION:

ASK WINDOW: CURRENT and SET WINDOW: CURRENT allow you to save the image of the current screen and later restore it easily. This is useful for help messages and menus, where you must temporarily change the screen and then want to restore it back to what it was.

9.16.6 ASK WINDOW: DATA

FORMAT:

        ASK WINDOW: DATA str_var 

EXAMPLE:

        10  CLEAR 
        20  PRINT AT 10, 4: 'Mary had a'; 
            PRINT AT 11, 4: 'little lamb'; 
        30  ASK WINDOW: DATA x$ 
        40  PRINT 
        50  PRINT x$ 
        60  END 
 
        RNH 
           Mary had a 
           little lamb 
        . 
        . 
        . 
 
        Mary had a 
                     little lamb 

DESCRIPTION:

This statement reads the text displayed on the whole screen into a string variable. The statement returns a <LF> delimited string. No screen attributes are stored.

9.16.7 SET WINDOW: DATA

FORMAT:

        SET WINDOW: DATA str_expr 

EXAMPLE:

        10  CLEAR 
        20  x$ = 'Mary had a' + chr$(10) + 'little lamb' 
        30  SET WINDOW: DATA x$ 
        40  END 
 
        RNH 
        Mary had a 
        little lamb 

DESCRIPTION:

This statement sets the whole screen to the specified string. This is the mirror image of ASK WINDOW: DATA str_var.

9.16.8 ASK | SET WINDOW: KEYMAP

FORMAT:

        ASK WINDOW: KEYMAP str_var 
        SET WINDOW: KEYMAP str_expr 

EXAMPLE:

        10  PRINT 'Save the current keymap, reset keymap to default value.' 
            ASK WINDOW: KEYMAP old_keymap$ 
            SET WINDOW: KEYMAP '' 
 
            PRINT 'Changing DOWN key to be the EXIT key' 
            SET WINDOW KEYSTROKE 'down': VALUE '_exit' 
            LINE INPUT 'Press the DOWN key': down$ 
 
            PRINT 'Changing dollar sign key to *' 
            SET WINDOW KEYSTROKE '$': VALUE '*' 
            LINE INPUT 'Press the dollar sign key, then RETURN': e$ 
 
            PRINT 'Restore saved keymap' 
            SET WINDOW: KEYMAP old_keymap$ 
            LINE INPUT 'Press the DOWN key': down$ 
            LINE INPUT 'Press the dollar sign key, then RETURN' : e$ 
        20  END 
 
        RNH 
        Save the current keymap, reset keymap to default value. 
        Changing DOWN key to be the EXIT key 
        Press the DOWN key? EXIT 
        Changing dollar sign key to * 
        Press the dollar sign key, then RETURN? * 
        Restore saved keymap 
        Press the DOWN key? 
        Press the dollar sign key, then RETURN? $ 
 
        INTOUCH 

PURPOSE:

To allow a generalized routine to save the current keymap, change the meaning of keys, and then restore the original keymap when done.

DESCRIPTION:

ASK WINDOW: KEYMAP and SET WINDOW: KEYMAP allow you to save the image of the keymap and later restore it. This is helpful for applications where you must temporarily change the meaning of the keys using the SET WINDOW KEYSTROKE statement. You can restore the keymap to its default setting by using SET WINDOW: KEYMAP.

9.16.9 SET WINDOW KEYSTROKE: VALUE

FORMAT:

        SET WINDOW KEYSTROKE str_expr1: VALUE str_expr2 

EXAMPLE:

        10  PRINT 'Saving the current keymap.' 
            ASK WINDOW: KEYMAP old_keymap$ 
            SET WINDOW: KEYMAP '' 
 
            PRINT 'Changing DOWN key to be the EXIT key' 
            SET WINDOW KEYSTROKE 'down': VALUE '_exit' 
            LINE INPUT 'Press the DOWN key': down$ 
 
            PRINT 'Changing dollar sign key to *' 
            SET WINDOW KEYSTROKE '$': VALUE '*' 
            LINE INPUT 'Press the dollar sign key, then RETURN': e$ 
 
            PRINT 'Restoring saved keymap.' 
            SET WINDOW: KEYMAP old_keymap$ 
            LINE INPUT 'Press the DOWN key': down$ 
            LINE INPUT 'Press the dollar sign key, then RETURN' : e$ 
        20  END 
 
        RNH 
        Saving the current keymap. 
        Changing DOWN key to be the EXIT key 
        Press the DOWN key? EXIT 
        Changing dollar sign key to * 
        Press the dollar sign key, then RETURN? * 
        Restoring saved keymap. 
        Press the DOWN key? 
        Press the dollar sign key, then RETURN? $ 
 
        INTOUCH 

PURPOSE:

SET WINDOW KEYSTROKE allows you to change the meaning of a keystroke within an INTOUCH program. This allows you to completely redefine the keyboard for a given application.

DESCRIPTION:

str_expr1 describes the name of the key that you want to change. It can be a single keystroke name, or a comma separated list of names. Keystroke names can be a single letter, or the name of the letter (such as Tab, or Ctrl/Z).

str_expr2 defines the new meaning of the keystroke. A keystroke meaning consists of one or two components. The keystroke value, and the keystroke concept. For example, the Ctrl/Z key usually has a value of CHR$(26), and the concept of EXIT. The keystroke value and/or the keystroke concept can be changed. If changing both a value and a concept, separate the two with a comma. You can restore the original meaning of the key by using " ".

The following keystroke concepts are supported:

Table 9-1 Supported Keystroke Concepts
Concept name Description
_EXIT an EXIT key
_BACK a BACK key
_HELP a HELP key
_IGNORE ignore this keystroke
_INVALID beep when pressed
_TERMINATOR keystroke is a line terminator

9.16.10 ASK WINDOW: ROW

FORMAT:

        ASK WINDOW: ROW num_var 

EXAMPLE:

        10  CLEAR 
            PRINT AT 5,10:; 
        20  ASK WINDOW: ROW cur_row 
        30  PRINT 'Cursor is at row'; cur_row 
        40  END 
 
        RNH 
        Cursor is at row 5 

DESCRIPTION:

This statement returns the current row of the cursor's position.

9.16.11 SET WINDOW: ROW

FORMAT:

        SET WINDOW: ROW num_expr 

EXAMPLE:

        10  CLEAR 
        20  SET WINDOW: ROW 3 
        30  PRINT 'Hi!' 
        40  END 
 
        RNH 
 
        Hi! 

DESCRIPTION:

This statement positions the cursor at the num_expr row within the current column.

9.16.12 ASK WINDOW: TYPEAHEAD

FORMAT:

        ASK WINDOW: TYPEAHEAD str_var 

EXAMPLE:

        10  DO 
              GOSUB process 
              ASK WINDOW: TYPEAHEAD z$ 
              IF  POS(UCASE$(z$), 'STA') > 0  THEN  GOSUB show_status 
              IF  POS(z$, CHR$(26)) > 0  THEN  EXIT DO 
            LOOP 
            STOP 
 
            ROUTINE process 
              DELAY 1                     ! simulated processing 
              PRINT '.'; 
            END ROUTINE 
 
            ROUTINE show_status 
              PRINT 
              PRINT 'Showing status' 
              SET WINDOW: TYPEAHEAD '' 
            END ROUTINE 
        20  END 
 
        RNH 
        .......       (type STA) 
        showing status 
        .......       (press CTRL/Z ) 

DESCRIPTION:

ASK WINDOW: TYPEAHEAD gets data from the typeahead buffer. You can use this statement to determine, for example, whether the user has typed Ctrl/Z or other special keystrokes. Asking for typeahead data does not lose what is already in the typeahead buffer.

9.16.13 SET WINDOW: TYPEAHEAD

FORMAT:

        SET WINDOW: TYPEAHEAD str_expr 

EXAMPLE:

        10  SET WINDOW: TYPEAHEAD 'FRED' + CHR$(13) 
            INPUT 'Name': name$ 
            PRINT name$ 
        20  END 
 
        RNH 
        Name? FRED 
        FRED 

DESCRIPTION:

SET WINDOW: TYPEAHEAD puts data into the typeahead buffer as though the user had typed the data in from the terminal.

9.17 ASK | SET ZONEWIDTH

9.17.1 ASK ZONEWIDTH

FORMAT:

        ASK ZONEWIDTH num_var 

EXAMPLE:

        10  ASK ZONEWIDTH x 
            PRINT 'The current print zone width is'; x 
        20  END 
 
        RNH 
        The current print zone width is 20 

DESCRIPTION:

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

9.17.2 SET ZONEWIDTH

FORMAT:

        SET ZONEWIDTH num_expr 

EXAMPLE:

        10  PRINT 1,2,3                                           
        20  SET ZONEWIDTH 10                                          
            PRINT 1,2,3                                               
        30  SET ZONEWIDTH 20 
        40 END                                                       
        RNH                                                          
        1                   2                   3                    
        1         2         3                                        

DESCRIPTION:

SET 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.


Chapter 10
Defining Arrays

Arrays are a type of variable. They are used to store and manipulate tables of variable information. An array must be defined before it is used in a program. Array variables are described in Section 3.2.5.1, Arrays.

10.1 Dimensioning Arrays

Arrays are dimensioned with a DIM statement. The REDIM statement can be used to redimension an array--that is, to change the dimensions of an array which has been defined with the DIM statement. The OPTION BASE statement changes the default low bound. By default, the low bound is 1.

About arrays:

10.1.1 DIM

FORMAT:

        DIM [INTEGER | REAL | STRING] 
                  array_name ([int_expr TO] int_expr [, ...]) 

EXAMPLE:

        10  DIM name$(4) 
        20  FOR i = 1 TO 4 
              INPUT 'Enter a name': name$(i) 
            NEXT i 
        30  PRINT 
        40  FOR i = 1 TO 4 
              PRINT i; ' '; name$(i) 
            NEXT i 
        50  END 
 
        RNH 
        Enter a name? Jim 
        Enter a name? Jane 
        Enter a name? Bob 
        Enter a name? Betty 
 
         1  Jim 
         2  Jane 
         3  Bob 
         4  Betty 

PURPOSE:

Use DIM to dimension arrays. Arrays are used to store tables of variable information. You must dimension an array before you can use it.

DESCRIPTION:

The simplest version of a DIM statement is:

        DIM array_name(int_expr) 

array_name is the name of the array being defined. The array name must meet the rules for variable names. int_expr is the high bound for the array---the highest element allowed in a dimension. The low bound is the lowest element allowed in a dimension. The low bound defaults to 1. For example:

        DIM NAME$(4) 

This statement defines a one-dimensional array with four elements:

        NAME$(1) 
        NAME$(2) 
        NAME$(3) 
        NAME$(4) 

Multiple Dimensions

An array can have up to 32 dimensions. A high bound must be specified for each dimension.

        DIM array_name(int_expr [, int_expr, ...]) 

For example:

        10  DIM name$(4,2) 

This statement defines the following two-dimensional array:

        NAME$(1,1)   NAME$(1,2) 
        NAME$(2,1)   NAME$(2,2) 
        NAME$(3,1)   NAME$(3,2) 
        NAME$(4,1)   NAME$(4,2) 

Low Bounds

The low bound is the lowest element a dimension can have. Low bounds can be specified for each dimension of an array. If no low bound is specified, the default is 1. To specify a low bound, use the following format:

        DIM array_name (int_ expr TO int_expr) 

The number preceding TO is the low bound. For example:

        10  DIM name$(4,18 TO 20) 

This statement creates an array whose first dimension contains elements 1-4 and whose second dimension contains elements 18-20:

        NAME$(1,18)   NAME$(1,19)   NAME$(1,20)   
        NAME$(2,18)   NAME$(2,19)   NAME$(2,20)   
        NAME$(3,18)   NAME$(3,19)   NAME$(3,20)   
        NAME$(4,18)   NAME$(4,19)   NAME$(4,20)   

10.1.2 REDIM

FORMAT:

        REDIM array_name (int_expr, int_expr...) ... 
 
             OR 
 
        REDIM array_name [( [int_expr TO] int_expr, 
                      [int_expr TO] int_expr... )] ... 

EXAMPLE:

        10  DIM name$(2) 
            INPUT 'How many names': num 
            REDIM name$(num) 
        20  FOR i = 1 TO num 
              INPUT 'Enter a name': name$(i) 
            NEXT i 
        30  DO 
              PRINT 
              FOR i = 1 TO num 
                IF  name$(i) = ''  THEN 
                  PRINT i; ' '; 'empty slot' 
                ELSE 
                  PRINT i; ' '; name$(i) 
                END IF 
              NEXT i 
              PRINT 
              INPUT 'How many names': num 
              IF  _BACK  or  _EXIT  THEN  EXIT DO 
              REDIM name$(num) 
            LOOP 
        40  END 
 
        RNH 
        How many names? 3 
        Enter a name? Tim 
        Enter a name? Sammy 
        Enter a name? Fred 
 
         1  Tim 
         2  Sammy 
         3  Fred 
 
        How many names? 4 
 
         1  Tim 
         2  Sammy 
         3  Fred 
         4  empty slot 
 
        How many names? exit 

PURPOSE:

The REDIM statement is used to change the size of an array.

DESCRIPTION:

REDIM redimensions arrays. REDIM can only be used on arrays that have already been dimensioned with the DIM statement. The REDIM statement has the same rules, options and limits as the DIM statement.

You can dynamically expand arrays as needed. If you REDIM a single dimension array or the first dimension of a multi dimensioned array to a larger size, the old values are kept. If you REDIM any array to a smaller size or REDIM two or more dimensions in a multi dimensioned array to a larger size, the old values are lost.

If your application depends on REDIM initializing all array values, change your code as follows:

        Old Code:       REDIM X(100) 
 
        New Code:       REDIM X(1) 
                        REDIM X(100) 

The REDIM X(1) forces all array values to be initialized by the second REDIM statement.


Next page... | Table of Contents