INTOUCH® 4GL
A Guide to the INTOUCH Language


Previous page... Table of Contents

8.6.2 RESTORE

FORMAT:

        RESTORE 

EXAMPLE:

        10  DIM months$(3) 
            DIM more_months$(3) 
        20  DATA January, February, March 
        30  FOR i = 1 TO 3 
              READ months$(i) 
              PRINT months$(i) 
            NEXT i 
        40  RESTORE 
            PRINT 
        50  FOR i = 1 TO 3 
              READ more_months$(i) 
              PRINT more_months$(i) 
            NEXT i 
        60  END 
 
        RNH 
        January 
        February 
        March 
 
        January 
        February 
        March 

PURPOSE:

Use RESTORE when you want to use the same set of data (from a DATA statement) for a number of READ statements.

DESCRIPTION:

RESTORE restores the DATA statements in a program unit so that you can use them again. When the RESTORE statement is executed, all the DATA statements which have been read are restored. The next READ statement causes INTOUCH to go back to the first DATA statement and begin assigning the items in its list.

In the example program, the months will be read and assigned to the array MONTHS$. When the RESTORE is executed, the DATA statements will be restored. When the READ statement is executed, the months will be read into the new array MORE_MONTHS$.


Chapter 9
Set and Ask Statements

SET and ASK statements find and change characteristics within an INTOUCH program. SET sets various characteristics, and ASK returns the value of various characteristics. SET and ASK have several different options.

You can use SET and ASK on a channel of a device. Use SET and ASK if you need to do some special printing to the terminal. You can use ASK to find the terminal's current print zone width and right margin setting. If they are not correct, you can use SET to change them and then print your material to the terminal.


Note

For information on SET #chnl and ASK #chnl statements, refer to Chapter 15, File Handling.

For information on SET STRUCTURE and ASK STRUCTURE statements, refer to Chapter 14, Data Structure Statements.


9.1 SET AUTOEXIT

FORMAT:

        SET AUTOEXIT num_expr 

EXAMPLE:

        10  SET AUTOEXIT 1 
        20  DO 
              INPUT 'Who': a$ 
              IF  _EXIT  OR  _BACK  THEN  EXIT DO 
        30  LOOP 
            PRINT 'Finished' 
        40  END 
 
        RNH 
        Who? Greg 
        Who? Sammy 
        Who?              (User fails to respond within 1 minute.) 
 
        INTOUCH 

PURPOSE:

Use to slowly back a user out of a program if the terminal is left idle.

DESCRIPTION:

SET AUTOEXIT causes an idle terminal waiting at an input prompt to set _EXIT to TRUE and complete the input. num_expr is the length of time in minutes. If num_expr is assigned a value of 0, INTOUCH turns off the feature.

If the terminal is left idle for num_expr minutes at the input prompt, EXIT will be forced as the response, the _EXIT flag will be set on and the program will execute the code indicated for _EXIT, if any.

9.2 SET BACK ON | OFF

9.2.1 SET BACK ON

FORMAT:

        SET BACK ON 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _BACK 
        30  SET BACK ON 
        40  PRINT _BACK 
        50  END 
 
        RNH 
        Name? TESTER________________________ 
        0 
        1 

DESCRIPTION:

SET BACK ON sets the internal variable _BACK to TRUE (1).

9.2.2 SET BACK OFF

FORMAT:

        SET BACK OFF 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _BACK 
        30  SET BACK OFF 
        40  PRINT _BACK 
        50  END 
 
        RNH 
        Name? \_____________________________ 
        1 
        0 

DESCRIPTION:

SET BACK OFF sets the internal variable _BACK to FALSE (0).

9.3 SET ERROR ON | OFF

9.3.1 SET ERROR ON

FORMAT:

        SET ERROR ON 

EXAMPLE:

        10  DO 
              INPUT 'Enter the age': age 
              IF  age < 1  THEN 
                PRINT 'Too young:'; age 
                SET ERROR ON 
              ELSE 
                SET ERROR OFF 
              END IF 
            LOOP WHILE _ERROR 
        20  END 
 
        RNH 
        Enter the age? .5 
        Too young: .5 
        Enter the age? 38 

PURPOSE:

Use to set the _ERROR flag on.

DESCRIPTION:

_ERROR is a general purpose error flag. You can use it to indicate that an error has occurred, and to test later on whether an error has occurred.

The following statements SET the _ERROR flag:

9.3.2 SET ERROR OFF

FORMAT:

        SET ERROR OFF 

EXAMPLE:

        10  DO 
              INPUT 'Enter the age': age 
              IF  age < 1  THEN 
                PRINT 'Too young:'; age 
                SET ERROR ON 
              ELSE 
                SET ERROR OFF 
              END IF 
            LOOP WHILE _ERROR 
        30  END 
 
        RNH 
        Enter the age? .5 
        Too young: .5 
        Enter the age? 38 

PURPOSE:

Use to clear the _ERROR flag.

DESCRIPTION:

_ERROR is a general purpose error flag. You can use it to indicate that an error has occurred, and to test later on whether an error has occurred.

The following statements CLEAR the _ERROR flag:

9.4 ASK ERRORS

FORMAT:

        ASK ERRORS num_var 

EXAMPLE:

        10  DO 
              INPUT 'Enter the age': age 
              IF  age < 1  THEN 
                MESSAGE ERROR: age; ' Too Young' 
                REPEAT DO 
              ELSE 
                EXIT DO 
              END IF 
            LOOP 
        20  ASK ERRORS num_errors 
            PRINT 'Errors:'; num_errors 
        30  END 
 
        RNH 
        Enter the age? 0                  0 Too Young 
        Enter the age? .5                 .5 Too Young 
        Enter the age? 21 
        Errors: 2 

DESCRIPTION:

ASK ERRORS asks for the number of user errors. The MESSAGE ERROR: statement increments this internal counter.

9.5 SET EXIT ON | OFF

9.5.1 SET EXIT ON

FORMAT:

        SET EXIT ON 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _EXIT 
        30  SET EXIT ON 
        40  PRINT _EXIT 
        50  END 
 
        RNH 
        Name? ELAINE________________________ 
         0 
         1 

DESCRIPTION:

SET EXIT ON sets the internal variable _EXIT to TRUE (1).

9.5.2 SET EXIT OFF

FORMAT:

        SET EXIT OFF 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _EXIT 
        30  SET EXIT OFF 
        40  PRINT _EXIT 
        50  END 
 
        RNH 
        Name? EXIT__________________________ 
         1 
         0 

DESCRIPTION:

SET EXIT OFF sets the internal variable _EXIT to FALSE (0).

9.6 SET HELP ON | OFF

9.6.1 SET HELP ON

FORMAT:

        SET HELP ON 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _HELP 
        30  SET HELP ON 
        40  PRINT _HELP 
        50  END 
 
        RNH 
        Name? MIKE__________________________ 
         0 
         1 

DESCRIPTION:

SET HELP ON sets the internal variable _HELP to TRUE (1).

9.6.2 SET HELP OFF

FORMAT:

        SET HELP OFF 

EXAMPLE:

        10  LINE INPUT 'Name', LENGTH 30: reply$ 
        20  PRINT _HELP 
        30  SET HELP OFF 
        40  PRINT _HELP 
        50  END 
 
        RNH 
        Name? HELP__________________________ 
         1 
         0 

DESCRIPTION:

SET HELP OFF sets the internal variable _HELP to FALSE (0).

9.7 ASK KEYSTROKES

FORMAT:

         ASK KEYSTROKES num_var 

EXAMPLE:

        10  INPUT 'Please enter your name': name$ 
            PRINT 'Hello '; name$ 
        20  ASK KEYSTROKES strokes 
            PRINT 'Keystrokes:'; strokes 
        30  END 
 
        RNH 
        Please enter your name? Maryanne 
        Hello Maryanne 
        Keystrokes: 8 

DESCRIPTION:

ASK KEYSTROKES asks for the number of user-entered keystrokes.

9.8 ASK | SET MARGIN

9.8.1 ASK MARGIN

FORMAT:

        ASK MARGIN num_var 

DESCRIPTION:

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

9.8.2 SET MARGIN

FORMAT:

        SET MARGIN num_expr 

EXAMPLE:

        10  PRINT REPEAT$('.' ,200) 
            PRINT 
            ASK MARGIN old_marg 
        20  INPUT 'What do you want the margin set to': new_marg 
        30  SET MARGIN new_marg 
        40  PRINT REPEAT$('.' ,200) 
            SET MARGIN old_marg 
        50  END 
 
        RNH 
        .................................................. 
        .................................................. 
        .................................................. 
        .................................................. 
 
        What do you want the margin set to? 20 
        .................... 
        .................... 
        .................... 
        .................... 

DESCRIPTON:

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

9.9 ASK | SET MESSAGELINE

9.9.1 ASK MESSAGELINE

FORMAT:

        ASK MESSAGELINE num_var 

EXAMPLE:

        10  CLEAR 
            PRINT AT 1,1:; 
        20  ASK MESSAGELINE orig_mess_line 
            MESSAGE 'Current message line is '; orig_mess_line 
            DELAY 4 
        30  new_line = 12 
            SET MESSAGELINE new_line 
            MESSAGE 'New message line is '; new_line 
            DELAY 4 
        40  SET MESSAGELINE orig_mess_line 
            MESSAGE 'Message line has been reset to its original position' 
        50  END 
 
        RNH 
                           Current message line is 23 
 
 
                             New message line is 12 
 
 
              Message line has been reset to its original position 

DESCRIPTION:

The MESSAGELINE option of the ASK statement returns the line number on which the messages are displayed. This numeric value is stored in num_var.

9.9.2 SET MESSAGELINE

FORMAT:

        SET MESSAGELINE num_var 

EXAMPLE:

        10  CLEAR 
            PRINT AT 1,1:; 
        20  ASK MESSAGELINE orig_mess_line 
            MESSAGE 'Current message line is '; orig_mess_line 
            DELAY 4 
        30  new_line = 12 
            SET MESSAGELINE new_line 
            MESSAGE 'New message line is '; new_line 
            DELAY 4 
        40  SET MESSAGELINE orig_mess_line 
            MESSAGE 'Message line has been reset to its original position' 
        50  END 
 
        RNH 
                           Current message line is 23 
 
 
                             New message line is 12 
 
 
              Message line has been reset to its original position 

DESCRIPTION:

The MESSAGELINE option of the of the SET statement sets the line on which the next message is displayed. If SET MESSAGELINE 0 is used, no messages will be displayed.

9.10 ASK PAGESIZE

FORMAT:

        ASK PAGESIZE num_var 

EXAMPLE:

        10  ASK PAGESIZE no_lines 
            PRINT 'There are'; no_lines; 'lines or rows on this screen' 
        20  END 
 
        RNH 
        There are 24 lines or rows on this screen 

DESCRIPION:

ASK PAGESIZE returns the number of rows or lines of terminal screen output.

9.11 SET PORT ON | OFF

9.11.1 SET PORT ON

FORMAT:

        SET PORT ON 

EXAMPLE:

        10  PRINT 'About to print to my printer port' 
        20  SET PORT ON 
            PRINT 'This is on the printer port' 
            SET PORT OFF 
        30  PRINT 'Back to the screen again' 
        40  END 
 
        RNH 
        About to print to my printer port 
        Back to the screen again 

PURPOSE:

Allows a program to use an attached printer port on a terminal.

DESCRIPTION:

SET PORT ON | OFF turns the printer port ON or OFF. SET PORT ON turns on the attached port. SET PORT OFF turns off the attached port.

TTI_PRINTER_TYPE

To indicate the type of printer that is attached to the terminal's printer port, you can use the symbol TTI_PRINTER_TYPE.

To set up the printer type, enter the following at the system prompt (DCL level):

        $ TTI_PRINTER_TYPE == 'printer_type' 

where "printer_type" is one of the following:

Example: $ TTI_PRINTER_TYPE :=,= 'HP'

If the symbol is not defined, the type DEC is assumed.

If a terminal has a non-DEC printer port, no escape sequences are sent to the printer when you print to the printer port.

9.11.2 SET PORT OFF

FORMAT:

        SET PORT OFF 

EXAMPLE:

        10  PRINT 'About to print to my printer port' 
        20  SET PORT ON 
            PRINT 'This is on the printer port' 
            SET PORT OFF 
        30  PRINT 'Back to the screen again' 
        40  END 
 
        RNH 
        About to print to my printer port 
        Back to the screen again 

PURPOSE:

Disable printing to an attached printer port on a terminal.

DESCRIPTION:

SET PORT OFF turns off the attached port.

9.12 ASK RESPONSES

FORMAT:

        ASK RESPONSES num_var 

EXAMPLE:

        10  INPUT 'Please enter your name': name$ 
            INPUT 'What day is this': what_day$ 
            PRINT 'Hello '; name$ 
            PRINT 'Have a good '; what_day$ 
        20  ASK RESPONSES answers 
            PRINT 
            PRINT 'Responses:'; answers 
        30  END 
 
        RNH 
        Please enter your name? Ginger 
        What day is this? Wednesday 
        Hello Ginger 
        Have a good Wednesday 
 
        Responses: 2 

DESCRIPION:

ASK RESPONSES asks for the number of completed input responses.

9.13 SET SCROLL

FORMAT:

        SET SCROLL num_expr1, num_expr2 

EXAMPLE:

        10  FRAME OFF 
            PRINT AT 21, 1: 'This text will not scroll.' 
            SET SCROLL 5, 20 
            PRINT AT 20, 1:;  
            DELAY 1 
            PRINT 'This'  
            DELAY 1 
            PRINT 'text'  
            DELAY 1 
            PRINT 'will'  
            DELAY 1 
            PRINT 'scroll.'  
            DELAY 1 
        20  SET SCROLL  1,24 
        30  END 
 
        RNH 
 
        This 
        text 
        will 
        scroll 
 
        This text will not scroll. 

DESCRIPTION:

This statement sets up a scrolling region from line num_expr1 to line num_expr2.

9.14 ASK | SET SEED

FORMAT:

        ASK SEED num_var 
        SET SEED num_expr 

EXAMPLE:

        10 RANDOMIZE 
           ASK SEED seed_num 
           FOR i = 1 TO 3 
             PRINT RND(1000) 
           NEXT i 
           PRINT 'Reset the random sequence' 
           SET SEED seed_num 
           FOR i = 1 TO 3 
             PRINT RND(1000) 
           NEXT i 
        20 END 
 
        RNH 
         608 
         88 
         506 
        Reset the random sequence 
         608 
         88 
         506 

PURPOSE:

Allows you to set or reset the pseudo-random number sequence.

DESCRIPTION:

ASK SEED returns the current starting point of a pseudo-random sequence and stores the number in num_var.

SET SEED sets the starting point of a pseudo-random sequence with the number in num_expr.

9.15 ASK | SET SYSTEM

There are a number of ASK SYSTEM and SET SYSTEM statements. These are described in the following sections. The ASK/SET statements ask about and set various system operation features.

9.15.1 ASK SYSTEM: COMMENT

FORMAT:

        ASK SYSTEM: COMMENT str_var 

EXAMPLE:

        10  SET SYSTEM: COMMENT 'Invoice Entry' 
        20  ASK SYSTEM: COMMENT c$ 
        30  PRINT c$ 
        40  END 
 
        RNH 
        Invoice Entry 

DESCRIPTION:

The ASK SYSTEM: COMMENT statement asks for the INTOUCH operating system comment for the process.

9.15.2 SET SYSTEM: COMMENT

FORMAT:

        SET SYSTEM: COMMENT str_expr 

EXAMPLE:

        10  SET SYSTEM: COMMENT 'Invoice Entry' 
        20  ASK SYSTEM: COMMENT c$ 
        30  PRINT c$ 
        40  END 
 
        RNH 
        Invoice Entry 

DESCRIPTION:

The SET SYSTEM: COMMENT statement loads the INTOUCH operating system comment area with the specified string. This statement can be used in combination with the TTI_RUN:ISHOW.COM command procedure. The INTOUCH program sets the comment to some text, such as the name of the specific routine being executed. When you run TTI_RUN:ISHOW.COM, you see the specific INTOUCH program and routine within that program being run by all INTOUCH users.

9.15.3 ASK SYSTEM: DIRECTORY

FORMAT:

        ASK SYSTEM: DIRECTORY str_var 

EXAMPLE:

        10  ASK SYSTEM: DIRECTORY z$ 
            PRINT 'Current directory is: '; z$ 
        20  END 
 
        RNH 
        Current directory is: USER:[PAYROLL] 

DESCRIPTION:

ASK SYSTEM: DIRECTORY asks the operating system for the current default device and directory.

9.15.4 SET SYSTEM: DIRECTORY

FORMAT:

        SET SYSTEM: DIRECTORY str_var 

EXAMPLE:

        10  ASK SYSTEM: DIRECTORY z0$ 
            PRINT 'Current directory     '; z0$ 
            SET SYSTEM: DIRECTORY 'SYS$LOGIN' 
            ASK SYSTEM: DIRECTORY z1$ 
            PRINT 'Directory set to      '; z1$ 
            DELAY 2 
            SET SYSTEM: DIRECTORY z0$ 
            PRINT 'Directory set back to '; z0$ 
        20  END 
 
        RNH 
        Current directory      USER:[TESTER.INTOUCH] 
        Directory set to       USER:[TESTER] 
        Directory set back to  USER:[TESTER.INTOUCH]          

DESCRIPTION:

SET SYSTEM: DIRECTORY sets the default device and directory.

9.15.5 ASK SYSTEM, LOGICAL: VALUE

FORMAT:

        ASK SYSTEM, LOGICAL str_expr: VALUE str_var 

EXAMPLE:

        10  ASK SYSTEM, LOGICAL "SYS$SCRATCH": VALUE scr$ 
        20  PRINT '"SYS$SCRATCH" points to: '; scr$ 
        30  END 
 
        RNH 
        "SYS$SCRATCH" points to: USER:[TESTER] 

DESCRIPTION:

ASK SYSTEM, LOGICAL asks the operating system to translate the logical name in str_expr and place the result into the variable specified by str_var.

9.15.6 SET SYSTEM, LOGICAL: VALUE

FORMAT:

        SET SYSTEM, LOGICAL str_expr1: VALUE str_expr2 

EXAMPLE:

        10  SET SYSTEM, LOGICAL 'SYS$SCRATCH': VALUE 'USER:[TESTER]' 
            ASK SYSTEM, LOGICAL 'SYS$SCRATCH': VALUE z$ 
            PRINT 'Logical set to '; z$ 
        20  END 
 
        RNH 
        Logical set to USER:[TESTER] 

DESCRIPTION:

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

9.15.7 ASK SYSTEM: MODE

FORMAT:

        ASK SYSTEM: MODE str_var 

EXAMPLE:

        10  ASK SYSTEM: MODE process_mode$ 
        20  PRINT 'Process Mode: '; process_mode$ 
        30  END 
 
        RNH 
        Process mode: INTERACTIVE 

DESCRIPTION:

This statement returns the mode of the process which is one of the following:

9.15.8 ASK SYSTEM: PARAMETER

FORMAT:

        ASK SYSTEM: PARAMETER str_var 

EXAMPLE:

         1  PROGRAM test_param.int 
        10  ASK SYSTEM: PARAMETER pdata$ 
        20  PRINT 'Parameter was: '; pdata$ 
        30  END 
 
        INTOUCH
 
        SAVE 'test_param' 
 
        INTOUCH
                                      parameter 
                                     ------------ 
                                    |            | 
        $ INTOUCH/SOURCE test_param show parameter 
        Parameter was: SHOW PARAMETER 
 
        INTOUCH

PURPOSE:

ASK SYSTEM: PARAMETER returns any parameter from the command line given after the program name and places it in str_var.

DESCRIPTION:

ASK SYSTEM: PARAMETER lets you obtain the command line that invoked INTOUCH. The statement gives you the part of the command line after the program name.


Next page... | Table of Contents