M!INTOUCH® 4GL Y

INTOUCH® 4GL
A Guide to the INTOUCH Language

A
Previous page... 6Table of Contents
F

9.15.9 ASK SYSTEM, PASS: SUCCESS



FORMAT:



*        ASK SYSTEM, PASS: SUCCESS num_var 


EXAMPLE:



6        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 1              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 1not the last PASS command executed successfully. 



B

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. 



B

9.15.11 SET SYSTEM: PROCESS



FORMAT:



%        SET SYSTEM: PROCESS str_expr 


EXAMPLE:



)        10  ASK SYSTEM: PROCESS process$ %            curr_process$ = process$ 8            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$ 5            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:





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



A

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



H

9.15.13 ASK SYSTEM, SYMBOL: VALUE



FORMAT:



3        ASK SYSTEM, SYMBOL str_expr: VALUE str_var 


EXAMPLE:



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


DESCRIPTION:





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



H

9.15.14 SET SYSTEM, SYMBOL: VALUE



FORMAT:



6        SET SYSTEM, SYMBOL str_expr1: VALUE str_expr2 


EXAMPLE:



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


DESCRIPTION:





HThis 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:





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



9

9.16 ASK | SET WINDOW



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

<

9.16.1 ASK WINDOW AREA



FORMAT:



9        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'; 3        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:





FThis statement reads the text displayed on the screen within the area Fdefined by the given upper-left/lower-right coordinates into a string Gvariable, str_var. The coordinates are specified by upper-left Lrow, upper-left column, lower-right row, lower-right column. The statement Ireturns 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 9        20  x$ = 'Mary had a' + chr$(10) + 'little lamb' 1        30  SET WINDOW AREA 6, 5, 7, 15: DATA x$         40  END          RNH              Mary had a             little lamb 


DESCRIPTION:





DThis statement sets the screen within the area defined by the given Cupper-left/lower-right coordinates to the specified string. This Iis 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 1        30  PRINT 'Cursor is at column'; cur_col         40  END          RNH         Cursor is at column 10 


DESCRIPTION:





DThis 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:





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



F

9.16.5 ASK | SET WINDOW: CURRENT



FORMAT:



$        ASK WINDOW: CURRENT str_var $        SET WINDOW: CURRENT str_var 


EXAMPLE:



        10  CLEAR 6            PRINT AT 1,20, UNDERLINE: 'Sample screen'         20  DO @              LINE INPUT 'Name', AT 5,1, LENGTH 30: name$       2              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|                                            | ;            |                                            | ;            |                                            | ;            +--------------------------------------------+   9                        Press the RETURN key to continue 


DESCRIPTION:





9ASK WINDOW: CURRENT and SET WINDOW: CURRENTOallow you to save the image of the current screen and later restore it easily. NThis 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:





JThis 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 9        20  x$ = 'Mary had a' + chr$(10) + 'little lamb'          30  SET WINDOW: DATA x$         40  END          RNH         Mary had a         little lamb 


DESCRIPTION:





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



E

9.16.8 ASK | SET WINDOW: KEYMAP



FORMAT:



#        ASK WINDOW: KEYMAP str_var $        SET WINDOW: KEYMAP str_expr 


EXAMPLE:



L        10  PRINT 'Save the current keymap, reset keymap to default value.' +            ASK WINDOW: KEYMAP old_keymap$ "            SET WINDOW: KEYMAP ''  9            PRINT 'Changing DOWN key to be the EXIT key' 7            SET WINDOW KEYSTROKE 'down': VALUE '_exit' 3            LINE INPUT 'Press the DOWN key': down$  2            PRINT 'Changing dollar sign key to *' 0            SET WINDOW KEYSTROKE '$': VALUE '*' D            LINE INPUT 'Press the dollar sign key, then RETURN': e$  )            PRINT 'Restore saved keymap' +            SET WINDOW: KEYMAP old_keymap$ 3            LINE INPUT 'Press the DOWN key': down$ E            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 * 2        Press the dollar sign key, then RETURN? *         Restore saved keymap         Press the DOWN key? 2        Press the dollar sign key, then RETURN? $          INTOUCH 


PURPOSE:





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



DESCRIPTION:





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



H

9.16.9 SET WINDOW KEYSTROKE: VALUE



FORMAT:



8        SET WINDOW KEYSTROKE str_expr1: VALUE str_expr2 


EXAMPLE:



/        10  PRINT 'Saving the current keymap.' +            ASK WINDOW: KEYMAP old_keymap$ "            SET WINDOW: KEYMAP ''  9            PRINT 'Changing DOWN key to be the EXIT key' 7            SET WINDOW KEYSTROKE 'down': VALUE '_exit' 3            LINE INPUT 'Press the DOWN key': down$  2            PRINT 'Changing dollar sign key to *' 0            SET WINDOW KEYSTROKE '$': VALUE '*' D            LINE INPUT 'Press the dollar sign key, then RETURN': e$  ,            PRINT 'Restoring saved keymap.' +            SET WINDOW: KEYMAP old_keymap$ 3            LINE INPUT 'Press the DOWN key': down$ E            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 * 2        Press the dollar sign key, then RETURN? *          Restoring saved keymap.         Press the DOWN key? 2        Press the dollar sign key, then RETURN? $          INTOUCH 


PURPOSE:





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



DESCRIPTION:





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

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

0The following keystroke concepts are supported: 

B  ' &                "        +  
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:





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



D

9.16.12 ASK WINDOW: TYPEAHEAD



FORMAT:



&        ASK WINDOW: TYPEAHEAD str_var 


EXAMPLE:



        10  DO               GOSUB process '              ASK WINDOW: TYPEAHEAD z$ I              IF  POS(UCASE$(z$), 'STA') > 0  THEN  GOSUB show_status :              IF  POS(z$, CHR$(26)) > 0  THEN  EXIT DO             LOOP             STOP              ROUTINE process A              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 1        .......       (press CTRL/Z ) 


DESCRIPTION:





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



D

9.16.13 SET WINDOW: TYPEAHEAD



FORMAT:



'        SET WINDOW: TYPEAHEAD str_expr 


EXAMPLE:



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


DESCRIPTION:





ASET 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 7            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 Ispecified and assigns the value to the numeric variable, num_var. 



:

9.17.2 SET ZONEWIDTH



FORMAT:



        SET ZONEWIDTH num_expr 


EXAMPLE:



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


DESCRIPTION:





=SET ZONEWIDTH sets the print zone width of the device Cspecified to the number designated. num_expr indicates the 'width to set the device's print zones. 




?

Chapter 10
Defining Arrays



BArrays are a type of variable. They are used to store and Lmanipulate 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



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

About arrays: 





0

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 Htables 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) 


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

        DIM NAME$(4) 


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

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


Multiple Dimensions

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

3        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

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

/        DIM array_name (int_ expr TO int_expr) 


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

"        10  DIM name$(4,18 TO 20) 


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

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

2

10.1.2 REDIM



FORMAT:



5        REDIM array_name (int_expr, int_expr...) ...               OR  4        REDIM array_name [( [int_expr TO] int_expr, 7                      [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 2              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:





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





DESCRIPTION:





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

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

KIf 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) 


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





4


Next page... | 6Table of Contents