M!INTOUCH® 4GL Y

INTOUCH® 4GL
A Guide to the INTOUCH Language

A
Previous page... 6Table of Contents
2

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 9(from a DATA statement) for a number of READ statements. 



DESCRIPTION:





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

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




D

Chapter 9
Set and Ask Statements



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

JYou can use SET and ASK on a channel of a device. Use SET and ASK if you Kneed to do some special printing to the terminal. You can use ASK to find Kthe terminal's current print zone width and right margin setting. If they Mare 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. 

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




3

9.1 SET AUTOEXIT



FORMAT:



        SET AUTOEXIT num_expr 


EXAMPLE:



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


PURPOSE:





NUse 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 Dprompt to set _EXIT to TRUE and complete the input. num_exprDis the length of time in minutes. If num_expr is assigned a +value of 0, INTOUCH turns off the feature. 

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



8

9.2 SET BACK ON | OFF

6

9.2.1 SET BACK ON



FORMAT:



        SET BACK ON 


EXAMPLE:



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





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



7

9.2.2 SET BACK OFF



FORMAT:



        SET BACK OFF 


EXAMPLE:



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


DESCRIPTION:





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



9

9.3 SET ERROR ON | OFF

7

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:





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

.The following statements SET the _ERROR flag: 




8

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:





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

0The following statements CLEAR the _ERROR flag: 




1

9.4 ASK ERRORS



FORMAT:



        ASK ERRORS num_var 


EXAMPLE:



        10  DO )              INPUT 'Enter the age': age #              IF  age < 1  THEN 1                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 6        Enter the age? 0                  0 Too Young 7        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. 



8

9.5 SET EXIT ON | OFF

6

9.5.1 SET EXIT ON



FORMAT:



        SET EXIT ON 


EXAMPLE:



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





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



7

9.5.2 SET EXIT OFF



FORMAT:



        SET EXIT OFF 


EXAMPLE:



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





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



8

9.6 SET HELP ON | OFF

6

9.6.1 SET HELP ON



FORMAT:



        SET HELP ON 


EXAMPLE:



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





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



7

9.6.2 SET HELP OFF



FORMAT:



        SET HELP OFF 


EXAMPLE:



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





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



5

9.7 ASK KEYSTROKES



FORMAT:



          ASK KEYSTROKES num_var 


EXAMPLE:



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



7

9.8 ASK | SET MARGIN

5

9.8.1 ASK MARGIN



FORMAT:



        ASK MARGIN num_var 


DESCRIPTION:





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



5

9.8.2 SET MARGIN



FORMAT:



        SET MARGIN num_expr 


EXAMPLE:



$        10  PRINT REPEAT$('.' ,200)             PRINT              ASK MARGIN old_marg A        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 Fto 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 5            MESSAGE 'New message line is '; new_line             DELAY 4 +        40  SET MESSAGELINE orig_mess_line K            MESSAGE 'Message line has been reset to its original position'         50  END          RNH 6                           Current message line is 23   4                             New message line is 12   C              Message line has been reset to its original position 


DESCRIPTION:





?The MESSAGELINE option of the ASK statement returns the Hline 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 5            MESSAGE 'New message line is '; new_line             DELAY 4 +        40  SET MESSAGELINE orig_mess_line K            MESSAGE 'Message line has been reset to its original position'         50  END          RNH 6                           Current message line is 23   4                             New message line is 12   C              Message line has been reset to its original position 


DESCRIPTION:





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



5

9.10 ASK PAGESIZE



FORMAT:



        ASK PAGESIZE num_var 


EXAMPLE:



"        10  ASK PAGESIZE no_lines H            PRINT 'There are'; no_lines; 'lines or rows on this screen'         20  END          RNH 2        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

8

9.11.1 SET PORT ON



FORMAT:



        SET PORT ON 


EXAMPLE:



6        10  PRINT 'About to print to my printer port'         20  SET PORT ON 0            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. MSET PORT ON turns on the attached port. SET PORT OFF turns off the attached port. 

TTI_PRINTER_TYPE

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

ETo 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' 

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

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



9

9.11.2 SET PORT OFF



FORMAT:



        SET PORT OFF 


EXAMPLE:



6        10  PRINT 'About to print to my printer port'         20  SET PORT ON 0            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:





1SET PORT OFF turns off the attached port. 



6

9.12 ASK RESPONSES



FORMAT:



        ASK RESPONSES num_var 


EXAMPLE:



2        10  INPUT 'Please enter your name': name$ 0            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. 



3

9.13 SET SCROLL



FORMAT:



(        SET SCROLL num_expr1, num_expr2 


EXAMPLE:



        10  FRAME OFF 9            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:





DThis statement sets up a scrolling region from line num_expr1to line num_expr2. 



7

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:





8ASK 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

9.15 ASK | SET SYSTEM



GThere are a number of ASK SYSTEM and SET SYSTEM statements. These are Gdescribed 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:



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



0        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 Ioperating system comment area with the specified string. This statement Ican be used in combination with the TTI_RUN:ISHOW.COM command procedure. GThe INTOUCH program sets the comment to some text, such as the name of Jthe specific routine being executed. When you run TTI_RUN:ISHOW.COM, you Ksee the specific INTOUCH program and routine within that program being run by all INTOUCH users. 



B

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. 



B

9.15.4 SET SYSTEM: DIRECTORY



FORMAT:



&        SET SYSTEM: DIRECTORY str_var 


EXAMPLE:



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


DESCRIPTION:





DSET SYSTEM: DIRECTORY sets the default device and directory. 



G

9.15.5 ASK SYSTEM, LOGICAL: VALUE



FORMAT:



4        ASK SYSTEM, LOGICAL str_expr: VALUE str_var 


EXAMPLE:



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


DESCRIPTION:





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



G

9.15.6 SET SYSTEM, LOGICAL: VALUE



FORMAT:



7        SET SYSTEM, LOGICAL str_expr1: VALUE str_expr2 


EXAMPLE:



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


DESCRIPTION:





IThis 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$ 2        20  PRINT 'Process Mode: '; process_mode$         30  END          RNH "        Process mode: INTERACTIVE 


DESCRIPTION:





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


B

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'          INTOUCH0                                      parameter 2                                     ------------ 3                                    |            | 3        $ 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:





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





4


Next page... | 6Table of Contents