%ì VAX-11 Librarian V04-00`«ÑÓ3@•—ÒÓ3¬ ­56 ÆFeaturesHELP$øLanguageTables­ÀõÁÑÓ31 HELP@INTOUCH is The Next Generation Language for VAX computers. This*help file contains information on INTOUCH.2o For detailed and basic level help, use Language /o To exit help, press the RETURN key repeatedly3o To redisplay a list of available topics, type a ?9o For information about the advantages of INTOUCH and the9 INTOUCH manuals, type Features at the topic prompt below2 HELPAThe user can get help by typing HELP. Typing HELP at the INTOUCHDprom pt causes this help facility to appear. INTOUCH will display a Flist of topics and the prompt "Topic?". The user enters a topic from Gthe list. INTOUCH provides information about that topic. If there is Emore detailed information, INTOUCH will display a list of sub-topics &available and the prompt "Subtopic?". HThe user may request specific information by entering the desired topic !and subtopic at the HELP command:% HELP topic subtopic subtopic...EPressing the RETURN key at the "Topic?" prompt will cause INTOUCH to Cexit the HELP facility. Typing a question mark at any HELP prompt Ewill cause a list of the available topics/sub-topics to be displayed.ww­`±ÏÑÓ3 1 FeaturesEINTOUCH lets you develop complex applications rapidly and accurately.CThe power of INTOUCH comes from its integrated database access and +development environment. INTOUCH provides: o Fast development time.$ o Modern control structures.0 o Integrated access to RMS, RDB and DBMS8 o Powerful code change and continue capabilities% o High level debug facilities& o Program execution statistics 2 EnvironmentGThe environment is an area you work within when you use INTOUCH. Each Etime you enter INTOUCH, you enter a new environment. You can change Easpects of this environment such as variables, system functions, and Ethe program in current memory. You can also store environments (for 5instance, if an error occurs) and recover them later. 3 ChangingDYour environment can be changed by either using an INTOUCH command, Gor running an INTOUCH program. You can change the value of a variable D(even after program execution is interrupted) by assigning it a new Evalue at the INTOUCH prompt. Likewise, you can change program lines 'by retyping them at the INTOUCH prompt.2 Development_Cycle?The process of developing a program with INTOUCH is called the <development cycle. There are only four steps in t his cycle:?STEP 1: Write and compile the program code. INTOUCH compiles@ your code as you write it. If your code has an error,A INTOUCH informs you IMMEDIATELY so you can correct it. CSTEP 2: Execute the program. INTOUCH links the program when you ( run it. Linking is immediate.CSTEP 3: Debug the program with INTOUCH's special facilities. In A typical applications, INTOUCH can cut debug time by as  much as 90%.%STEP 4: Re vise the code, if needed.3 INTOUCH_CompilesCINTOUCH compiles your code as you write it. INTOUCH compiles each Bline of code when the RETURN key is pressed. If there is an errorCin the line, INTOUCH displays a message telling you the error. YouBcan retype the line immediately to correct the error. If the lineCis part of a multiple statement line, just retype the physical lineAcontaining the error. INTOUCH will replace the old line with thecorrected one. For example,-  10 INPUT 'Name': NAME$5 PRNT 'Your name is '; NAME$ ...1, Unrecognized statement2just retype the ----- PRINT 'Your name is '; NAME$statement correctly3 DebugBINTOUCH's debug system includes special facilities for optimizing Gprograms and finding elusive bugs. It includes two ways of monitoring Cprogram execution. INTOUCH's trace feature displays the number of ;each program line as it is executed. INTOUC H's statistics Efeature records the time it takes each line to execute and the numberCof times each was executed. This lets you pinpoint statements and Eroutines which take up costly time. Both these features can be used ?to monitor a program's execution over hours, days, weeks, etc..0This lets you find bugs which are intermittent. BINTOUCH also allows code change and continue. For instance, with =ctrl/C or debug's BREAK statement, you can interrupt program Cexecution. Once program  execution is stopped, you can change your Gcode, display and change the values of variables, etc.. Then continue ?execution with the GO or STEP commands. (See the DEBUG topic.) 2 ManualsBThree manuals describe the INTOUCH system. All three manuals are Adesigned to provide the information you need in a manner that is *concise and easy to use. The manuals are:' o A Guide to the Language- o The Technical Specifications ) o The Quick Reference Guide3 Language_GuideB"A Guide to the Language" describes the INTOUCH system and how to Ddevelop programs with it. The Guide explains the development cycle Dand INTOUCH's features for speeding up this cycle. It describes in Gdetail the INTOUCH environment, program elements, the INTOUCH language ?(commands, statements, functions, etc.) and debugging system. @The Guide is written for both experienced programmers and those @self-learners who have had exposure to computers and programming  languages. 4 Overview_of_the_GuideDChapter 1 contains general information about the INTOUCH environment@and basic features. Chapter 2 describes the INTOUCH commands. ?Chapter 3 describes the INTOUCH language. Chapter 4 describes >INTOUCH's data structure statements. Chapter 5 describes the CINTOUCH debugging system. Chapter 6 describes the SETUP routine. BSETUP is part of INTOUCH's transparent data interface. Chapter 7 Edescribes the elements of an INTOUCH program--including the types of 0data INTOUCH accepts, program lines and labels. FAppendix A contains a list of INTOUCH's built-in functions. Appendix EB contains a list of INTOUCH's reserved words. Appendix C describes Athe difference between errors and exceptions and lists INTOUCH's Aerror and exception messages. Appendix D contains a list of the DINTOUCH statements, functions, etc. and describes which are part of ?the ANSI standard and which are enhancements to the standard. DAppendix E contains a table of the ASCII character set. Appendix F Ccontains a list of the conventions used to describe statements and commands in this manual.3 Technical_SpecificationsCThe "Technical Specifications" contains a brief description of the FINTOUCH system, statements, commands, etc. and some background on how the system operates. 3 Quick_Reference_Guide<The "Quick Reference Guide" provides a format, short exampleCand brief description of each of the INTOUCH statements, commands, Hand functions. It is designed for INTOUCH programmers who want a handy desk reference tool.2 Frame>Each time you enter the environment, you will see the INTOUCH >prompt and frame. The frame consists of the highlighted bars Dacross the top and bottom of the screen. The INTOUCH prompt is the 5word "INTOUCH". It will always appear highlighted. <In the bottom INTOUCH frame, a summary message appears. TheDcommands described in the lower frame may be used at any time while Byou are in INTOU CH. These universal commands are described below.2 HELP_in-INTOUCHAThe user can get help by typing HELP. Typing HELP at the INTOUCHCprompt causes this help facility to appear. Typing HELP by itself Iwill cause INTOUCH to display a list of topics and the prompt "Topic?". EThe user enters a topic from the list. INTOUCH provides information Gabout that topic. If there is more detailed information, INTOUCH will Cdisplay a list of sub-topics available and the prompt "Subtopic?". HTh e user may request specific information by entering the desired topic !and subtopic at the HELP command:% HELP topic subtopic subtopic...EPressing the RETURN key at the "Topic?" prompt will cause INTOUCH to Cexit the HELP facility. Typing a question mark at any HELP prompt Ewill cause a list of the available topics/sub-topics to be displayed.2 Immediate_modeBOnce you enter the INTOUCH environment, all of INTOUCH's features Fare available to you. Statements can be typed and executed at commandIlevel. For example, if you type PRINT "HELLO" and press the RETURN key, INTOUCH will print HELLO. PRINT "HELLO" HELLO INTOUCH2 CTRL_C@CTRL_C interrupts program execution. To use CTRL_C, you do the following:7 o While pressing down the key, press the letter C.9 o Then, if you are at an INPUT prompt,, press the key.@INTOUCH interrupts program execution and tells you which line it stopped at. 2 Calling_INTOUCHEOnce INTOUCH has been installed, you can invoke it by typing the word="INTOUCH" at the VAX prompt ($). You will enter the INTOUCH Cenvironment. Whenever you enter the INTOUCH environment, you will see the INTOUCH frame.ww­ ĞLÒÓ31 Tables, Decimal ASCII character( value equivalent 6 0 NUL (the FILL character) 1 SOH" 2  STX * 3 ETX (ctrl/C) 4 EOT! 5 ENQ ! 6 ACK ( 7 BEL (bell)- 8 BS (backspace)2 9 HT (horizontal tab). 10 LF (linefeed) 2 11 VT (vertical tab) . 12 FF (form feed) 3 13 CR (carriage return) 14 SO + 15 SI (ctrl/O) 16 DLE. 17 DCL (ctrl/Q XON) 18 DC2/ 19 DC3 (ctrl/S XOFF)" 20 DC4 + 21 NAK (ctrl/U) # 22 SYN 23 ETB 24 CAN 25 EM+ 26 SUB (ctrl/Z) * 27 ESC (escape) 28 FS 29 QS 30 RS: 31 US ( 32 SP (space) 33 !  34 " 35 # 36 $ 37 % 38 &- 39 ' (apostrophe)  40 ( 41 ) 42 * 43 + ) 44 , (comma)  45 - 46 . 47 /  48 0 49 1 50 2 51 3 52 4 53 5 54 6  55 7 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F  71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O  80 P  81 Q 82 R 83 S 84 T 85 U 86 V! 87 W 88 X 89 Y 90 Z 91 [- 92 \ (backslash)  93 ]. 94 ^ (or up arrow)0 95 _ (or back arrow)/ 96 ` (grave accent) 97 a 98 b 99 c 100" d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q  114 r 115 s # 116 t 117 u 118 v  119 w 120 x 121 y 122 z 123 {1 124 | (vertical line) " 125 } ) 126 ~ (tilde) + 127 del (rubout) 2 File_specs;In INTOUCH, a legal file name has the format: filename.extYour$ file name:2 o may be up to, but not longer than 64 characters o must start with a letter& o may consist of letters and numbers  Your extension:# o must be preceded by a period (.)1 o may be up to, but not longer than 3 characters o must consist of letters3 More_on_file_specsAWhen you give a file name in an INTOUCH statement or command, it Dmust be given as a string expression. If the file name is given as 9a constant, it must be enclosed in quotes. For example, % % OLD "ACCOUNT" C You can specify any legal VAX/VMS file specification with INTOUCH.BSimply include the legal file specification according to the rulesAdescribed in the Command Language and DCL User's Guide--Volume 2,7Section 3--of the VAX/VMS version 4 documentation setj.ANOTE: You do not need to give an extension with your file name C in the INTOUCH commands. If you do not give an extension, 3 INTOUCH uses the default extension ".INT". ww­ &@•—ÒÓ3 1 Language<The help system is designed for beginning to advanced users.AThe help system is divided up in a manner similar to the INTOUCH =Language Guide. It is divided up into statements, commands, >functions, etc. Help operates in the same manner as VMS help. 2 ProgramsFA program is a series of instructions which describe how to manipulateBdata to produce a desired result. When you create a program, youFmust use instructions which INTOUCH understands. The INTOUCH language 'Bprovides these instructions. It is made up of statements. You putDthese statements together in a meaningful order and INTOUCH executes1them. Here is an example of an INTOUCH program: - 10 INPUT 'Your name, please': NAME$# PRINT 'Hello, '; NAME$ 20 ENDBThe INPUT statement tells INTOUCH to ask for a name. PRINT tells EINTOUCH to print "Hello, " followed by this name. END tells INTOUCH ?it has reached the end of the program. For more information on ((program elements, see the topics below. 3 LinesAPrograms contain program lines. Each program line consists of a Aline number and one or more statements. You can attach multiple statements to a line. 8multiple 10 INPUT 'Your name, please': NAME$.statement line ------- PRINT 'Hello, '; NAME$ 20 END?Programs are ordered sequentially by line number. When INTOUCHDexecutes a program, it starts at the lowest line number and executesClines sequ)entially. Line numbers can be anywhere in the range of 1*to 99,999. Line numbers must be integers.3 LabelsBYou can use labels to identify lines or sections of code. A labelCis an alphanumeric name which precedes a statement. The label mustFbe separated from the statement following it by a colon. For example:9 10 INPUT 'Your name, please': NAME$" Label ------ HELLO: DO7 PRINT 'Hello, ';NAME$< * INPUT 'Again (Y/N)': ANSW$4 LOOP WHILE ANSW$='Y' 30 ENDAThe label applies to all the code following it up until the next @label. Labels can also be used WITHIN multiple statement lines. 2 INTOUCH EINTOUCH lets you develop complex applications rapidly and accurately.CThe power of INTOUCH comes from its integrated database access and +development environment. INTOUCH provides: o Fast development time +# o Modern control structures0 o Integrated access to RMS, RDB and DBMS8 o Powerful code change and continue capabilities % o High level debug facilities& o Program execution statistics3 EXITGTo exit the environment, type EXIT at the INTOUCH prompt. INTOUCH will$return you to the VAX system prompt. INTOUCH EXIT ' Exiting INTOUCH $3 DCL_passthru<You ca,n use VAX system programs with INTOUCH's DCL pass-thruCcapalities. To use a VAX system program from within INTOUCH, simplyCtype a $ followed by the name of the facility you want to use. For example,  INTOUCH $MAIL >SendF The DCL pass-through "$" also supports "$$". The "$$" lets the user Benter multiple DCL commands until the or key is pressed.3 FrameBThe INTOUCH frame consists of the highlighted bars across the top Aand bott -om of the screen. The top bar has the INTOUCH title and Eversion number. The "Program:" prompt displays the current workspace=name. The "Status:" message shows what operation INTOUCH is Acurrently performing. Flags, such as the DEBUG flag, may appear in the top bar.?The bottom frame shows the EXIT, BACK and HELP commands. HELP =gives you this help system. EXIT exits you from the INTOUCH Benvironment. Pressing the backspace key puts you at the previous Aprompt when you are with.in one of the INTOUCH system's structure Bprograms. Error messages, debug traces, etc. also appear in this @bottom frame. You can cause your own messages to appear in the #frame with the MESSAGE statement. 3 BACK@The BACK command can only be used within INTOUCH data structure Bprograms, or user programs designed to incorporate this feature. DTyping a backslash and pressing return within these programs causes Bthe user to return to the previous prompt. Users can then change /their response to the prompt.3 Development_Cycle?The process of developing a program with INTOUCH is called the <development cycle. There are only four steps in this cycle:?STEP 1: Write and compile the program code. INTOUCH compiles@ your code as you write it. If your code has an error,A INTOUCH informs you IMMEDIATELY so you can correct it. CSTEP 2: Execute the program. INTOUCH links the program when you ( run it. Linking is imme0diate.CSTEP 3: Debug the program with INTOUCH's special facilities. In A typical applications, INTOUCH can cut debug time by as  much as 90%.%STEP 4: Revise the code, if needed. 4 CompilesCINTOUCH compiles your code as you write it. INTOUCH compiles each Bline of code when the RETURN key is pressed. If there is an errorCin the line, INTOUCH displays a message telling you the error. YouBcan retype the line immediately to correct the error. If the lineC1is part of a multiple statement line, just retype the physical lineAcontaining the error. INTOUCH will replace the old line with thecorrected one. For example:- 10 INPUT 'Name': NAME$5 PRNT 'Your name is '; NAME$ ...1, Unrecognized statement2just retype the ----- PRINT 'Your name is '; NAME$statement correctly4 DebugBINTOUCH's debug system includes special facilities for optimizing 2Gprograms and finding elusive bugs. It includes two ways of monitoring Cprogram execution. INTOUCH's trace feature displays the number of 8each program line as it executes. INTOUCH's statistics Efeature records the time it takes each line to execute and the numberCof times each was executed. This lets you pinpoint statements and Eroutines which take up costly time. Both these features can be used @to monitor a program's execution over hours, days, weeks, etc., .letting you find bugs 3which are intermittent. EINTOUCH also allows code change and continue. For instance, you can Einterrupt program execution with ctrl/C or debug's BREAK statement. EOnce program execution is stopped, you can change your code, display Gand change the values of variables, etc. Then continue execution with the GO or STEP commands. 2 Debug?INTOUCH detects and announces run-time and compile-time errors.ASometimes errors occur which don't prevent execution, but cause aDprogram to e 4xecute incorrectly. INTOUCH provides a high level DEBUG/system for detecting these more subtle errors. @DEBUG ON enables INTOUCH's DEBUG system. DEBUG OFF disables theEit. When DEBUG is enabled, a flag will appear at the status message.FWhen DEBUG is disabled, the flag will disappear. Some DEBUG features Eautomatically switch DEBUG on or off when they are executed. Others require that DEBUG be enabled. CNOTE: Using the debugging facilities impacts the INTOUCH system's > p5erformance. The system has been designed for optimal C performance in a normal production environment. Therefore, - debug will slow INTOUCH response time. 3 DEBUG_ONFORMAT: DEBUG ONEXAMPLE: DEBUG ON 1050 DEBUG ON?DEBUG ON enables INTOUCH's DEBUG system. When DEBUG is enabled?all of INTOUCH's DEBUG features are available. DEBUG remains Denabled until a DEBUG OFF command or statement is executed or until /a DEBUG feature is executed which disables6 it. CDEBUG ON may be issued as a command or as a statement in a program.BIf DEBUG ON is used as a statement, INTOUCH enables DEBUG when it #encounters the DEBUG ON statement. 3 DEBUG_OFFFORMAT: DEBUG OFFEXAMPLE: DEBUG OFF 1050 DEBUG OFFDDEBUG OFF disables INTOUCH's DEBUG system. DEBUG OFF may be issued Cas a command or as a statement in a program. If DEBUG OFF is used Das a statement, INTOUCH disables DEBUG when it encounters the DEBUG OFF stat7ement. CDEBUG will remain disabled until a DEBUG ON command or statement isAexecuted, or until a DEBUG feature is executed which enables it. 3 Monitoring_execution<DEBUG's TRACE and STATISTICS features monitor your program'sEexecution. These features only take effect during program execution.ATRACE lists the number of each program line at the bottom of yourCscreen as it is executed. STATISTICS records the time each programCline takes to execute and the number of times the 8line is executed.DThe word "STATISTICS" may be abbreviated to "STATS" (STATS ON, STATSFOFF, LIST STATS). Both TRACE and STATISTICS operate on program lines.CBoth features use the following notation to designate line numbers:0 10 INPUT A$ 102 INPUT B$ 10.15 Label --- DISPLAY: PRINT A$ DISPLAY7 PRINT B$ DISPLAY.10 20 END 20 4 TRAC9E_ONFORMAT: TRACE ONEXAMPLE: TRACE ON 1050 TRACE ONFEnables INTOUCH's trace feature. The trace feature lists each programDline as it is executed in the bottom INTOUCH frame. TRACE ON may beFexecuted as a command or as a statement. If TRACE ON is executed as aEcommand, DEBUG is automatically switched on. If TRACE ON is executed@as a statement, and DEBUG is off, INTOUCH ignores the TRACE ON. ?TRACE remains in effect until a TRACE OFF command or statement Ais exe:cuted. When program execution stops, the trace stops. If Aprogram execution continues and the TRACE ON command is still in effect, the trace continues. 4 TRACE_OFFFORMAT: TRACE OFFEXAMPLE: TRACE OFF 1050 TRACE OFF@Disables the trace feature. INTOUCH stops listing program line >numbers when TRACE OFF is executed. If TRACE OFF is executed ?as a statement and DEBUG is off, INTOUCH ignores the statement. 4 STATS_ONFORMAT: STATS ;ONEXAMPLE: STATS ON 1020 STATS ON@Enables INTOUCH's statistics feature. INTOUCH begins recording Bstatistics when program execution begins. The statistics feature Gremains enabled until the STATS OFF command or statement is executed. ESTATS ON may be executed as a command or a statement. If STATS ON isDexecuted as a command, DEBUG is automatically switched on. If STATSDON is executed as a statement, and DEBUG is off, INTOUCH ignores the@statement. When STATS ON is e<xecuted, any statistics previously;recorded are lost. LIST STATS is used to display recorded statistics. 4 STATS_OFFFORMAT: STATS OFFEXAMPLE: STATS OFF 1020 STATS OFF:Turns off INTOUCH's statistics feature. STATS OFF may be 7executed as a command or a statement. If STATS OFF is ;executed as a statement, and DEBUG is off, INTOUCH ignores 9the statement. STATS OFF clears any recorded statistics. 4 LIST_STATSFORMAT: LIST STATSEXAMPL =E: LIST STATS FLists the statistics recorded by the statistics feature. The left mostBcolumn lists the number of times each statement was executed. TheCnext column gives the time each statement took to execute. Time isEgiven in seconds and fractions of a second. The last column lists theAprogram itself. STATS must be on for LIST STATS to be executed. LIST STATS NONAME 6-DEC-1985 18:51" 1 0.00 10 I=1 , 100 0.25 DO WHILE I<100, > 99 1.07 ROOT = SQR(I), 99 5.77 PRINT I, ROOT$ 99 0.28 I=I+1" 99 0.04 LOOP! 1 0.02 20 END3 BREAKFORMAT: BREAKEXAMPLE: 1050 BREAK?Interrupts program execution and prints a BREAK message. BREAKCcan be used anywhere in a program. It will not take effect unless =DEBUG is turned on. If DEBUG is off, INTOUCH ignores BREAKs.AProgram execution can be continued with the GO or STEP com?mands.  10 PRINT "1", PRINT "2", BREAK  PRINT "3", 20 END DEBUG ON  INTOUCH  RNH 5 1 2 BREAK at 10.2  INTOUCH3 STEPFORMAT: STEP [number]EXAMPLE: STEP STEP 109Used to step through your program--to execute a specifiedEnumber of program statements. DEBUG must be on for the STEP command Cto take effect. If DEBUG is not on and the STEP command is give @n, EINTOUCH ignores it. STEP must be given as a command. When the STEP Acommand has been executed, INTOUCH issues a BREAK and prints the Abreak message. Issuing the STEP command without a number causes DINTOUCH to execute one program line. Issuing the STEP command with ?a number causes INTOUCH to execute the number of program lines Aspecified. INTOUCH begins executing program lines from the last line executed. 4 ExampleEXAMPLE: 10 PRINT "1", PRINT "2",A BREAK  PRINT "3", 20 END  RNH> 1 2 BREAK at 10.2 INTOUCH  STEP 5 3 4 INTOUCH 3 GO FORMAT: GO EXAMPLE: GO?Resumes program execution after it has been interrupted. Once Aexecution has stopped, you can enter immediate mode and debugger ?commands, change code, etc. GO lets you resume executBion even Eafter code has been changed. If a STOP or BREAK statement was used, Eexecution will resume at the first statement after the STOP or BREAK. 4 Example EXAMPLE: 5 DEBUG ON  10 FOR I=1 TO 6 # 20 IF I=4 THEN BREAK  30 NEXT I 40 END  RNH  Break at 20  INTOUCH7 PRINT SQR(I) ! type an immediate mode command 2  INTOUCH 1 25 PRINT I; ! add a new Cline of code GO  4 5 6 INTOUCH 3 SYSTEXT$FORMAT: PRINT SYSTEXT$EXAMPLE: PRINT SYSTEXT$BPRINT SYSTEXT$ ia a debug command which can be used at the INTOUCHEprompt. It can be used when you get an INTOUCH structure error whileDrunning your program. PRINT SYSTEXT$ should be used when you get anEINTOUCH structure error, and the error message is not specific enoughFto determine the problem. PRINT SYSTEXT$ prints the error message for@the unde Drlying file management system. You can then consult theEmanuals for the underlying system to determine exactly what the errorEis. Note that PRINT SYSTEXT$ can only be used at the INTOUCH prompt. 2 DataCPrograms manipulate data. The data can be numeric or textual, but Ait must be presented in a way that INTOUCH understands. INTOUCH ?accepts three basic types of data: integer numeric data, real (numeric data, and string (textual) data.EAn integer is a number without a fractional po Ertion. For example, 6 Dor 1032. A real number is a number with a fractional portion. For >example, 6.0 or 1032.546. String data is text. The text can @consist of any characters--including numbers. For example, the Dfollowing are string data: "Hello, John", "$6.00 is the sum.", "35".AThe following topics describe each type of data and the ways they.may be presented to, and used within, INTOUCH.3 Real_numbersCReal constants can be positive or negative. Real numeric data doesBnot Fhave to be designated as such. INTOUCH treats numbers as real4unless they are designated as strings or integers. B o A real number without a decimal point is assumed to have a  fractional part of 0.G o Designate negative real numbers with a leading minus sign (-23).C o Designate positive real numbers with a leading plus sign or  no sign.? o Real numbers may be anywhere in the range of +/-1.7E38. < o Real numbers have a magnitude of .29E-38 to 1G.7E38. D o Real number have a size of 64 bits, a precision of 15 decimal9 digits and correspond to the VAX double real word.3 Integer_numbers>Integer numbers can be positive or negative. Integers must beFdesignated as such with a trailing percent sign (89%). If your numberFis not followed by a percent sign, INTOUCH treats it as a real number.; o A negative integer is designated by a leading minus  sign (-89%).D o A positive integer is designated byH a leading plus sign or no sign.A o Integer numeric data have a size of 32 bits and correspond" to the VAX BASIC long word.D o INTOUCH allows integer numbers in the range of -2147483648 to +2147483647. 3 String_dataAString data is textual information. Enclose string constants in ?quotes. String variables, functions, etc. are designated by a trailing dollar sign. . o Strings can consist of any characters.C o String constants are eInclosed in quotes. String variables,E functions, etc. are designated by a trailing dollar sign ($).4 o A string may contain up to 65535 characters. 3 ExpressionsEData is always represented as a type of expression. Your expression can be: o A constant. o A variable.C o An array element. Array elements are a type of variable.: o A substring. Substrings are a type of variable. = o A structure reference. Struct Jure references are a A feature of the INTOUCH data structure system. They are( treated as a type of variable.? o A compound expression. Compound expressions are any : combination of the above separated by operators.3 Numeric_constants?Numeric constants are created by simply typing the number. ForIexample, typing the number 5.38 creates the real numeric constant 5.38. ;Integer constants are created by typing an integer number. DHowever, you m Kust designate an integer constant by adding a trailingDpercent sign to the number (5%). The percent sign tells INTOUCH the?number is an integer. Real numeric constants can be given in E notation. 4 E_notationGE notation is a shorthand way of representing very great or very small Dnumbers. INTOUCH will always return any real value of more than 12 Edigits in E notation. You can also give numbers in E notation. The format is:$ +/- number E+/- nB+/- is the siLgn of the number. If no sign is given, INTOUCH ' treats the number as positive.@number is the number on which the exponentiation is performed.<E is a symbol which means "times 10 to the power of".@+/- is the sign of the exponent. If no sign is given, the ) exponent is treated as positive.9n is the exponent represented as an integer digit.>+1E3 = "1 * 10^3" or 1000. 1E-2 = "1 * 10^-2" or .01.3 String_constantsCA string constant is t Mext enclosed in delimiters (quotes). String Econstants must be enclosed in quotes. The quotes tell INTOUCH where Cthe string begins and ends. The quotes are not considered part of Ethe string. Everything between the quotes IS considered part of the string.>An empty string is called the null string. The null string is>indicated by a pair of quotes with nothing between them (""). CDouble quotes (") or single quotes (') can be used as string delim-Biters. However, the quotes must N match. Quotes can be included as@part of a string by including them within the string delimiters. For example,% "Message 'Time to go home!'"EThe string part of this is: Message 'Time to go home!'. If you wantCto use the delimiter quotes within the string, you must repeat the =quotes twice. For instance: "Message ""Time to go home!""". 3 VariablesBVariables are a way of storing data. A variable is the name of a :location where a value is stored. The value stored can beO1changed any number of times. Your variable name:@ o May only consist of letters, numbers, and the underscore  character (_). o Must start with a letter.' o May be up to 31 characters long.> o Must include the proper designation--a trailing percentC sign for integer values, a trailing dollar sign for strings..The following are examples of valid variables:. TODAY$ X% Z INDEX 3 RoundingCIf you assign a Preal value to an integer variable, function, etc., CINTOUCH will round the real number to the nearest integer. INTOUCH?will assign this value to the integer variable, function, etc. specified.3 Arrays@An array consists of a number of array elements. Each of these Belements represents a storage location. The subscript designates Ethe specific element. When you reference an array element, you must )specify a subscript for each dimension. 6 AMOUNT%(1,1) Q AMOUNT%(1,2) AMOUNT%(1,3)6 AMOUNT%(2,1) AMOUNT%(2,2) AMOUNT%(2,3)? o Arrays must be defined with the DIM statement and may be ) redefined with the REDIM statement.* o Arrays may have up to 32 dimensions.< o Integer and string arrays must be properly designated." o Subscripts must be integers. 3 SubstringsASubstrings are created by taking a subset of the characters in a ,larger string. The format of a substring is' str_var R[begin : end]AStr_var is the name of a string variable. Begin is the position @where the substring begins. End is where it ends. For example,+ 10 A$='ABCDEFGHIJKLMNOPQRSTUVWXYZ' PRINT A$[9:14] 20 END RNH IJKLMN INTOUCH3 Structure_referencesEAnother type of variable is the structure reference. To reference a Cstructure field, you must indicate both the structure name and the ?field whose contents you want to read: Sstruc_name(field_expr).DStruc_name is the name associated with the structure. Field_expr is>an expression specifying the field in the structure. INTOUCH Dsearches for the field in the current record and reads its contents.D 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT", ACCESS OUTIN" 20 EXTRACT STRUCTURE CL END EXTRACTstructure 30 FOR EACH CL6references --- PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) NEXT CL 40 CLOSE STRUCTURE T 50 END4 Field_expressionsIThe field_expr may be given a string or numeric expression. You may use Ia string constant to specify the field name. If you give the field name Gas a string constant, you need not enclose it in quotes. INTOUCH will ;use the string constant as the field name: PRINT CL(LAST).HIf you specify the field as other than a string constant, you will need Eto precede the expression with a pound sign (#). This tells INTOUCH 7that the following charactUers are not the field name. , PRINT CL(#FIELDNAME$)# /; the field is specified by the variable FIELDNAME$* PRINT CL(#FIELDNUM) /9 the field is specified by the variable FIELDNUM3 Compound_expresssions?Compound expressions are formulas which consist of expressions A(constants, variables, functions, etc.) separated by operators. ,There are two types ofV compound expressions: Conditional expressions Unconditional expressions4 UnconditionalsBUnconditional expressions consist of data separated by arithmetic :operators. The arithmetic operators are +, -, *, / and ^.; + stands for "plus" and results in addition. TOTAL + 2? - stands for "minus" and results in subtraction. TOTAL - 2@ / stands for "divide by" and results in division. TOTAL / 2A * stands for "times" and results in multiplication. TOTAL * W2A ^ stands for "to the power of" and results in exponentiation. TOTAL ^ 2BYou may only add string expressions. Adding strings results in a *concatenation or joining of the strings. " PRINT "MO" + "TH" & "ER" MOTHER4 ConditionalsBConditional expressions are expressions which yield a TRUE (1) or CFALSE (0) value. You create conditionals by separating expressionsC(constants, variables, substrings, etc.) with either relational or @logical operators. X (See the sub-topics below.) INTOUCH always Ereturns an integer as the result of a conditional expression. If the?expression does not evaluate to an integer, INTOUCH rounds it. 5 Relational_operators=Relational operators are similar to those used in math. The %relational operators you may use are:<= equals X=Y X is equal to Y=< less than X greater than X>Y X is greater thYan Y><= less than or equal to X<=Y X is less than or7 equal to YA>= greater than or equal to X>=Y X is greater than or7 equal to Y@<> not equal to X<>Y X is not equal to Y,X and Y may be any valid INTOUCH expression.5 Logical_operators=Logical operators are only used on integer expressions. The logical operators are:>NOT NOT X Z TRUE if X is false and FALSE if X is true.AND X AND Y TRUE if X and Y are true.,OR X OR Y TRUE if X or Y is true.AXOR X XOR Y TRUE if X is true, or if Y is true but FALSE. if both X and Y are true.AEQV X EQV Y TRUE if X and Y are true, or TRUE if X and Y4 are false, but FALSE otherwise.5IMP X IMP Y TRUE if X is true and Y is false 5 StringsEWhen you perform relational operations on strings, [ INTOUCH determinesEwhich string occurs first in the ASCII collating sequence and returnsFa TRUE (1) or FALSE (0) value. INTOUCH compares the strings characterFby character and determines where there is a difference in their ASCIIAvalues. When INTOUCH finds a character that differs, it comparesFthese characters and determines which has a smaller code. INTOUCH thenFreturns a TRUE or FALSE value depending on the relational expression.  10 A$="TEXT" B$="TEST"( \ MESSAGE$="Strings are equal"; 20 IF A$ < B$ THEN MESSAGE$=A$+' is less than '+B$; IF B$ < A$ THEN MESSAGE$=B$+' is less than '+A$ 30 PRINT MESSAGE$ 40 END RNH TEST is less than TEXT5 Bit_manipulationBLogical operators can be used to do bit manipulation. A bit which=is set to 1 is on. A bit which is set to 0 is off. Logical Boperators compare each bit position in each word according to the 7particular rules of the logica]l operator. For example, 10 LET A% = 23% LET B% = 37% LET C% = (A% AND B%) 20 PRINT C% 30 END RNH 5 INTOUCH3 Order_of_evaluation@INTOUCH evaluates expressions from left to right. The following>priorities take precedence over this left to right evaluation:>A. Parenthesis, (). INTOUCH always evaluates expressions in  parenthesis first.&B. INTOUCH performs functions second.$C. INTOUCH perfor^ms exponentiation.1D. INTOUCH performs multiplication and division..E. INTOUCH performs addition and subtraction.?F. INTOUCH performs relational operators from left to right. AG. Logical operators are performed in the following order: NOT, AND, OR, XOR, IMP, EQV. 2 Functions EFunctions perform operations and return values. Functions are calledFby their names. For example, PRINT PI would print the value returned Dby the function PI (3.141...). INTOUCH has four types o_f functions:@ SYSTEM Return information about the system and user actions.B NUMERIC Take only numeric arguments and return numeric results.C STRING Take strings (text) as arguments or give string results.. MISC Additional miscellaneous functions.@Arguments are numbers or strings which the function evaluates. EThere are some functions that don't conveniently fit into any of the 6three major categories. These are listed separately. 3 System_functions<The following ar"`e system functions. These functions return .information about the system and user actions.4 _EXITFORMAT: _EXIT-EXAMPLE: 10 INPUT 'Your name, please'; NAME$' IF _EXIT THEN EXIT GOTO 20# PRINT 'Hello, '; NAME$ 20 ENDA_EXIT returns a TRUE or FALSE value. TRUE if EXIT was entered atthe last prompt.4 _BACKFORMAT: _BACK-EXAMPLE: 10 INPUT 'Your name, please'; NAME$# 20 INPUT 'Your age'; AGE%"a IF _BACK THEN GOTO 10) 30 PRINT NAME$; ' is'; AGE%;'.' 40 END?_BACK returns a TRUE or FALSE value. TRUE if the backslash wasentered at the last prompt.4 _HELPFORMAT: _HELP-EXAMPLE: 10 INPUT 'Your name, please'; NAME$ IF _HELP THENE PRINT 'Type your first name and press the RETURN key' GOTO 10 END IF# 20 PRINT 'Hello, '; NAME$ 30 END@_HELP re"bturns a TRUE or FALSE value. TRUE if HELP or a question(mark (?) was entered at the last prompt.4 _REPLYFORMAT: _HELP-EXAMPLE: 10 INPUT 'Your name, please'; NAME$' 20 IF _REPLY='STOP' THEN STOP# 30 PRINT 'Hello, '; NAME$ 40 ENDB_REPLY returns the user's reply to the last prompt. The reply is returned as a string.4 _DEBUGFORMAT: _DEBUG.EXAMPLE: 10 INPUT 'Turn on debug (Y/N)?'; ON$% 20 IF ON$='Y' cTHEN DEBUG ON2 30 IF _DEBUG=1 THEN PRINT 'Debug is on.' 40 ENDE_DEBUG returns a true or false value. _DEBUG returns a true value ifEDEBUG is turned on. It returns a false value if DEBUG is turned off. 4 _INTEGERFORMAT: _INTEGEREXAMPLE: 10 LIBRARY 'LIBRTL' 20 CALL LIB$ICHAR('Q')< 30 PRINT 'The integer value of "Q" is : ';_INTEGER 40 ENDC_INTEGER returns any integer data resulting from a CALL. SometimesHwhen y#dou do a CALL, an integer value is returned as a side-effect of the#CALL. _INTEGER returns this value.4 _REALFORMAT: _REALEXAMPLE: 10 LIBRARY 'MTHRTL' 20 CALL MTH$ALOG(45.3)' 30 PRINT 'The log is: ';_REAL 40 ENDF_REAL returns any real data resulting from a CALL. Sometimes when youBdo a call, a real value is returned as a side-effect of the CALL. _REAL returns this value. 4 _EXTRACTEDFORMAT: _EXTRACTED:eEXAMPLE: 10 OPEN STRUCTURE CL: NAME 'CLIENT', ACCESS OUTIN 20 EXTRACT STRUCTURE CL& 30 INCLUDE CL(STATE) = 'CA' 40 END EXTRACTC 50 PRINT 'Number of clients from California: '; _EXTRACTED 60 END?_EXTRACTED returns the number of records extracted in the last /extract. _EXTRACTED returns an integer number.3 Numeric_functions@The following are numeric functions. These functions take only .numeric arguments and give a numeric res0fult. 4 ABS!FORMAT: num_var = ABS(num_expr)EXAMPLE: A = ABS(-100 * G)?Absolute value. ABS returns the absolute value of the numeric expression specified.4 ACOS"FORMAT: num_var = ACOS(num_expr)EXAMPLE: Y = ACOS(X)AArc cosine. ACOS returns the angle whose COS is x. The angle is8returned in radians. X should also be given in radians.4 ANGLE-FORMAT: num_var = ANGLE(num_expr, num_expr)/EXAMPLE: 10 #gA = ANGLE(5,5) ! 45 degree angleEGiven coordinates X and Y, returns the angle from 0,0. The angle is Creturned in radians. X and Y are given as numeric expressions and should be given in radians.4 ASIN "FORMAT: num_var = ASIN(num_expr)EXAMPLE: 10 Y = ASIN(X)BArc sine. ASIN(X) returns the angle whose SIN is X. The angle isGreturned in radians. X is given as a numeric expression and should be given in radians.4 ATN!FORMAT: !hnum_var = ATN(num_expr)EXAMPLE: 150 A = ATN(1)ETangent angle. The ATN function returns the angle, in radians, of a Especified tangent. The tangent is given as a numeric expression and should be given in radians.4 CEIL "FORMAT: num_var = CEIL(num_expr)1EXAMPLE: 300 CEILING_VALUE = CEIL(INITIAL_VALUE)ACEIL(X) returns the ceiling of X. That is, the smallest integer =that is not less than X. X is given as a numeric expression.4 COS_*i(cosine)!FORMAT: num_var = COS(num_expr) EXAMPLE: 900 COSINE = COS(PI/2)ECosine. The COS function returns the cosine of an angle you specify.?The angle is given as a numeric expression and should be given in radians. 4 COSH "FORMAT: num_var = COSH(num_expr)EXAMPLE: 10 Y = COSH(X)AHyperbolic cosine. COSH(x) returns the hyperbolic cosine of the 9numeric expression specified. It is returned in radians.4 COT !FORMAT: 4j num_var = COT(num_expr)EXAMPLE: 10 Y = COT(X)GCotangent. COT(X) is equivalent to 1/TAN(X). X is given as a numeric *expression and should be given in radians.4 CSC !FORMAT: num_var = CSC(num_expr)EXAMPLE: 500 Y = CSC(MY_ANGLE)HCosecant. CSC(X) is the cosecant of X. It's a shorthand for 1/SIN(X). 4 DATEFORMAT: int_var = DATEEXAMPLE: 10 A = DATE%Returns today's date in YYDDD format.4 DEGk!FORMAT: num_var = DEG(num_expr)EXAMPLE: 10 D = DEG(45)?Degrees. Given an angle, DEG returns the number of degrees in ?the angle. The angle should be given as a numeric expression, in radians. 4 ELEMENTS'FORMAT: num_var = ELEMENTS(str_expr1) or2 num_var = ELEMENTS(str_expr1, str_expr2)0EXAMPLE: 10 LET NUMBER = ELEMENTS(PROCEDURES$)DReturns the number of elements in a string expression which containsCa list o#lf elements. Str_expr1 is the string containing the list ofCelements. The elements must be separated. A comma is the default separator.4 EPS!FORMAT: num_var = EPS(num_expr)(EXAMPLE: 10 PRINT EPS(123456789012345)AINTOUCH carries 15 digits of precision. EPS(number) returns the Dsmallest value, which when added to "number" yields the next largestnumber. 4 EXLINEFORMAT: int_var = EXLINE,EXAMPLE: 300 IF EXLINE = 20% THEN CLOSE #2%,mFExecuting line. The EXLINE function returns the line number that was (executing when the last error occurred. 4 EXP!FORMAT: num_var = EXP(num_expr)EXAMPLE: 100 A = EXP(4.6)GE exponential. The EXP function returns the value of the mathematical Hconstant, "e", raised to a specified power. The power is specified by anumeric expression.4 EXTYPEFORMAT: int_var = EXTYPE%EXAMPLE: 2000 ERROR_NUMBER% = EXTYPEGThe EXTY(nPE function returns the number of the last error that occurred.(It is returned as an integer expression.4 FALSEFORMAT: int_var = FALSE9EXAMPLE: 10 IF _EXIT = FALSE THEN GOTO ASK_QUESTIONSReturns the constant 0.4 FP FORMAT: num_var = FP(num_expr),EXAMPLE: 10 A = FP(34.56) ! A will be .56EFractional part. Given a number, returns the fractional part of the ;number. The number can be given as any numeric expression&o.4 INT!FORMAT: num_var = INT(num_expr)!EXAMPLE: 650 RESULT = INT(6.667)HInteger gives the largest integer which is not greater than the numeric expression. 4 INTEGER%FORMAT: num_var = INTEGER(num_expr)(EXAMPLE: 10 INPUT 'Enter a number': NUM# 20 INPUT 'Your age': AGE%) 30 LET ID = INTEGER(NUM + AGE%)* 40 PRINT 'Your ID number is'; ID 50 ENDAINTEGER changes any numeric expression into an ipnteger value and 4assigns the integer value to the variable specified.4 IP FORMAT: num_var = IP(num_expr)4EXAMPLE: 200 VALUE = IP(-6.667) ! VALUE will be -6JInteger portion. The IP function truncates a real number to an integer. GAny fractional numbers (.667) are dropped and the remaining integer is Greturned (-6). The real number can be given as any numeric expression.4 LOG_(logarithm)!FORMAT: num_var = LOG(num_expr)#EXAMPLE: 10 EXPON'qENT = LOG(100.35)@Logarithm. The LOG function returns the natural logarithm of a Especified number. The number can be given as any numeric expression.4 LOG2"FORMAT: num_var = LOG2(num_expr)$EXAMPLE: 600 EXP_BASE_2 = LOG2(250)>Logarithm base 2. The LOG2 function returns a number's base 2>logarithm. The number can be given as any numeric expression.4 LOG10#FORMAT: num_var = LOG10(num_expr)&EXAMPLE: 600 EXP_BASE_10 = LOG10()r250)ALogarithm base 10. The LOG10 function returns a number's common >logarithm. The number can be given as any numeric expression.4 MAX_(maximum)+FORMAT: num_var = MAX(num_expr, num_expr)EXAMPLE: A = MAX(34, 65)FMaximum. MAX(X,Y) returns whichever of the values X and Y is largest./X and Y can be given as any numeric expression.4 MAXNUMFORMAT: num_var = MAXNUM,EXAMPLE: PRINT 'Largest number is: ';MAXNUM>Maximum numb$ser. Returns the largest number available in this implementation of INTOUCH.4 MIN +FORMAT: num_var = MIN(num_expr, num_expr)EXAMPLE: A = MIN(34, 65)>Minimum. MIN(X,Y) returns whichever of the values X and Y is :smallest. X and Y can be given as any numeric expression.4 MOD+FORMAT: num_var = MOD(num_expr, num_expr)-EXAMPLE: 10 A = MOD(11,7) ! A will be a 4DGives the remainder of the first number divided by the second. The ?0tnumbers can be given as any numeric expression. MOD gives the )remainder using the formula X-Y*INT(X/Y).4 PIFORMAT: num_var = PI"EXAMPLE: AREA = PI * (RADIUS ^ 2)+Returns the constant PI, 3.141592653589793.4 RAD!FORMAT: num_var = RAD(num_expr)EXAMPLE: RAD_MEASURE = RAD(45)DGiven a measurement in degrees, returns the number of radians. The 3measurement can be given as any numeric expression.4 REAL"FORMuAT: num_var = REAL(num_expr)#EXAMPLE: 10 INPUT 'Your age': AGE%) 20 LET DECIMAL_AGE = REAL(AGE%)0 30 PRINT 'Your number is'; DECIMAL_AGE 40 ENDBREAL changes any numeric expression into a real or floating-point ;value and assigns the real value to the variable specified. 4 REMAINDER 1FORMAT: num_var = REMAINDER(num_expr, num_expr)4EXAMPLE: 10 R = REMAINDER(TEXT_NUMBER, TEXT_FACTOR)FRemainder. REMAINDER(X,Y) returns the remainderv when X is divided by CY. It differs subtly from MOD. REMAINDER gives the remainder usingEthe formula X-Y*IP(X/Y). So, MOD(-4,3) = 2 while REMAINDER(-4,3)=-1.<REMAINDER gives the remainder using the formula X-Y*IP(X/Y).4 RNDFORMAT: num_var = RND)EXAMPLE: 990 CARD_NUMBER = INT(RND*52)+1DRandom. The RND function returns a random number which is equal to 'or greater than zero and less than one.4 ROUND-FORMAT: num_var = ROUND(num_expr, inwt_expr),EXAMPLE: TAX_DOLLARS = ROUND(SALES*0.6, 2%)HRound. ROUND rounds a number to the specified number of decimal digits.FThe number to be rounded can be given as any numeric expression. The @number of decimal digits must be given as an integer expression.4 SEC !FORMAT: num_var = SEC(num_expr)EXAMPLE: 500 Y = SEC(MY_ANGLE)ESecant. SEC(X) is the secant of X. It's a shorthand for 1/COS(X). HX can be given as any numeric expression and should &xbe given in radians.4 SGN!FORMAT: int_var = SGN(num_expr)(EXAMPLE: 750 SIGN% = SGN(-45*35/6-3000)=Sign. The SGN function operates on a numeric expression. It 8returns a +1 if the expression is positive, a -1 if the 9expression is negative, and 0 if the expression is zero. 4 SIN_(sine)!FORMAT: num_var = SIN(num_expr)!EXAMPLE: 10 S1_ANGLE = SIN(PI/2)FSine. The SIN function returns the sine of the angle specified. The Dangle 0ycan be given as any numeric expression and should be given in radians.4 SINH "FORMAT: num_var = SINH(num_expr)EXAMPLE: 10 Y = SINH(X)FHyperbolic sine. Gives the hyperbolic sine of the numeric expression.4 SQR!FORMAT: num_var = SQR(num_expr)EXAMPLE: 425 ROOT = SQR(35*37)@Square. The SQR function returns the square root of a number. 2The number can be given as any numeric expression.4 _TAN!FORMAT: num_#zvar = TAN(num_expr)EXAMPLE: 550 X = TAN(2*PI)HTangent. The TAN function returns the tangent of the angle you specify.HThe angle may be given as any numeric expression and should be given in radians.4 TANH "FORMAT: num_var = TANH(num_expr)EXAMPLE: 10 Y = TANH(X)EHyperbolic tangent. TANH(X) returns the hyperbolic tangent of X, as Ddefined by SINH/COSH. X can be given as any numeric expression and should be given in radians.4 TIME'{"FORMAT: num_var = TIME(num_expr)EXAMPLE: 150 PRINT TIME(0)ATime. TIME(0) returns the time of day in seconds since midnight.<TIME(1) returns the number of CPU seconds for the currently &running process in tenths of a second.4 TRUEFORMAT: int_var = TRUE6EXAMPLE: IF _EXIT = TRUE THEN GOTO DONE_WITH_THIS=Returns the constant 1. It is returned as an integer number. 4 TRUNCATE0FORMAT: num_var = TRUNCATE(num_expr, int_expr)|*EXAMPLE: CHICKENS = TRUNCATE(EGGS*.8, 0%)BTruncates a number to the specified number of decimal digits. TheCnumber to be truncated can be given as any numeric expression. TheAnumber of decimal digits must be given as an integer expression. 3 String_functionsJString functions take a string argument or give a string result. Strings Iconsist of text. Arguments are numbers or text the function evaluates. 7Listed below are the string functions INTOUCH provides.}4 ASCII#FORMAT: int_var = ASCII(str_expr)(EXAMPLE: 500 ASC_VAL% = ASCII(EMP_NAM$):ASCII. The ASCII function returns the decimal ASCII value0of the first character in the string specified. 4 CHANGE$2FORMAT: CHANGE$(str_expr1, str_expr2, str_expr3)=EXAMPLE: CHANGED$ = CHANGE$('cameron whitehorn', 'cam', 'd')DCHANGE$ changes specified characters in str_expr1. Str_expr1 is the=source string. Str_expr2 contains the target characters, andEstr_expr3 ~specifies the substitution characters. CHANGE$ returns thechanged string. 9 CHANGE$(source_string, target_chars, sub_chars)CCHANGE$ searches for the target characters within the source stringDand replaces these characters with the substitution characters. TheCsubstitution characters are mapped onto the target characters. Seebelow for more examples. 5 EXAMPLE1# 10 LET A$ = 'bdbdbdbd' 20 LET B$ = 'b' 30 LET C$ = 'c'0 40 LET CHANGED$ = CHANGE$(A$,B$,C$) 50 PRINT A$ 60 PRINT CHANGED$ 70 END RNH bdbdbdbd cdcdcdcd INTOUCHFIn the above example, CHANGE$ searched for the string 'b' and replacedit with the string 'c'. 5 EXAMPLE22 10 LET A$ = 'cameron whitehorn'$ 20 LET B$ = 'cam'" 30 LET C$ = 'd'6 40 LET CHANGED$ = CHANGE$(A$,B$,C$) € 50 PRINT A$$ 60 PRINT CHANGED$ 70 END RNH$ cameron whitehorn$ ddderon whitehorn INTOUCHDIn this example, INTOUCH searches in the string 'cameron whitehorn' Efor the letters 'c', 'a' and 'm'. (Note: INTOUCH searches for each Eof the individual characters in str_expr2.) It substitutes a 'd' for each of these characters. 5 EXAMPLE3BIf there are fewer target char acters than substitution characters,EINTOUCH ignores any extra substitution characters. If there are moreEtarget characters than substitution characters, CHANGE$ wraps back to!the first substitution character:2 10 LET A$ = 'cameron whitehorn') 20 LET B$ = 'whitehor'% 30 LET C$ = 'abcd'F 40 LET CHANGED$ = CHANGE$(A$,B$,C$)  50 PRINT A$7 60 PRINT CHANGED$ ‚  70 END  RNH$ cameron whitehorn$ camadcn abcdabcdn INTOUCH 4 CHARSET$FORMAT: CHARSET$ or CHARSET$(str_expr) FEXAMPLE: CHNG$=CHANGE$('Cam Ray',CHARSET$('ucase'),CHARSET$('lcase'))@Returns a character set. The optional string expression can be ;used to specify the character set to return. The sets are:0 UCASE all uppercase letters (A-Z) ƒ0 LCASE all lowercase letters (a-z)8 CONTROL all control characters (ASCII 0-31)A ASCII the ASCII character set, in order (default) DASCII is the default character set for CHARSET$. See example topic 3below for an example of CHARSET$ used with CHANGE$. 5 EXAMPLE- 10 LINE INPUT 'Enter some text': TEXT$) 20 ! Change uppercase to lowercaseD CT$ = CHANGE$(TEXT$, CHARSET$('UCASE'), CHARSET$('LCASE'))- PRINT 'Lowerca„se version is: '; CT$6 30 ! Change tabs, ctrl characters, etc. to dots- KEY INPUT 'Enter a character': KEY$7 CK$ = CHANGE$(KEY$, CHARSET$('CONTROL'), '.')* PRINT 'Here is your text: '; CK$ 40 END4 CHR$"FORMAT1: str_var = CHR$(int_expr),FORMAT2: str_var = CHR$(int_expr, int_expr)EXAMPLE: 200 A$ = CHR$(65%)' 220 FIFTY_A$ = CHR$(65%, 50%);CHR$. The CHR$ function returns a string which consists of:the specified …ASCII value repeated the specified number of9times. The first integer expression is the ASCII value. 5The second is the number of times this value is to be5repeated. If no count is specified then the value isrepeated once. 4 DATE$0FORMAT: str_var = DATE$[(int_expr)[,int_expr]]"EXAMPLE: 500 PRINT DATE$(150109%)& 520 PRINT 'Today is: ';DATE$;The DATE$ function returns a date in the form of YYYYMMDD. :Int_expr is an integer expression specifying the number of9days† since January 1, 1600. January 1, 1600 is considered7day one. If no argument is given, then today's date is=returned. The effect of the second string expression allows Buser the options to choose the desired output format for the date.'Those integer options range from 1 - 4. 5 EXAMPLE1  PRINT DATE$(123456,1)  01041938 | | | mo day year 5 EXAMPLE2 PRINT DATE$(123456,2) 04011938 | | | day mo year 5 EXAMPLE3$‡ PRINT DATE$(123456,3) 04-Jan-1938 5 EXAMPLE4 PRINT DATE$(123456,4) January 4, 19384 DAYS"FORMAT: int_var = DAYS(str_expr)=EXAMPLE: 100 DAYS_PAST_DUE = DAYS(TODAY$) - DAYS(DUE_DATE$)6Given a date in YYYYMMDD or YYMMDD format, returns the9number of days since January 1, 1600. January 1, 1600 isconsidered day 1. 4 DAY$"FORMAT: str_var = DAY$(int_expr)&EXAMPLE: 100 THEDAY$ = DAY$(150109%)9DAY$ returns the dayˆ of the week. Int_expr is an integer9expression specifying the number of days since January 1,41600. January 1, 1600 is considered day one. If no3argument is given, then the current day is returned4(today). The day is returned as a string expression(Friday, Saturday, etc.). 4 DECODE.FORMAT: int_var = DECODE(str_expr, int_expr)AEXAMPLE: 100 PRINT 'The address is at: ';DECODE(HEX_VALUE$, 16%)9Given the string representation of a number, and the base;the ‰value is in, INTOUCH returns the value of the number in5base 10. The number is returned as a real. Int_exprspecifies the base. 4 EDIT$-FORMAT: str_var = EDIT$(str_expr, int_expr)3EXAMPLE: 100 NEW_STRING$ = EDIT$(OLD_STRING$, 48%);The EDIT$ function performs one or more editing operations,8depending on the value of the integer expression, on the;supplied string argument. The integer argument must be one3of the integers below, or a sum of these integers:  1% T Šrim parity bits.' 2% Discard all spaces and tabs.A 4% Discard characters: CR, LF, FF, ESC, RUBOUT, and NULL.+ 8% Discard leading spaces and tabs./ 16% Reduce spaces and tabs to one space., 32% Convert lower case to upper case./ 64% Convert "[" to "(", and "]" to ")"., 128% Discard trailing spaces and tabs.1 256% Do not alter characters inside quotes. 4 ELEMENT$&FORMAT: ELEMENT$(str_expr, num_expr) or2 ‹ ELEMENT$(str_expr1, num_expr, str_expr2) 0EXAMPLE: 10 LET A$ = ELEMENT$('ADD,DEL,EXIT',2) 20 PRINT A$ 30 ENDEELEMENT$ returns the element from str_expr1 which is specified by theDnum_expr. Str_expr1 must contain a set of elements with separator'sDbetween them. The default separator is a comma. You may specify a =separator other than the comma with str_expr2. For example: 7 10 LET SENTENCE$ = 'This is a test.'8 20 LET ŒA$ = ELEMENT$(SENTENCE$,2,' ') 30 PRINT A$ 40 END 4 ENCODE$.FORMAT: str_var = ENCODE$(num_expr, num-int);EXAMPLE: 100 PRINT 'In binary, it is: ';ENCODE(ANSWER, 2%):Given a numeric value and a base, ENCODE$ returns a string;representation of the number in the given base. If no base$is specified, INTOUCH uses base 10. 4 EXLABEL$FORMAT: str_var = EXLABEL$)EXAMPLE: 2000 ERROR_LOCATION$ = EXLABEL$9The EXLABEL$ function returns the name of the label which8was executing when the last error occurred. The name isreturned in trace format. 4 EXTEXT$%FORMAT: str_var = EXTEXT$(int_expr))EXAMPLE: 2020 ERROR_TEXT$ = EXTEXT$(11%):The EXTEXT$ function returns the explanatory text which is7associated with the specified error number. The error/number must be given as an integer expression. 4 FINDFILE$FORMAT: FINDFILE$(str_expr) or'  FINDFILE$(str_expr, int_expr) *EXAMPLE: PRINT FINDFILE$('TTI_RUN:*.INT')EReturns a string expression containing the filename of the first fileCfound matching the given file specification. Str_expr contains theFfile specification. If no file is found, the null string is returned.>The second parameter may be used to get a series of files. It3functions something like the subscript in an array. 5 EXAMPLE16 10 PRINT FINDFILE$('TTI_RUN:*.INT')  20 END RNH- DUA0:[INTOUCH]ALIENS.INT;5 INTOUCH 5 EXAMPLE2> 10 LINE INPUT 'Enter a file specification': SPEC$$ FOR I = 1 TO 9999 , FILE$ = FINDFILE$(SPEC$,I)= IF FILE$ = '' THEN EXIT FOR ! no more files PRINT FILE$ NEXT I 20 END RNH9 Enter a file specification? TTI_RUN:CLIENT.*' DUA0:[INTOUCH]CLIENT.DAT;7' DUA0:[INTOUCH]CLIENT.DEF;3' DUA0:[INTOUCH]CLIENT.INT;1( DUA0:[INTOUCH]CLIENT.STR;16 INTOUCH 4 FORMAT$/FORMAT: str_var = FORMAT$(str_expr, str_expr)6EXAMPLE: 10 PRINT FORMAT$('123456789', '###-##-####')8Format. FORMAT$(X$,Y$) returns an INTOUCH edited string7where X$ is the source string and Y$ is the edit mask. 3(See INPUT SCREEN for a description of edit mask%‘s.)4 LCASE$$FORMAT: str_var = LCASE$(str_expr)*EXAMPLE: 100 LOWER$ = LCASE$('and so on')7LCASE$ returns the string expression specified with all%alphabetic characters in lower case. 4 LEFT$/FORMAT: str_var = LEFT[$](str_expr, int_expr)-EXAMPLE: 410 FIRST_FIVE$ = LEFT$(ALPHA$, 5%):The LEFT$ function extracts a substring from the left side:of a string, leaving the string unchanged. Int_exp is the9last character position to be in-’cluded in the substring. 4 LEN!FORMAT: int_var = LEN(str_expr)#EXAMPLE: 200 LENGTH% = LEN(ALPHA$);The LEN function returns the length of the specified stringas an integer. 4 LPAD$3FORMAT: str_var = LPAD$(text_str, size[,pad_str])(EXAMPLE: 10 PRINT LPAD$('123', 6, '0')GThe LPAD$ function pads a string on the left with pad characters. The "default pad character is a space. 4 LTRIM$$FORMAT: str_var = LTRIM$“(str_expr))EXAMPLE: 100 COMMAND$ = LTRIM$(COMMAND$)3Returns the string specified without leading spaces5(without any spaces at the beginning of the string). 4 MATCH%FORMAT: MATCH(str_expr1, str_expr2) 9EXAMPLE: 10 INPUT 'Which procedure (ADD,DEL,EXIT)': PRO$0 20 LET X = MATCH('ADD,DEL,EXIT', PRO$)" 30 ON X GOSUB 50, 70, 90 40 GOTO 10 50 PRINT 'Adding...' 60 RETURN 70 PRINT 'Deleting...' 80 RET”URN 90 ENDEStr_expr1 contains a list of elements separated by commas. Str_expr2Fcontains a string. MATCH compares str_expr2 with each of the elements@in str_expr1 and gives the number of the element which matches. 4 MAXLEN%FORMAT: str_var = MAXLEN(str_expr)#EXAMPLE: 10 PRINT MAXLEN("1234")CThe MAXLEN function returns the maximum length of string that this -variable can contain. It returns an integer.4 MID$8FORMAT: str_var = MID[$]•(str_expr, int_exp1, int_exp2)5EXAMPLE: 220 NEW_STRING$ = MID$(OLD_STRING$, 5%, 8%)9The MID$ function extracts a substring from the middle of4the specified string, leaving the string unchanged. 8Int_exp1 is the starting position for the substring, and9int_exp2 is the number of characters you want included inthe substring. 4 ORD_(function)!FORMAT: int_var = ORD(str_expr)&EXAMPLE: 100 BELL$ = CHR$(ORD('BEL'))9Given the ASCII name of a character, returns#– the location;of that character in the ASCII character table. It returnsan integer number. 4 ORDNAME$&FORMAT: str_var = ORDNAME$(int_expr)#EXAMPLE: CHAR_NAME$ = ORDNAME$(7%)8Given the location of a character in the ASCII character8table, returns the name of that character. The location(must be given as an integer expression. 4 PARSE$&FORMAT: str_var = PARSE$[(str_expr)]2EXAMPLE: 10 PRINT PARSE$('abc$+"and sons" !rnn')EThe PARSE$ f—unction tokenizes the text string and returns each token Eseparated by a space. Each token is converted to uppercase. Quoted ?data is not converted to uppercase. Tail comments are ignored.4 POS:FORMAT: int_var = POS(str_expr1, str_expr2 [,int_expr]) +EXAMPLE: 400 Y% = POS(ALPHA$, "JKLMN", 1%)4The POS function searches for a substring within the5specified string. It returns the substring's starting;character position. Str_exp1 is the string to be searched,7st˜r_exp2 is the substring to locate, and int_exp is the7optional character position at which to begin searching4(the default is the beginning of the start string). 4 REPEAT$/FORMAT: str_var = REPEAT$(str_expr, int_expr)-EXAMPLE: 100 BANNER$ = REPEAT$('TEST ', 16%)8Creates a string composed of the specified text repeated6the specified number of times. Int_expr is an integer1expression specifying the number of repetitions. 4 RIGHT$ 0FORMAT: st™r_var = RIGHT[$](str_expr, int_expr)/EXAMPLE: 600 NEW_STRING$ = RIGHT$(ALPHA$, 21%)7The RIGHT$ function extracts a substring from the right;side of a string, leaving the string unchanged. Int_exp is5the character position of the last character you want,included COUNTING FROM THE RIGHT. Therefore,RIGHT$('Daniel',2) = 'el'. 4 RPAD$3FORMAT: str_var = RPAD$(text_str, size[,pad_str])(EXAMPLE: 10 PRINT RPAD$('123', 6, '0')DThe RPAD$ function pads a stringš on the right with pad characters. &The default pad character is a space. 4 RTRIM$$FORMAT: str_var = RTRIM$(str_expr)%EXAMPLE: COMMAND$ = RTRIM$(COMMAND$):Returns a string without any trailing spaces (i.e. without,any spaces on the right side of the string).4 SCAN$FORMAT: SCAN(str_expr1, str_expr2) or. SCAN(str_expr1, str_expr2, int_expr))EXAMPLE: 10 LET A$ = 'Cameron Whitehorn' 20 LET B$ = 'amr Wtor' ›' 30 LET POSITION = SCAN(A$,B$) 40 PRINT POSITION 50 END?Scans str_expr1 for the characters in str_expr2 and returns theCposition at which str_expr2 begins. Int_expr specifies a characterGposition for the search to begin at. The characters in str_expr2 need Enot appear contiguously in str_expr1. See the examples topics below. 5 EXAMPLE12 10 LET A$ = 'Cameron Whitehorn') 20 LET B$ = 'amr Wtor'0 30 œLET POSITION = SCAN(A$,B$)$ 40 PRINT POSITION 50 END RNH 2 INTOUCHEINTOUCH returns a 2 because str_expr2 begins at the second position. FNote that the characters are not contiguous within str_expr1, but theyFdo all occur in the order specified in str_expr2 ('Cameron Whitehorn',>'amr Wtor'). INTOUCH searches for a set of characters within Cstr_expr1 which appear in the ORDER they occur in str_expr2. SCAN is case sensitive. 4 SEG$8FORMAT: str_var = SEG$(str_expr, int_expr1, int_expr2)7EXAMPLE: MID_NAME$ = SEG$('Fred Henry Smith', 6%, 10%)6Extracts a substring from the given string. Int_expr1:specifies the character position the substring starts at. 8Int_expr2 specifies the character position the substring ends at. 4 SPACE$$FORMAT: num_var = SPACE$(num_expr)!EXAMPLE: HOLD_NAME$ = SPACE$(15)" RSET HOLD_NAME$ = "ROSE" # PRINT HOLD_NAME$>The SPACE$ function returns the number of spaces indicated by num_expr.4 STR$"FORMAT: str_var = STR$(num_expr)EXAMPLE: 800 Z$ = STR$(65)9Changes a number to a string containing the number. The :string that is created does not have any extra leading or trailing spaces. 4 SYSTEXT$FORMAT: SYSTEXT$ or SYSTEXT$(int_expr)EXAMPLE: PRINT SYSTEXT$ESYSTEXT$ returns the text associated with the Ÿoperating system statusFspecified. In INTOUCH, the text for VMS status messages are returned.AIf no int_expr is supplied, INTOUCH returns the text for the last@system status message. Int_expr can be used to specify a status<value. If an int_expr is supplied, INTOUCH returns the text#associated with this status value. 4 TIME$FORMAT: str_var = TIME$%EXAMPLE: PRINT 'The time is: ';TIME$3Returns the current time of day in HH:MM:SS format.4 TRIM$ FORMAT: TRIM$(str_expr) 1EXAMPLE: 10 STRIPPED$ = TRIM$(' Hello ') 20 PRINT STRIPPED$AReturns the string specified stripped of any leading or trailing spaces and tabs. 2 10 LET A$ = ' HELLO '( 20 PRINT '*'; A$; '*'1 30 LET STRIPPED$ = TRIM$(A$) 1 40 PRINT '*'; STRIPPED$; '*'  50 END RNH& * HELLO * "¡ *HELLO* INTOUCH4 UCASE$$FORMAT: str_var = UCASE$(str_expr)+EXAMPLE: 100 STATE_CODE$ = UCASE$(STATE$)8UCASE$ returns the string expression with all alphabeticcharacters in upper case. 4 VAL!FORMAT: num_var = VAL(str_expr)"EXAMPLE: 100 REAL = VAL("990.32")6The VAL function returns the floating point value of astring containing a number. 4 VALID-FORMAT: str_var = VALID(text_str, rule_str)EXAMPLE: 10 IN¢PUT "Age": AGE$2 20 IF NOT VALID (AGE$, "NUMBER") THEN( MESSAGE ERROR: "Bad age" END IF 30 ENDCThe VALID function is used to validate user responses. It returns /true or false according to the following rules: o NUMBER o INTEGER o YES/NO o DATE o DATE:MDY4 XLATE$.FORMAT: str_var = XLATE$(str_expr, str_expr).EXAMPLE: 100 OUTPUT$ = XLATE$(INPUT$, TABLE$)$£7The XLATE$ function translates one string to another by8referencing a table you supply. For example, the XLATE$;function translates from EBCDIC to ASCII. Str_expr1 is the6string to be translated. Str_expr2 is the translationtable. 3 Miscellaneous@The following functions do not conveniently fit into any of the three major categories.4 LBOUND2FORMAT: int_var = LBOUND(array_name [,int_expr])%EXAMPLE: LVALUE% = LBOUND(CHART, 1%)GGi!¤ven an array and a dimension number, returns the value of the lowest Hsubscript in that dimension. Int_expr specifies the dimension (1 is theEfirst dimension, 2 is the second dimension, etc.). The default is 1. 4 MAXSIZE'FORMAT: int_var = MAXSIZE(array_name)<EXAMPLE: IF ITEMS% > MAXSIZE(STORAGE) THEN PRINT 'No room'>Returns the total number of elements allowed in a given array.4 SIZE0FORMAT: int_var = SIZE(array_name [,int_expr])>EXAM¥PLE: IF ITEMS% > SIZE(CHART, 1%) THEN PRINT 'Too many'EReturns the total number of elements allowed in a given dimension of <an array. Int_expr specifies the dimension (1 is the first ?dimension, 2 is the second dimension, etc.). The default is 1.4 TABFORMAT: PRINT TAB(int_expr)2EXAMPLE: 200 PRINT A$; TAB(15%); B$; TAB(30%); C$HWhen used with the PRINT statement, the TAB function moves the cursor or?print mechanism rightwards to a specified column. Col¦umns are )numbered sequentially from left to right.4 UBOUND2FORMAT: int_var = UBOUND(array_name [,int_expr]))EXAMPLE: MAXYEAR% = UBOUND(CALENDER, 2%)HGiven an array and a dimension number, returns the value of the highest Gsubscript allowed in that dimension. Int_expr specifies a dimension (1Bis the first dimension, 2 is the second, etc.). The default is 1. 2 StatementsHINTOUCH programs consist of lines of source code. Each line can either @be blank, or c §ontain a comment, or a statement. Statements are Dinstructions which INTOUCH understands and follows. Statements are Isomething like words. You put these statements together in a meaningful 'order so that INTOUCH can execute them.MSee the list below for more information on the statements INTOUCH supplies. BSee STRUCTURES for more information on the structure statements. 3 CommentsEComments are placed in your program's source code. They are used to Eclarify the code. Comments can ¨only be seen when the source code is Hlisted or printed out. Comments are not executable statements. Here is&an example of a program with comments:) 10 REM By Jane Doe1 20 INPUT A$ ! Get a string3 PRINT A$ ! Print a string 30 ENDCThe REM statement, the exclamation point (!) and the tilde (~) can (be used to put comments in your program.4 REMCREM stands for remark. REM is a program© statement. It must be theConly statement on a physical line. When INTOUCH encounters the REMAstatement, it ignores the REM and everything following it on thatphysical line. ' 10 REM By Jane Doe INPUT A$ PRINT A$ 20 END4 Exclamation_pointDThe ! is used to put comments in source code. The exclamation pointAis not a statement so it may be used on the same physical line asCother stat ªements. However, it must FOLLOW any statements. INTOUCHAignores everything after the exclamation point (!). For example:* 10 INPUT A$ ! Get a string. PRINT A$ ! Print the string 20 ENDEThe ! can be used with the ampersand (&) to document continued lines.EWhen a line is continued with an ampersand, the comments must follow the ampersand: 10 INPUT A$C IF A$<>"" THEN PRINT A$; & ! Here is the trailing«; "is OK." ! comment text 20 END4 TildeAThe ~ is used to border parts of your source code. It allows you>to mark sections of your code. (INTOUCH ignores tildes unless.they are entered within quotes.) For example:' 10 REM By Jane Doe' ~~~~~~~~~~~~~~~( ~ INPUT A$ ~ ' ~ PRINT A$ ~' ~~~~~~~~~~~~~~~ ¬ 20 END3 ArraysDAn array is a table of variable elements. Each element represents aEstorage location and can be assigned a different value. For example,&the array AMOUNT(2,3) looks like this:; AMOUNT(1,1) AMOUNT(1,2) AMOUNT(1,3); AMOUNT(2,1) AMOUNT(2,2) AMOUNT(2,3)CThe first dimension in this array has two elements, the second has 9three elements. Each array can have up to 32 dimensions.EYou must dimension arrays befo ­re you use them in your programs. The GDIM statement is used to dimension arrays. The REDIM statement can be used to redimension your arrays.4 DIM'FORMAT: DIM [INTEGER | REAL | STRING]5 array_name(int_const, int_const...) ... or6 DIM array_name [( [int_const TO] int_const, + [int_const TO] int_const...)] ...EXAMPLE: DIM NAME$(4)% DIM NUMBER(3 TO 6, 2 TO 10)FDIM is used to dimension your arrays. Your arra ®ys must be dimensionedGbefore you use them in your program. You must specify a high bound forDeach dimension. The highest bound you can have is 2147483648. You =can specify a low bound by using the TO option. The numeric Dexpression preceding the TO is the low bound. The lowest bound you Bcan have is -2147483647. Low and high bounds can be given as any 5numeric expression. Up to 32 dimensions are allowed. 5 ExampleEXAMPLE: 5 DIM NAME$(3) 10 FOR I = 1 TO 3 ¯ INPUT NAME$(I) NEXT I 20 FOR J = 1 TO 3 PRINT NAME$(I) NEXT J 30 END RNH ? Jack ? Jill ? James Jack Jill James  INTOUCH4 REDIM6FORMAT: REDIM array_name (num_expr, num_expr...) ..." or5 REDIM array_name [( [num_expr TO] num_expr,) [n °um_expr TO] num_expr...)] ...EXAMPLE: REDIM NAME$(4)) REDIM NUMBER(3 TO Y%, Z% TO 10)AREDIM is used to redimension your arrays. Your arrays must have Bbeen dimensioned with the DIM statement before you use REDIM. YouEmust specify a high bound for each dimension. The highest bound you can have is 2147483648.AYou can specify a low bound by using the TO option. The numeric Dexpression preceding the TO is the low bound. The lowest bound you can have is -214748367. 5 ±ExampleEXAMPLE: 5 DIM NAME$(7)+ 10 INPUT 'How many names': NUM 20 REDIM NAME$(NUM) 30 FOR I = 1 TO NUM INPUT NAME$(I) PRINT NAME$(I) NEXT I 40 END RNH How many names? 3 ? Jack Jack ? Jill Jill ? James James INTOUCH 4 OPTION_BASEFORMAT: OPTION BAS²E {0 | 1}EXAMPLE: 10 OPTION BASE 0 DIM NAME$(5) 20 FOR I = 1 TO 5 INPUT NAME$(I)( PRINT 'Hello, '; NAME$(I) NEXT I 30 ENDBNormally, when no low bound is specified for a dimension, INTOUCH @gives the dimension a low bound of 1. The OPTION BASE statement@lets you specify a default low bound of 0 or 1. When following @DIM or REDIM statements are executed, INTOUCH will automatically-default the low bound to³ 0 or 1 as specified.3 OPTION_COMMUNICATE %FORMAT: OPTION COMMUNICATE ON | OFF$EXAMPLE: 10 OPTION COMMUNICATE OFF 20 PRINT "HELLO" 30 ENDEOPTION COMMUNICATE ON | OFF is used to turn INTOUCH message trapping on or off. 3 RANDOMIZEFORMAT: RANDOMIZE EXAMPLE: 5 RANDOMIZE 10 X=RND(10) PRINT X 20 ENDDINTOUCH uses a list of random numbers when the RND function is used.CIf no RANDOM statement is used, INTOUCH ´starts at the same place inBthis list each time the program executes. RANDOMIZE gives the RND@function a new starting point. This ensures that each time yourDprogram is run, you get a different random number sequence. If you >use RANDOM, it must be used before the RND function is called.3 DCL_Functions?INTOUCH provides certain DCL functions which you can use withinFyour programs. These functions perform operations and pass commands, -information etc. to the VAX operating system.4 PAµSSFORMAT: PASS str_expr8EXAMPLE: 10 INPUT "What would you like to show": STUFF$" 20 PASS 'SHOW ' + STUFF$ 30 ENDEPASS passes the string expression specified to the operating system'sHcommand interpreter. On VAX/VMS, it passes the expression to DCL. The Doperating system will respond to the string as if you had entered itBoutside of INTOUCH. When the system finishes, control returns to your INTOUCH program.4 KILLFORMAT: KILL str_expr;EXAMPLE: ¶10 INPUT 'What file do you want to delete': FILE$ 20 KILL FILE$ 30 ENDDUse KILL to delete files from within the INTOUCH environment. KILL 4deletes the file specified by the string expression.3 MESSAGE_[ERROR]#FORMAT: MESSAGE [ERROR:] str_expr-EXAMPLE: 10 INPUT 'Your name, please': NAME$A ! _EXIT is an INTOUCH system function IF _EXIT THEN0 MESSAGE ERROR: "Exiting INTOUCH" END IF · 20 ENDEINTOUCH uses line 23 to display messages and errors. Use the MESSAGEDstatement to display your own messages and errors on this line. If Cthe INTOUCH frame is on, your messages will appear centered in the Flower frame bar. If the frame is off, the message will appear at lineI23. The ERROR option causes INTOUCH to ring the terminal bell and purge (type ahead when your message is printed. 3 BranchingDYou can use several INTOUCH statements to branch to different po¸intsBin your program. Branching causes INTOUCH to transfer control to Canother line in the program. Execution continues from this line. ESome of the statements described below can also be used to return to "the point from which you branched.4 GOTOFORMAT: GOTO targetEXAMPLE: 10 INPUT NAME$" IF _EXIT THEN GOTO 20# PRINT 'Hello, '; NAME$ GOTO 10 20 END@Use GOTO when you want to jump from one part of your program to ?another. ¹GOTO transfers control to the target specified. The Atarget can be given as a line number or a label. The target line@must sequentially follow the GOTO statement. Program execution continues from the target. 4 GOSUBFORMAT: GOSUB target ... target --- block of code RETURNEXAMPLE: 10 GOSUB GET_INPUT# 20 PRINT 'Hello, '; NAME$ GOTO EXIT6 30 GET_INPUT: INPUT "Enter your name": NAME$* º NAME$ = UCASE$(NAME$) RETURN# 40 EXIT: PRINT 'FINISHED' ENDDGOSUB transfers control to a subroutine. The subroutine begins withDthe target. The target can be given as a line number or a label. IfBthe target does not exist, an exception is generated. All the codeDbetween the target and the RETURN statement is executed. RETURN endsFthe subroutine and transfers control to the statement following GOSUB. 4 ON\GOTOBFORMAT: ON int_expr GOTO tar»get1 [, target2...] [ELSE statement]:EXAMPLE: 10 INPUT 'Procedure (1=add, 2=del, 3=exit)': PRO% 20 ON PRO GOTO ADD, DEL, 30# ADD: PRINT 'Adding...' GOTO 10% DEL: PRINT 'Deleting...' GOTO 10 30 ENDDON GOTO transfers control to one of several targets depending on theEvalue of an integer expression. If the value of the expression is 1,Hcontrol is transferred to the first target. If the value is 2, control Ais trans ¼ferred to the second target, and so on. The ELSE option Hexecutes a statement if the integer expression doesn't yield a target. FYour integer expression may not yield a value greater than the number 8of targets. (A non-integer expression will be rounded.) 4 ON\GOSUBBFORMAT: ON int_expr GOSUB target1 [,target2...] [ELSE statement] ... target1 --- block of code RETURN [target2 --- block of code RE½TURN...]&EXAMPLE: See the Example topic below.EON GOSUB transfers control to one of several targets depending on theEvalue of an integer expression. Int_expr cannot exceed the number ofDtargets. When RETURN is executed, control returns to the statement Ffollowing the ON GOSUB. The rules for ON GOTO also apply to ON GOSUB. 5 Example 5 LET PASS=1; 10 ON PASS GOSUB GET_NAME, GET_AGE ELSE GOTO DONE GOTO 10, GET_NAME: INPUT 'Your name': N¾AME$# LET PASS=PASS+1 RETURN( GET_AGE: INPUT 'Your age': AGE" LET PASS=PASS+1 RETURN+ DONE: PRINT NAME$; ' is age'; AGE 20 END 4 DISPATCHFORMAT: DISPATCH str_expr . . . target ----$ ---- block of code ----ADISPATCH looks at the content of a string expr¿ession (str_expr), Fsearches for a routine with that name and dispatches to the routine. 0Str_expr is a name of subroutine to be executed. 5 Example9 10 INPUT 'Routine name', DEFAULT 'ADD': ROUTINE$ DISPATCH ROUTINE$ STOP 20 ADD:( PRINT 'Adding information' RETURN 30 CHANGE:* PRINT 'Changing information' RETURN 40 END3 LoopsFLoops execute a block of c Àode repeatedly, until a specified condition Gis met. There are two types of loops in INTOUCH: the DO loop and the BFOR\NEXT loop. FOR\NEXT loops are used when you need to repeat a Fblock of code a specific number of times, every time the program runs.CDO loops are used when you need to execute a block of code until a Dspecific condition is met, and when that condition can be different every time the program is run. 4 DO\LOOP&FORMAT: DO [WHILE expr | UNTIL expr]$ -- Á- block of code( LOOP [WHILE expr | UNTIL expr]"EXAMPLE: See example topic below.=Executes the block of code between the DO and LOOP statementsDrepeatedly. CTRL/C can be used to interrupt the loop. DO loops canEbe nested but may not overlap. WHILE and UNTIL set up conditions forCthe loops execution. The loop is executed if the condition is met.ACond_expr is a conditional expression. When INTOUCH executes theDWHILE option, INTOUCH executes the loop until the expression bÂecomesCFALSE. When INTOUCH executes the UNTIL option, INTOUCH executes the'loop until the expression becomes TRUE. 5 ExampleEXAMPLE: 5 A=3 10 DO UNTIL A=01 INPUT 'Your name, please': NAME$' PRINT 'Hello, '; NAME$ A=A-1 LOOP 20 END5 WHILE_exampleEXAMPLE: 5 A=3 10 DO/ INPUT 'Your name, please': NAME$% PRINT 'Hello, '; NAME$ A=A-1 à LOOP WHILE A>0 20 PRINT 'FINISHED' 30 END RNH! Your name, please? FRED Hello, FRED! Your name, please? JOHN Hello, JOHN! Your name, please? KATE Hello, KATE FINISHED INTOUCH5 UNTIL_exampleEXAMPLE: 5 A=3 10 DO UNTIL A=0/ INPUT 'Your name, please': NAME$% PRINT 'Hello, '; NAME$ A=A-1 LOOPÄ PRINT 'FINISHED' 20 END RNH! Your name, please? FRED Hello, FRED! Your name, please? JOHN Hello, JOHN! Your name, please? KATE Hello, KATE FINISHED  INTOUCH5 Placement_of_WHILE_and_UNTILCWHILE and UNTIL may be attached to the DO and the LOOP statements. BWhenever INTOUCH encounters a WHILE or UNTIL statement, it checks Cwhether to execute the loop. Therefor Åe, where the WHILE and UNTIL :statements are placed affects the execution of the loop. BIf a WHILE or UNTIL is attached to the DO statement, INTOUCH firstBchecks to see if the condition has been met. If the condition hasBbeen met, INTOUCH executes the loop. If the condition hasn't beenEmet, INTOUCH doesn't execute the loop at all. If a WHILE or UNTIL isBattached to the LOOP statement, INTOUCH executes the loop and thenFchecks to see whether the condition has been met. The DO loop will ÆbeDexecuted the first time, regardless. WHILE and UNTIL options can beEplaced at both ends of the loop. INTOUCH evaluates each expression in@turn. When it finds that one of the conditions hasn't been met,"INTOUCH stops executing the loop. 6 WHILE_and_UNTIL_exampleEXAMPLE: 5 DIM NAME$(4) A=1 10 DO UNTIL A=54 INPUT 'Your name, please' : NAME$(A) A=A+1! LOOP WHILE NOT _EXIT 20 PRINT 'FINISHED' Ç 30 END 5 EXIT_DOFORMAT: EXIT DOEXAMPLE: 10 DO / INPUT 'Your name, please'; NAME$$ IF _EXIT THEN EXIT DO% PRINT 'Hello, '; NAME$ LOOP 20 PRINT 'FINISHED' 30 ENDAEXIT DO exits the DO loop. When the EXIT DO is executed, controlEtransfers to the statement following LOOP. If EXIT DO is used withinEnested loops, it exits the loop it lies within. EXIT DO may only be used within DO loops. 6 ÈExampleEXAMPLE: 10 DO 3 INPUT 'Your name, please' : NAME$' IF _EXIT THEN EXIT DO( PRINT 'Hello, '; NAME$ LOOP 20 PRINT 'FINISHED' 30 END RNH$ Your name, please? Fred Hello, Fred$ Your name, please? EXIT FINISHED  INTOUCH 5 REPEAT_DOFORMAT: REPEAT DOEXAMPLE: 10 DO/ INPUT 'Your nam Ée, please': NAME$) IF NAME$='' THEN REPEAT DO% PRINT 'Hello, '; NAME$ LOOP 20 END@REPEAT DO repeats all or part of a loop. When INTOUCH executes Dthe REPEAT DO statement, it jumps to the statement following the DO.EIf REPEAT DO is within a nested loop, it repeats the loop it lies in.,REPEAT DO may only be used within DO loops. 6 ExampleEXAMPLE: 10 DO 3 INPUT 'Your name, please' : NAME$. IF NÊAME$ = "" THEN REPEAT DO' IF _EXIT THEN EXIT DO( PRINT 'Hello, '; NAME$ LOOP 20 PRINT 'FINISHED' 30 END RNH$ Your name, please? Fred Hello, Fred Your name, please?# Your name, please EXIT FINISHED  INTOUCH 5 ITERATE_DOFORMAT: ITERATE DO EXAMPLE: 10 DO/ INPUT 'Your name, please': NAME$ Ë$ IF _EXIT THEN EXIT DO. IF NAME$='SKIP' THEN ITERATE DO% PRINT 'Hello, '; NAME$ LOOP 20 ENDDITERATE DO skips part of the body of a loop. When INTOUCH executes Fthe ITERATE DO, it skips to the LOOP statement. Any code between the FITERATE DO and the LOOP statement will not be executed. If ITERATE DO5is in a nested loop, it iterates the loop it lies in. 6 ExampleEXAMPLE: 10 DO 3 INPUT 'Your nameÌ, please' : NAME$' IF _EXIT THEN EXIT DO3 IF NAME$ = 'SKIP' THEN ITERATE DO( PRINT 'Hello, '; NAME$ LOOP 20 PRINT 'FINISHED' 30 END RNH$ Your name, please? Fred Hello, Fred$ Your name, please? SKIP$ Your name, please? EXIT FINISHED  INTOUCH 4 FOR\NEXT>FORMAT: FOR num_var = num_expr1 TO num_expr2 [ST ÍEP num_expr] --- block of code NEXT num_var"EXAMPLE: See example topic below.BThe FOR loop lets you repeat a block of code a specified number ofEtimes. Num_var is the index variable. Num_expr1 specifies the numberDat which to begin counting. Num_expr2 specifies the number at whichDto stop counting. STEP specifies the increment to count by (the de-Ffault is 1). When the count exceeds num_expr2, INTOUCH stops executing@the loop and transfers control to the statÎement following NEXT. 5 ExampleEXAMPLE: 5 DIM NAME$(4) 10 FOR J=1 TO 4 INPUT NAME$(J)( PRINT 'Hello, '; NAME$(J) NEXT J 20 PRINT 'FINISHED'$ PRINT 'Final value:'; J 20 END5 Detailed_explanationFFOR marks the beginning of the loop and determines how many times the Eloop is repeated. NEXT marks the end of the loop. The block of codeEbetween the FOR and NEXT statements is executed eaÏch time the loop is repeated.  index variable |0 FOR J = 1 TO 4 -- limit expression /" initial expressionBThe index variable keeps track of how many times the loop has been?executed. The initial expression is the number INTOUCH begins Fcounting at. The limit expression is the number it stops counting at.?In the above example, INTOUCH counts from 1 to 4. So the loop executes 4 times. 5 EXIT_FORĞFORMAT: EXIT FOREXAMPLE: 10 FOR I=1 TO 5/ INPUT 'Your name, please': NAME$% IF _EXIT THEN EXIT FOR% PRINT 'Hello, '; NAME$ NEXT I 20 PRINT 'FINISHED' 30 ENDDEXIT FOR exits the FOR loop. When the EXIT FOR is executed, controlDtransfers the first statement after the matching NEXT statement. IfCEXIT FOR is used within nested loops, it exits the loop it lies in. 6 ExampleEXAMPLE: 10 FOR I=1 TO 5Ñ/ INPUT 'Your name, please': NAME$% IF _EXIT THEN EXIT FOR% PRINT 'Hello, '; NAME$ NEXT I 20 PRINT 'FINISHED' 30 END RNH! Your name, please? Fred Hello, Fred! Your name, please? EXIT FINISHED INTOUCH 5 REPEAT_FORFORMAT: REPEAT FOREXAMPLE: 10 FOR I=1 TO 10 PRINT I/ INPUT 'Your name, please': NAME$* Ò IF NAME$='' THEN REPEAT FOR% PRINT 'Hello, '; NAME$ NEXT I 20 ENDDREPEAT FOR repeats all or part of a FOR loop. When INTOUCH executes@the REPEAT FOR, it jumps to the first statement after the FOR. FIf REPEAT FOR is used within nested loops, it repeats the loop it liesGin. INTOUCH does not increment the index variable when the REPEAT FOR is executed. 6 ExampleEXAMPLE: 10 FOR I=1 TO 10 PRINT I/ INPUT 'Your nÓame, please': NAME$* IF NAME$='' THEN REPEAT FOR% PRINT 'Hello, '; NAME$ NEXT I 20 END RNH 1! Your name, please? Fred Hello, Fred 2 Your name, please? 2 Your name, please? INTOUCH 5 ITERATE_FORFORMAT: ITERATE FOR EXAMPLE: 10 FOR I=1 TO 10 PRINT I/ INPUT 'Your name, please': NAME$1 Ô IF NAME$ = 'SKIP' THEN ITERATE FOR% PRINT 'Hello, '; NAME$ NEXT I 20 ENDDITERATE FOR skips part of the body of a loop. When INTOUCH executesCthe ITERATE FOR, it skips to the NEXT statement. Any code between BITERATE FOR and the NEXT will not be executed. If ITERATE FOR is :used within nested loops, it iterates the loop it lies in. 6 ExampleEXAMPLE: 10 FOR I=1 TO 10 PRINT I/ INPUT 'Your name, please': NAMEÕ$1 IF NAME$ = 'SKIP' THEN ITERATE FOR% PRINT 'Hello, '; NAME$ NEXT I 20 END RNH 1! Your name, please? Fred Hello, Fred 2! Your name, please? SKIP 3 Your name, please?3 Conditionals@Conditionals execute statements or blocks of code depending on aFspecified condition. There are two types of conditionals: the IF THENEconstruct and the SELECT CASE co Önstruct. IF THEN is useful when you Eneed to check one or more conditions and execute a different block ofFcode depending on the result. SELECT CASE is useful when you need to :compare a different block of code for each possible match. 4 SELECT_CASEFORMAT: SELECT CASE main_expr CASE expr1, expr2... --- block of code> [CASE IS {numeric function | boolean function} expr3$ --- block of code...] [CASE ELSE$ --- blo ×ck of code ] END SELECT"EXAMPLE: See example topic below.DINTOUCH compares the main expression with the CASE expressions. If aECASE expression matches, INTOUCH executes the code following the CASEFstatement. Any number of CASE statements may be included. Any numberFof expressions may be specified with each CASE statement. Options and)rules are described in the topics below. 5 Rules=1) The main expression and all CASE expressions must be the = same data type. If Øthe data types don't match, an error  is generated.<2) If the main expression is an integer and a real numeric A CASE expression is given, the CASE expression is rounded and $ the integer portion is compared.13) There must be at least one CASE expression. @4) If none of the CASE expressions match (and there is no CASE % ELSE), an exception is generated. 5 CASE_ELSE;CASE ELSE executes a block of code only if none of the CASEFexpressions match. CASE ELSE must folÙlow the last CASE statement. IfCnone of the CASE expressions matches, INTOUCH executes the block of(code following the CASE ELSE statement. 10 DO6 INPUT 'Procedure (ADD, DEL, EXIT)' : PRO$ 20 SELECT CASE PRO$ CASE 'ADD'" PRINT 'Adding...'# CASE 'DEL', 'DELETE'$ PRINT 'Deleting...' CASE 'EXIT' EXIT DO CASE ELSEE MESSAGE ERROR: 'PÚrocedure must be: ADD, DEL or EXIT' REPEAT DO END SELECT LOOP 30 END 5 CASE_ISALets you form a conditional expression to be checked against the 6main expression. The format of the CASE IS option is:9 CASE IS {numeric function | boolean function} expr@If the expression in the CASE IS and the main expression match, ?the block of code following the CASE IS executes. For example: 10 DO3 INPUT 'Your iÛncome per year': INCOME! 20 SELECT CASE INCOME CASE = 0 & PRINT "No income?!" CASE IS <0+ PRINT "You are in debt!" CASE IS >0 5 PRINT "A positive income. Great!" END SELECT LOOP 30 END 5 ExampleEXAMPLE: 10 DO3 INPUT 'Your income per year': INCOME! 20 SELECT CASE INCOME CASE 0%Ü PRINT "No income?" CASE IS <0? PRINT "A negative income? You are in debt!" CASE IS >0 - PRINT "A positive income." END SELECT LOOP 30 END 4 IF\THEN6FORMAT: IF cond_expr THEN statement [ELSE statement] or  IF cond_expr1 THEN --- block of code! [ELSEIF cond_expr2 THEN$ --- block of coİde...] [ELSE$ --- block of code ] END IF"EXAMPLE: See example topic below.<IF\THEN is described under the topics "Block_construct" and "Single_line". 5 Single_line6FORMAT: IF cond_expr THEN statement [ELSE statement]1EXAMPLE: 10 INPUT PROMPT 'Enter your age: ': AGE< 20 IF AGE < 20 THEN LINE$ = 'A.' ELSE LINE$ = 'B.'. 30 PRINT 'Please go to line '; LINE$ 40 ENDCIf the conditional expression (cond_expr) is TRUŞE, INTOUCH executesAthe statement following the THEN. If the ELSE option is used andDthe conditional expression is false, INTOUCH executes the statement Cafter the ELSE. Statements following the THEN and the ELSE must be#complete, legal INTOUCH statements.5 Block_constructFORMAT: IF cond_expr1 THEN --- block of code! [ELSEIF cond_expr2 THEN$ --- block of code...] [ELSE$ --- block of code ] END IF"EXAM ßPLE: See example topic below.EThe block construct must begin with an IF\THEN statement and end withDan END IF statement. If the conditional expression is TRUE, INTOUCHDexecutes the block of code following the THEN. If the expression isFFALSE, INTOUCH either executes the block of code following the ELSE orCskips to the statement following the END IF. ELSEIF may be used to>set up a new condition. It has the same format as the IF\THEN>statement. If the condition set up by ELSEIF is TRUE,à INTOUCHFexecutes the code following the ELSEIF. Any number of ELSEIF's may beused. 5 Example1EXAMPLE: 10 INPUT PROMPT 'Enter your age: ': AGE2 INPUT PROMPT 'Enter your sex: ': SEX$5 20 IF SEX$[1:1]='M' THEN GOTO 40 ELSE PRINT 30 IF AGE < 20 THEN, PRINT 'Please go to line A.'/ ELSEIF AGE > 19 AND AGE < 40 THEN , PRINT 'Please go to line B.' ELSE, PRINT 'Please go to line C.' á END IF 40 END RNH Enter your age: 19 Enter your sex: Female Please go to line A. INTOUCH3 SET1FORMAT: SET [#chnl_num | STRUCTURE]: set_optionEXAMPLE: 10 PRINT 1,2,3,4,5 20 SET ZONEWIDTH 10 PRINT 1,2,3,4,5 30 ENDDSET sets various device characteristics from within your programs. GChnl_num is the optional channel number associated with the device you Fwant to set. If n âo channel number is given, INTOUCH sets the default @device (the terminal). When a device characteristic is set, it @remains set until the device is closed or another SET statement @is used. Set_option specifies which option to use with the SET Bstatement. The STRUCTURE option and set options are listed below. 4 STRUCTUREDFORMAT: SET STRUCTURE struc_name: struc_option [num_var | str_var]5EXAMPLE: 10 OPEN STRUCTURE CL: NAME 'TTI_RUN:CLIENT'! 20 INPUT 'Record': REC$ ã 30 FOR I = 1 TO 9999- SET STRUCTURE CL: CURRENT REC$C PRINT CL(LAST); ','; CL(FIRST), CL(STATE), CL(PHONE) NEXT I 40 ENDAThe STRUCTURE option allows you to do structure manipulation. A Dstructure option must be used with the SET STRUCTURE statement. The7structure options currently available are listed below. 5 CURRENT3FORMAT: SET STRUCTURE struc_name: CURRENT str_var5EXAMPLE: 10 OPEN STRUCTURE CL: NAME 'TTI_RUN:CLIENT'! ä 20 INPUT 'Record': REC$ 30 FOR I = 1 TO 9999- SET STRUCTURE CL: CURRENT REC$C PRINT CL(LAST); ','; CL(FIRST), CL(STATE), CL(PHONE) NEXT I 40 ENDFCURRENT sets the current record to that specified by the str_var. TheEstring variable contains the concept of current record for the recordEmanagement system the structure uses. The structure must be open andFthe str_var must contain a value stored with the ASK STRUCTURE CåURRENT statement.5 FIELD_Option>FORMAT: SET STRUCTURE struc_name, FIELD field_name: item varEXAMPLE: See KEY option below.@The FIELD option lets you specify a field in a structure. This Boption is currently used in conjunction with the KEY option. The Ffield name must be specified exactly as it appears in the structure. C(Use CALL SETUP's SHOW DEFINITIONS procedure to view field names.) 6 KEY_OptionBFORMAT: SET STRUCTURE struc_name, FIELD field_name: KEY str_expr:EXAMPLE: æ 10 OPEN STRUCTURE CLIENT: NAME 'TTI_RUN:CLIENT'+ 20 LINE INPUT 'Enter an ID': ID$< 30 SET STRUCTURE CLIENT, FIELD CLIENT_ID: KEY ID$% IF _EXTRACTED = 0 THEN* MESSAGE ERROR: 'Not found' ELSE" PRINT CLIENT(NAME) END IF 40 END?The FIELD option is used to specify a field to search. The KEYBoption is used to specify the key to look for. The unique key is >contained in the string exprçession. The KEY must be a string expression. 4 ZONEWIDTH-FORMAT: SET [#chnl_num:] ZONEWIDTH num_exprEXAMPLE: 10 PRINT 1,2,3,4,5 20 SET ZONEWIDTH 10 PRINT 1,2,3,4,5 30 ENDDSets the width of the device's print zones. Num_expr specifies the )width to set the device's print zones at.4 MARGIN*FORMAT: SET [#chnl_num:] MARGIN num_expr#EXAMPLE: 10 PRINT REPEAT$('.',200) PRINTA 20 INPUT 'What do you want the margin set èat': NEW_MARG 30 SET MARGIN NEW_MARG# 40 PRINT REPEAT$('.',200) 50 ENDBSets the right margin on the device specified. Num_expr specifies the column to set the margin to. 4 AUTOEXITFORMAT: SET AUTOEXIT num_exprEXAMPLE: 10 SET AUTOEXIT 1 20 DO INPUT "Who": A$1 IF _EXIT OR _BACK THEN EXIT DO 30 LOOP  PRINT "Finished" 40 END D Use to slowly back an end-useér out of a program if the terminal is -left idle. Num_expr is expressed in seconds.4 PORTFORMAT: SET PORT ON | OFF4EXAMPLE: 10 PRINT 'ABOUT TO PRINT MY PRINTER PORT' 20 SET PORT ON1 PRINT 'THIS IS ON THE PRINTER PORT' SET PORT OFF. 30 PRINT 'BACK TO THE SCREEN AGAIN' 40 END' Use to turn the printer port on or off 4 _ERROR FORMAT: SET ERROR ON | OFFEXAMPLE: 10 SET ERROR OFF 20 DO/ ê LINE INPUT "Enter the age": AGE IF AGE < 1 THEN* PRINT "Too young: "; AGE SET ERROR ON END IF 30 LOOP WHILE_ERROR 40 ENDE Use to set and clear the _error flag. The following methods can be used to CLEAR the _error flag: o SET ERROR OFF' o GOSUB or DISPATCH statement' o WHEN EXCEPTION IN statement9The following methods can be used to SET the _error flag:ë o SET ERROR ON$ o MESSAGE ERROR: statement/ o execution of the END WHEN statement3 ASK9FORMAT: ASK [#chnl_num | STRUCTURE]: ask_option num_var6EXAMPLE: 10 OPEN #3: NAME "STORAGE.DAT", ACCESS OUTIN 20 ASK #3: ZONEWIDTH X7 PRINT 'The current print zone width is'; X 30 CLOSE #3 40 ENDEASK returns various characteristics of a device and stores the value Kin a numeric variable. Chnl_num is the optional channel ì number associated Awith the device you want to know about. If no channel number is Igiven, the default device is used (the terminal). Num_var is the numeric Dvariable the information is assigned to. A numeric variable must beGspecified with ASK. Ask_option specifies the option to use with ASK. 9The STRUCTURE option and ask_options are described below. 4 STRUCTUREDFORMAT: ASK STRUCTURE struc_name: struc_option [str_var | num_var]!EXAMPLE: See EXAMPLE topic belowAUse the STRU íCTURE option to ask about characteristics of INTOUCH Dstructures. Struc_name is the name of the structure you are asking Aabout. Struc_option is one of the structure options below. The Dstructure must be open for the ASK STRUCTURE statement to work. The#options available are listed below.5 FIELD_Option2FORMAT: ASK STRUCTURE struc_name: FIELDS num_var5EXAMPLE: 10 OPEN STRUCTURE CL: NAME 'TTI_RUN:CLIENT'0 20 ASK STRUCTURE CL: FIELDS NUM_FIELDS$ FOR I = 1 TO NUîM_FIELDS CLEAR< ASK STRUCTURE CL, FIELD #I: DESCRIPTION DESC$9 ASK STRUCTURE CL, FIELD #I: PROMPT PROMPT$ PRINT AT 5,5: "", PRINT "Description :"; DESC$. PRINT "Prompt :"; PROMPT$ NEXT I 30 CLOSE STRUCTURE CL 40 ENDAFields returns the number of fields in the structure named. This5number is assigned to the numeric variable specified. 6 FIELD_items>FORMAT: ï ASK STRUCTURE struc_name: FIELD field_expr: item var7EXAMPLE: ASK STRUCTURE CL: FIELD #3: PROMPT PROMPT$(3)@The FIELD option allows you to get information about a specific Afield in a structure. Struc_name is the name of the structure. AField_expr is the field you are inquiring about. Item specifies Awhich information to obtain about the field. The information is "stored in the variable specified. 7 NUMBER NUMBERB Stores the field number of this field in the numericğ variable 1 specified. Fields are numbered sequentially.> ASK STRUCTURE struc_name, FIELD field_expr: NUMBER num_var7 NAME NAME" Returns the name of the field.= ASK STRUCTURE struc_name, FIELD field_expr: NAME str_var 7 DESCRIPTION DESCRIPTION? Stores the description for this field in the string variable specified A ASK STRUCTURE struc_name, FIELD field_expr: DESCRIPTION str_var7 PROMPT PROMPT< Stores the prompt for this field in ñthe string variable  specified. > ASK STRUCTURE struc_name, FIELD field_expr: PROMPT str_var 7 DATATYPE DATATYPE9 Returns the INTOUCH datatype such as CH (character),  IN (integer), etc.@ ASK STRUCTURE struc_name, FIELD field_expr: DATATYPE str_var 7 ATTRIBUTES ATTRIBUTESB Returns the INTOUCH attributes NUM (number), UC (upper-case),  etc.F ASK STRUCTURE struc_name, FIELD field_expr: ATTRIBUTES str_var 7 HEADING HEADING= òStores the heading for this field in the string variable  specified. ? ASK STRUCTURE struc_name, FIELD field_expr: HEADING num_var 7 PRINTMASK PRINTMASK@ Stores the print mask for this field in the string variable  specified. A ASK STRUCTURE struc_name, FIELD field_expr: PRINTMASK num_var 7 SCREENMASK SCREENMASKA Stores the screen mask for this field in the string variable  specified. B ASK STRUCTURE struc_name, FIELD field_expr: SCREENóMASK str_var7 HELP HELP? Stores the help text for this field in the string variable  specified. < ASK STRUCTURE struc_name, FIELD field_expr: HELP str_var 7 POSITION POSITION? Stores the starting position for this field in the numeric  variable specified. @ ASK STRUCTURE struc_name, FIELD field_expr: POSITION num_var7 LENGTH LENGTH< Stores the length of this field in the numeric variable  specified. > ASK STRUCTURE struc_nameô, FIELD field_expr: LENGTH num_var7 KEYS KEYS> Returns the number of keys that are accessible by INTOUCH.< ASK STRUCTURE struc_name, FIELD field_expr: KEYS str_var7 KEYED KEYED= ASK STRUCTURE struc_name, FIELD field_expr: KEYED num_var= Returns a value of true or false in the numeric variable ? specified. If it is a keyed field, then the value is true; otherwise, it is false. 7 Example6 10 OPEN STRUCTURE CL: NAME 'TTI_RUN:CLIENT'1 õ 20 ASK STRUCTURE CL: FIELDS NUM_FIELDS% FOR I = 1 TO NUM_FIELDS CLEAR= ASK STRUCTURE CL, FIELD #I: DESCRIPTION DESC$: ASK STRUCTURE CL, FIELD #I: PROMPT PROMPT$6 ASK STRUCTURE CL, FIELD #I: HELP HELP$ PRINT AT 5,5: ""- PRINT "Description :"; DESC$/ PRINT "Prompt :"; PROMPT$- PRINT "Help text :"; HELP$ ; ö KEY INPUT 'Press space bar', AT 17,20: HIT$ NEXT I 30 CLOSE STRUCTURE CL 40 END6 FIELD_expressions; The field_expr may be given as either a string or numeric @expression. You may use a string constant to specify the field Aname. If you give the field name as a string constant, you need not enclose it in quotes. ?If you specify the field as numeric expression or other than a @string constant, you will need to precede the expression w ÷ith a =pound sign. The pound sign tells INTOUCH that the following Ccharacters are not to be interpreted as the field name. If you do Bnot include the pound sign, INTOUCH will interpret the characters as a field name.5 ASK STRUCTURE CL, FIELD #FIELDNAME$: DESCRIPTION A$ /7 the field is specified by the variable FIELDNAME$3 ASK STRUCTURE CL, FIELD #FIELDNUM: DESCRIPTION A$ /6 the field is specified by the variaøble FIELDNUM 5 CURRENT3FORMAT: ASK STRUCTURE struc_name: CURRENT str_var!EXAMPLE: See EXAMPLE topic below?CURRENT assigns the current record to the str_var. The string ?variable contains the concept of current record for the record Dmanagement system the structure uses. The structure must be open. @Once the current record is assigned with ASK STRUCTURE CURRENT, :it can be accessed with a SET STRUCTURE CURRENT statement. 6 Example5 10 OPEN STRUCTURE CL: NAME 'TTI_ùRUN:CLIENT'! 20 EXTRACT STRUCTURE CL. PRINT CL(LAST); ', '; CL(FIRST)C INPUT "Would you like to see this record (Y/N)": YN$ IF YN$ = "Y" THEN LET I = I + 10 ASK STRUCTURE CL: CURRENT A$(I) END IF END EXTRACT 30 PRINT FOR J = 1 TO I. SET STRUCTURE CL: CURRENT A$(J)C PRINT CL(LAST); ','; CL(FIRST), CL(STATE), CL(PHONE) ú NEXT J 40 END 4 ZONEWIDTH,FORMAT: ASK [#chnl_num:] ZONEWIDTH num_var7EXAMPLE: 10 OPEN #3: NAME "STORAGE.DAT", ACCESS OUTPUT 20 ASK #3: ZONEWIDTH X7 PRINT 'The current print zone width is'; X 30 CLOSE #3 40 ENDIAsks for the width of the device's print zones. Num_var is the variable &the zone width should be assigned to. 4 MARGIN)FORMAT: ASK [#chnl_num:] MARGIN num_var#EXAMPLE: 10 PûRINT REPEAT$('.',200) PRINTA 20 INPUT 'What do you want the margin set at': NEW_MARG 30 ASK MARGIN X6 IF X <> NEW_MARG THEN SET MARGIN NEW_MARG# 40 PRINT REPEAT$('.',200) 50 ENDCAsks for the right margin setting on the device specified. Num_varAis the variable to which the character position of the margin is assigned. 4 CURRENT+FORMAT: ASK [#chnl_num:] CURRENT str_exprEASK CURRENT is used to store a currentü record value into the str_var. 5 Example5 1 OPEN #1: NAME "TEMP.TMP", ACCESS OUTPUT 2 FOR Z1 = 1 TO 50% PRINT #1: "Line "; Z NEXT Z 3 CLOSE #1& 10 OPEN #1: NAME "TEMP.TMP" 20 FOR I = 1 TO 10! 25 LINE INPUT #1: A$ 30 NEXT I* 40 PRINT "Tenth item was: "; A$ 100 ASK #1: CURRENT C$ 120 FOR I = 1 TO 10! 130 LINE INPUT #1: A$ 1ı40 NEXT I* 150 PRINT "20th item was: "; A$ 200 SET #1: CURRENT C$ 210 LINE INPUT #1: A$3 220 PRINT "Back to 10th item again: "; A$ 230 CLOSE #1 999 END 3 Calling_routines@INTOUCH's CALL and LIBRARY statements allow you to call routinesCwritten in other languages from your INTOUCH programs. The LIBRARYEstatement is used to tell INTOUCH what library the routine is locatedEin. You must use the LIBRARY statement to spe şcify where routines areBlocated before you call them in your program. The CALL statement Dis used to call routines and execute them. CALL can be used to call ?any routine in a shared VMS library and execute it. The systemAfunctions _REAL and _INTEGER may be used in conjunction with CALL and LIBRARY.4 Making_Libraries?1. Write your source code using EDT or the VAX editor of your ? choice. The source code may be in VMS provided language. 4 Your file may contain any number of suÿbprograms.=2. Compile your source code with the appropriate compiler. H3. Give the VAX a LINK command. Specify OPTIONS in the link command. 3 $ LINK/SHARE routine_name, TT:/OPTIONSD4. You will not see any prompt at this point. Enter the universal B option. You will need to use the universal option to specify . the subprograms contained in your routine:3 UNIVERSAL=subprogram [, subprogram...] 4 Use the CTRL/Z command when you have finished. 3You may now use this routine from within INTOUCH. 4 LIBRARYFORMAT: LIBRARY "libr_name"#EXAMPLE: See example topic below.FUsed to specify libraries from which routines are CALLed. The routinesBcan be written in any VMS language (FORTRAN, BASIC, COBOL, etc.). FLibr_name is the name of a library. The library may be one of the VMSBsupplied libraries, or a user-defined library. You must define aFlibrary with the LIBRARY statement before you call a r outine from it. FThe library name must be given as a string constant in quotes. You canDhave any number of LIBRARY statements in a program. When you call aDroutine, each library specified is checked in turn for the routine. 5 ExampleEXAMPLE: 10 LIBRARY 'BASRTL'* 20 PRINT 'Waiting 5 seconds...') 30 CALL BAS$SLEEP(5% BY VALUE) 40 END5 Making_Libraries?1. Write your source code using EDT or the VAX editor of your ? choice. The source code may be in VMS provided language. 4 Your file may contain any number of subprograms.=2. Compile your source code with the appropriate compiler. H3. Give the VAX a LINK command. Specify OPTIONS in the link command. 3 $ LINK/SHARE routine_name, TT:/OPTIONSD4. You will not see any prompt at this point. Enter the universal B option. You will need to use the universal option to specify . the subprograms contained in your routine:3 UNIVERSAL=subprogram [, subprogram...] 4 Use the CTRL/Z command when you have finished. 3You may now use this routine from within INTOUCH. 4 CALL_statement9FORMAT: CALL routine_name([arg [BY pass_mech], arg...])"EXAMPLE: See example topic below.FCalls and executes a routine from a library. The library to which the@routine belongs must have been specified in a LIBRARY statement.DRoutine_name is the name of the routine being called. Arg specifiesFan optional argument bei ng passed to the routine. The routine must beEpassed all the arguments that it requires. If more than one argumentDis passed, separate the arguments with commas. The system functions>_REAL and _INTEGER can be used in conjunction with the libraryFstatements. These functions return resulting data associated with theCALL. 5 Making_Libraries?1. Write your source code using EDT or the VAX editor of your ? choice. The source code may be in VMS provided language. 4 Your file may contain any number of subprograms.=2. Compile your source code with the appropriate compiler. H3. Give the VAX a LINK command. Specify OPTIONS in the link command. 3 $ LINK/SHARE routine_name, TT:/OPTIONSD4. You will not see any prompt at this point. Enter the universal B option. You will need to use the universal option to specify . the subprograms contained in your routine:3 UNIVERSAL=subprogram [, subprogram...] 4 Use the CTRL/Z command when you have finished. 3You may now use this routine from within INTOUCH. 5 Optional_argumentsDTo pass an optional argument, include it in the appropriate place inDthe argument list. If you do not want to pass an optional argument,Bspecify that no argument is to be used by typing two commas at the5appropriate place in the argument list. For example:1 CALL routine_name(str_var,,num_var)DThe double commas tell INTOUCH that the optional variable prompt-stris not used. For example: ! 10 LIBRARY 'LIBRTL'& 15 BUF$=REPEAT$(" ",200)3 20 CALL LIB$GET_INPUT(BUF$,,OUT_LEN%)5 30 PRINT 'You typed: ';BUF$[1:OUT_LEN%] 40 END5 Pass_MechanismsDPass_mech refers to the mechanism by which values are passed to the Broutine. The default pass mechanism for reals and integers is by >reference. The default pass mechanism for strings is by desc.=Following is an explanation of t he pass mechanisms available:EBY REF By reference. This is the default pass mechanism for< real and integer data. Arguments passed by A reference may be changed by the routine they are  passed to.@BY VALUE By value. Arguments passed by value may not be : changed by the routine they are passed to.BBY DESC By descriptor. This is the default pass mechanismA for strings. This pass mech anism should only be C used with strings. By descriptor causes INTOUCH to? use the argument's descriptor when passing the B argument. Arguments passed by desc may be changed2 by the routine they are passed to. 5 ExampleEXAMPLE: 10 LIBRARY 'BASRTL') 20 PRINT 'Waiting 5 seconds...'( 30 CALL BAS$SLEEP(5% BY VALUE) 40 END3 CHAINFORMAT: CHAIN "file_spec"8EXAMPLE: 10 LINE INPUT 'Your name  (last, first)': NAME$7 20 OPEN #1: NAME 'STORAGE.TMP', ACCESS OUTPUT PRINT #1: NAME$ CLOSE #19 30 INPUT 'Add to CLIENT structure (Y/N)': ANSW$, IF ANSW$ = 'Y' THEN CHAIN "ADD" 40 ENDACHAIN exits the current program and runs the program specified. HControl does not return to the original program. When INTOUCH executes Ethe CHAIN statement, it closes all active output buffers, closes all Gfiles, and releases all storag e. INTOUCH does not pass any variables, Ffunctions, etc. from the previous program. INTOUCH does not return to9the current program when the chained program is finished.3 FilesCFiles are places where information is stored. You can access filesGfrom within your INTOUCH programs and store and remove information fromthem.FYou will need to open your files before you can read data from them orHwrite data to them. You must close your files before your program ends.GEach file must  have a filename and a channel number associated with it.4 OPEN=FORMAT: OPEN #chnl_num: NAME "filename" [, ACCESS {INPUT |  OUTPUT | OUTIN} ]6EXAMPLE: 10 OPEN #1: NAME 'LEDGER.LIS', ACCESS OUTPUT8 20 PRINT #1: 'This is the first line of text.'9 30 PRINT #1: 'This is the second line of text.' 40 CLOSE #1 50 ENDFOPEN is used to open an INTOUCH file. You must open your files beforeFyou read information from them or write inform ation to them. Chnl_numBis the channel number associated with the file. You must assign aFchannel number to each file you open. Filename is the name of the fileEyou are opening. Each file must have a file name. The ACCESS optionCtells the type of access you are opening the file for. The defaultACCESS is INPUT. 5 File_namesDFile names are names you give to the files you use. Each file must Fhave a file name. INTOUCH uses this file name to identify the file. FINTOUCH file names follow the VAX\VMS rules. A legal file name looks like this: filename.extA Filename is the file name and ext is the extension. You do not Bhave to specify an extension. If you don't specify an extension, 1INTOUCH uses the default ".INT". Your file name:> o may be up to, but not longer than 64 characters6 o must start with a letter [A...Z, a...z]1 o may consist of letters and numbers, o may be in upper or lower case Your extension: / o must be preceded by a period (.)> o may be up to, but not longer than, 3 characters5 o must consist of letters [A...Z, a...z]5 ACCESS ACCESS INPUT:? o Input only. Data can only be read from the file. B o If the file doesn't exist, an exception is generated.ACCESS OUTPUT:= o Output only. Data can be stored in the file or ; deleted from it. Data cannot be read from it.B o When the text fil e is opened, the default line lengthB is 132. If you need the line length to be other than; 132, then you must use the SET MARGIN command.C o If the file exists, INTOUCH creates a new version and @ uses that new version. If the file doesn't exist, = INTOUCH creates a file with the file spec given. ACCESS OUTIN:> o Output and input. Data can be read, deleted and  added.? o If the file exists, I NTOUCH opens the most recent F version and uses it. If the file doesn't exist, INTOUCH 5 creates a file with the file spec given.4 Channel_numbersCChannel numbers are numbers associated with open files or devices. FYou assign the number when you open the file. From that point on, theBchannel number is used to refer to the file. (That way, you don'tFhave to type a long filename every time you access the file.) ChannelCnumbers can be anywhere in the range of 1 to 99. (0 is the channelFnumber associated with the terminal. You cannot OPEN or CLOSE channelFnumber 0.) The channel number can be given as any numeric expression.FThe channel number you assign must not be associated with another openFfile. If your channel number is associated with another open file, anexception will result. 4 CLOSEFORMAT: CLOSE # chnl_num6EXAMPLE: 10 OPEN #1: NAME 'LEDGER.LIS', ACCESS OUTPUT0 20 PRINT #1: 'This is the first line.'1 30  PRINT #1: 'This is the second line.' 40 CLOSE #1 50 ENDBCLOSE closes a file from further access. You must close the file Cbefore your program ends. Once the file is closed, data cannot be Istored in it or read from it. Chnl_num is the channel number associated with the file. 4 PRINT3FORMAT: PRINT #chnl_num [, | ;] [TAB(col){, | ;}] 2 [expr {, | ;} [TAB(col) {, | ;}] expr...] or. PRINT #chnl_num: expr {, | ;} expr... @Writes data to a file. The file must be open and have a channel@number associated with it. Chnl_num can be given as any integerDexpression. The expression is optional. PRINT without an expressionFwrites a blank line to the file. Data is written sequentially startingCat the end of the file. Multiple expressions must be separated withFeither a comma or a semicolon. A comma causes the following expressionEto be written in its own print zone. A semicolon causes the followingFexpression to be written immediately after the previous expression. IfCan item is too long to write in one record, INTOUCH continues it inFthe next record. TAB may be used with PRINT. They are described in thetopics below. 5 TAB "The format of the TAB function is: TAB(col) FCol is the column to print at. TAB positions the cursor at the columnCspecified. TAB always causes forward tabbing. If the cursor is atCthe column specified or has already passed it, INTOUCH jumps to theEnext line. The TAB function is an expression. Therefore, it must be>separated from other expressions with a comma or a semicolon. : 5 OPEN #1: NAME "TEST.TMP", ACCESS OUTPUT= 10 PRINT #1: TAB(5);'Fred'; TAB(20);'MARY'; &# TAB(25);'John' PRINT #1: PRINT #1: 20 CLOSE #1 30 END 5 Example7EXAMPLE: 10 OPEN #1: NAME 'LEDGER.LIS', ACCESS OUTPUT9  PRINT #1: 'This is the first line of text.': PRINT #1: 'Here is the second line of text.'A PRINT #1: 'The third line has... tabs.' CLOSE #16 20 OPEN #1: NAME 'LEDGER.LIS', ACCESS INPUT- LINE INPUT #1: LINE_1$, LINE_2$" PRINT '1 '; LINE_1$" PRINT '2 '; LINE_2$ CLOSE #1 30 END RNH- 1 This is the first line of text.. 2 Here is the second line of text.  INTOUCH4 INPUT&FORMAT: INPUT #chnl_num: var, var...5EXAMPLE: 10 OPEN #1: NAME "NUMBER.DAT", ACCESS INPUT INPUT #1: NUM1 PRINT NUM1 20 CLOSE #1 30 ENDEINPUT gets data from a file. The file must be open. Chnl_num is theDchannel number associated with the file. The var's are the variablesAyou want the data to be assigned to. Data items must match theirCvariable types. INTOUCH inputs data sequentially starting from theEbeginning of the file. If an attempt is made to input more data than.the file contains, an exception is generated. 4 LINE_INPUT3FORMAT: LINE INPUT #chnl_num: str_var, str_var...5EXAMPLE: 10 OPEN #1: NAME "NUMBER.DAT", ACCESS INPUT, 20 LINE INPUT #1: LINE_1$, LINE_2$# PRINT LINE_1$, LINE_2$ 30 CLOSE #1 40 ENDDLINE INPUT reads a line of data from a file. The file must be open.=Chnl_num is the channel number associated with the file. TheFstr_var's are the string variables you are assigning the lines of dataEto. You must assign each line of data to a string variable. INTOUCHBwill accept everything from the beginning of the line to the firstAline terminator and assign it to a string variable. If a line isDempty, INTOUCH will assign the null string to your string variable. ELines are read sequentially starting from the beginning of the file. BIf you try to input more data than  the file contains, INTOUCH willgive an exception. 3 Inputting_dataE INTOUCH offers a variety of INPUT statements. These allow key levelCdata input validation, line input, and standard input. Each of theCINPUT statements also has a number of options available to enhance data input.4 INPUT5FORMAT: INPUT [DEFAULT str_expr] [,PROMPT str_text] 2 [,ELAPSED num_var] [,TIMEOUT time_limit] 7 [,LENGTH num_expr] [,VALID text_str, rule_str]7 [,SCREEN '[text] ...'] [:] var, var...&EXAMPLE: See the example topics below.BInputs data from a terminal and assigns it to variables. The data=type of the input data and the variable must match. MultipleEvariables must be separated by commas. If no data is entered, INTOUCHAassigns 0 to numeric variables and the null string ("") to stringEvariables. Options must separated from the variable list by a colon. ?INPUT by itself displays a question mark. A prompt text can beDdisplayed before the question mark by enclosing the text in quotes. CThe prompt text follows the keyword INPUT and is separated from theGvariable list by a colon. For more information, see the topics below. 5 ExampleBEXAMPLE: 10 INPUT PROMPT 'Name: ', DEFAULT 'Smith', ELAPSED X%, & TIMEOUT 60: NAME$ 20 PRINT NAME$% PRINT 'Elapsed time'; X% 30 END 5 StringsEIf the user is inputting to a string variable, the user can respond Cby entering an unquoted or a q uoted string. If the user enters an >unquoted string, INTOUCH ignores any leading spaces, trailing ?spaces, or tabs. An unquoted string cannot contain any commas.@If the user enters a quoted string, INTOUCH includes any leadingor trailing spaces and tabs.5 Multiple_variablesAMore than one variable can be assigned with an INPUT statement. 9Variables must be separated by commas. INTOUCH asks for ;input until all variables have values. If the user enters >more data than there are variables, an exception is generated.0Users can enter the data for a variable list by:7 o entering each piece of data on a separate line  with trailing commas@ o entering all the data on one line with separating commas5 PROMPTEDisplays a prompt text without a trailing question mark. The format #of INPUT with the PROMPT option is:- INPUT PROMPT str_expr: var, var...@Str_expr contains the prompt text. It can be any legal INTOUCH Dstring expression. Se parate the prompt text from the variable list Dwith a colon (:). INTOUCH will print the prompt text exactly as it Eis specified. INTOUCH will ^@not\@ print a question mark or a space .after the text when the PROMPT option is used./ 10 INPUT PROMPT 'Your name: ': NAME$ 20 PRINT NAME$ 30 END RNH Your name: FRED FRED INTOUCH 5 DEFAULTBProvides a default for the INPUT statement. INTOUCH automaticallyDfo !rmats the default to fit the INPUT statement. User's press RETURNCto keep the default. The cursor control keys, delete key, linefeed@key and those listed in Table 1-2 of the Command Language ManualF(Volume 2) of the Version 4.0 VAX/VMS documentation set may be used by/the user to modify the default. The format is:& INPUT DEFAULT str_expr: varEStr_expr is the default. It can be any legal INTOUCH expression. It$must match the variable's data type. 6 Example5EXAMPLE: 10" INPUT 'State code', DEFAULT 'CA': STATE$, 20 PRINT 'The state was: '; STATE$ 30 END RNH State code? CA The state was: CA 5 ELAPSEDBKeeps track of the time it takes the user to respond to the INPUT Dprompt. ELAPSED starts marking time when INTOUCH finishes printing Athe prompt. It stops marking time when all the variables listed Bin the INPUT statement have values. The format of INPUT with the ELAPSED option is:# INPUT ELAPSED num #_var: var, var...BThe elapsed time is assigned to the numeric variable specified. ItDmust be assigned to a numeric variable. INTOUCH returns the elapsedBtime in seconds. If a real numeric variable is specified, INTOUCH@will return the time to a hundredth of a second (1/100). If an=integer variable is specified, INTOUCH rounds the time to thenearest second. 6 Example,EXAMPLE: 10 INPUT 'Name', ELAPSED X: NAME$6 20 PRINT NAME$; ', your elapsed time is'; X 30 EN$D RNH Name? John* John, your elapsed time is 1.39 INTOUCH 5 TIMEOUTALimits the time the user has to respond to the INPUT prompt. If Dthe user does not complete the INPUT statement within the specified Gtime, an exception is generated. The format of INPUT with the TIMEOUT option is:7 INPUT ELAPSED num_var, TIMEOUT num_expr: varBNum_expr specifies the number of seconds allowed for a response. BFor example, TIMEOUT 30 would %give the user exactly 30 seconds to Center a name. Fractions of a second can be indicated by including decimal digits. 6 Example-EXAMPLE: 10 INPUT 'Name', TIMEOUT 30: NAME$ PRINT NAME$ 30 END5 LENGTHC Limits the number of characters that a user can typed. It causes :INTOUCH to follow the prompt with underscore characters. 6 Example- EXAMPLE: 10 INPUT 'NAME', LENGTH 20:NAME$/ 20 INPUT 'PHONE', LENGTH 15:PHONE$" 30 &PRINT NAME$,PHONE$ 40 END5 VALIDB Use to validate users responses according to the following rules: o NUMBER o INTEGER o YES/NO o DATE o DATE:MDY5 SCREENCCreates formatted data entry screens. The format of INPUT with theSCREEN option is: ; INPUT SCREEN '[text] ...': var, var...?Any legal INTOUCH variable may be used with SCREEN. The quotes>contain an optional prompt text and the fo 'rmat (or edit mask).=The format defines the fill_in area. It must be enclosed in Fless than and greater than signs (<>). Several commands may be used Ewithin the format to control the display and use of the fill-in area.CThese commands are: format options and format characters. Format Doptions occur first within the format and are followed by a colon. 'Format characters come after the colon:3 6 Format_charactersBThere are three (format characters available: the # for inputting Dnumeric characters, the @ for inputting string characters (includingCnumbers), and the ^ for inputting capital letters. An input screenAcan be created with just these characters. If no format options Dare used, place a colon after the first angle bracket in the format:9 10 INPUT SCREEN '<:(###) ###-####>': PHONE 20 PRINT PHONE 30 END RNH (555) 554-7879 ) INTOUCH8The format characters are described in the topics below.7 #9Specifies numeric characters, the minus sign (-), and the5decimal point (.). Wherever the # sign appears, only;numeric characters will be allowed as input. For instance,0a # might be used to get a user's phone number: 9 10 INPUT SCREEN '<:(###) ###-####>': PHONE 20 PRINT PHONE 30 END7When INTOUCH executes this program, it will display thefollowing fill*-in area:  RNH (___) ___-____<The user could enter any number, a minus sign or a period in4this field. INTOUCH would not allow the user to type4letters, or anything other than numeric characters. 7 @:Used to specify any printable character, including lettersand numbers. For example: @ 10 INPUT SCREEN 'License #: <@@@ @@@@>': LICENSE$- 20 PRINT 'License: '; LICENSE$ 30 END:This program inputs a license nu+mber using the format '@@@;@@@@'. The user could enter any seven characters. INTOUCH8will assign whatever characters they enter to LICENSE$.  RNH" License #: INF 5783 License: INF5783 INTOUCH7 ^:The ^ is used to specify an uppercase letter. If a number<input is a lowercase letter, INTOUCH changes it to uppercase:and echoes it to the terminal in uppercase. For example: @ 10 INPUT SCREEN 'First name: <^@@@@@@@@@@,@@@@>': FIRST$8 INPUT SCREEN 'Middle initial: <^>.': MIDDLE$@ INPUT SCREEN 'Last name: <^@@@@@@@@@@@@@@@@>': LAST$3 20 PRINT FIRST$; ' '; MIDDLE$; '. '; LAST$ RNH First name: John Middle initial: B. Last name: Smithy John B. Smithy INTOUCH6 Format_optionsEThere are six format options. If format options are used, they must Ebe placed before the format characters and followed by a colon. The Bfo -llowing format options are available: UCASE, LCASE, DIGITS, AJ,DREQ and AT. These options are described in the topics listed below.7 UCASE ;Uppercases all letters that are typed. If the user types a;letter in lower case, it is changed to uppercase and echoed;to the terminal in uppercase. Letters entered in the field2will be upper-cased and assigned to the variable. & 10 PRINT "Type in lowercase!"> 20 INPUT SCREEN '': TEXT$. 30 PRIN.T 'Here is your text: '; TEXT$ 40 END RNH Type in lowercase! JOHN B. SMITHY* Here is your text: JOHN B. SMITHY INTOUCH7 LCASE;Lowercases all letters that are typed. If the user types a:letter in uppercase, it is changed to lowercase and echoed8to the terminal. Any letter entered in the field will be7lower-cased and assigned to the variable in lowercase. & 10 PRINT 'Type in uppercase!'> 20 INPUT SCREEN '': TEXT$. 30 PRINT 'Here is your text: '; TEXT$ 40 END RNH Type in uppercase! john b. smithy* Here is your text: john b. smithy INTOUCH7 DIGITS8Specifies that only digits may be entered in the field. 5(The format character # allows the minus sign and the8decimal point as well.) DIGITS allows only numbers to be entered. @ 10 INPUT SCREEN 'Phone: ': PHONE 0 20 PRINT PHONE 30 END RNH Phone: 555-6798 5556798 INTOUCH7 AJ;Causes INTOUCH to automatically jump to the next field when9the current one has been completely filled in. The field<must be completely filled in before INTOUCH will jump to the next field. 8 10 INPUT SCREEN 'Phone: ': PHONE< 20 INPUT SCREEN 'Soc. sec.: ': SOCIAL 30 PRINT PHONE, SOCIAL 410 END RNH Phone: 555-3839 Soc. sec.: 899-75-3432 5553839 899753432 INTOUCH<In the above program, when the user has completely filled in8the phone field, INTOUCH would automatically jump to thesocial security field. 7 REQ5Specifies that the field must be filled in and filled<entirely. Wherever the REQ option is used, a field will have;to be filled in. The user will not be able to skip it. The/field will also have to be filled in entirely. 7 AT5Th 2e AT option displays the field on the screen at the5position specified. The format of the AT option is: & AT row, column<AT must include a set of coordinates. Row specifies the row<to print at. Column specifies the column to print at. When:INTOUCH executes the AT option, it moves the cursor to the5row and column specified and prints the field at that location. 6 User_Response<When a single input screen statement is used, the following (keys may be used to 3complete the screen:;TAB Jumps to the next field in single input screen statements. B\ Returns to the previous field. Typing \ and pressing@ RETURN jumps the user back to the beginning of the  previous field.>RETURN Completes a data entry screen. If more than one B format is included in a screen option, when the user D has finished filling in all the fields, the RETURN key 1 is pressed to 4 complete data entry. 7 Single_input_screen_example A 10 A$ = "" + &A "" + &5 "" + &2 "" + &, "" 20 CLEAR8 INPUT SCREEN A$: NAME$, ADDR1$, CITY$, STATE$, ZIP$* MESSAGE 'Press SPACE BAR to continue' KEY INPUT B$ 30 CLE5AR PRINT AT 6,10: NAME$  PRINT AT 8,10: ADDR1$1 PRINT AT 10,10: CITY$;', ';STATE$;' ';ZIP$ 40 END 4 LINE_INPUT<FORMAT: LINE INPUT [PROMPT str_expr] [, TIMEOUT num_expr] 1 [, ELAPSED num_var] [, LENGTH num_expr]; [, DEFAULT str_expr] [, VALID text_str, rule_str]A [, SCREEN '[text] ...'] [:] str_var, str_var...,EXAMPLE: 10 LINE INPUT TIMEOUT 60: COMMENT$ PRINT COMMENT$ 20 ENDCReads a line of data fro6m the terminal. Str_var is the variable toDwhich the line of input data is assigned. A string variable must be<specified with LINE INPUT. With LINE INPUT, INTOUCH acceptsEeverything the user types, up until the RETURN key is pressed, as theBinput line. Tabs, commas, semicolons, and spaces are included and@assigned to the string variable. If no text is entered, the nullGstring ("") is assigned to the string variable. If multiple variables 9are used, INTOUCH asks for each input on a separ7ate line.CAll the options available with INPUT are available with LINE INPUT.See INPUT for more information. 4 KEY_INPUT>FORMAT: KEY INPUT [, PROMPT str_text] [, TIMEOUT time_limit]= [, ELAPSED num_var] [, SCREEN '[text] ...'  [:] var, var...BEXAMPLE: 10 KEY INPUT PROMPT 'Hit a key, quick!', ELAPSED X: HIT$ 20 PRINT@ PRINT 'You took '; X; ' seconds to hit '; HIT$; '.' 30 END@Inputs a keystroke and stores the value of8 the key in the stringCvariable specified. The keystroke is not echoed nor is a line feed6generated. The EXAMPLE program would run as follows:  RNH Hit a key, quick!) You took .4 seconds to hit j.  INTOUCH@The options available with INPUT are available with KEY INPUT. 3 Assigning_dataCINTOUCH supplies seven statements used to assign data to variables.=These are the standard LET statement, the LSET, RSET and CSETEstat9ements, and the READ\DATA and RESTORE statements. LSET, RSET andFCSET may only be used to assign string data. They are used to justify?the assigned string data. READ\DATA can only be used to assignconstant values. 4 LSET!FORMAT: LSET str_var = str_expr7EXAMPLE: 10 HEADING$ = REPEAT$('.', 20) ! twenty dots% 20 PRINT '('; HEADING$; ')'& 30 LSET HEADING$ = 'Page 12'% PRINT '('; HEADING$; ')' 40 ENDHWhen INTOUCH executes the LS:ET statement, it evaluates the expression onEthe right of the equal sign, assigns its value to the string variableDand sets it to the left most position. If the new value's length is@less than the old value's, INTOUCH pads it with trailing spaces. RNH (....................) (Page 12 ) INTOUCH4 RSET!FORMAT: RSET str_var = str_expr7EXAMPLE: 10 HEADING$ = REPEAT$('.', 20) ! twenty dots% 20 PRINT '('; HEADING$; ')'&; 30 RSET HEADING$ = 'Page 12'% PRINT '('; HEADING$; ')' 40 ENDHWhen INTOUCH executes the RSET statement, it evaluates the expression onEthe right of the equal sign, assigns its value to the string variableFand sets it to the right most position. If the new value's length is ?less than the old value's, INTOUCH pads it with leading spaces. RNH (....................) ( Page 12) INTOUCH4 CSET!FORMAT<: CSET str_var = str_expr7EXAMPLE: 10 HEADING$ = REPEAT$('.', 20) ! twenty dots% 20 PRINT '('; HEADING$; ')'& 30 CSET HEADING$ = 'Page 12'% PRINT '('; HEADING$; ')' 40 ENDHWhen INTOUCH executes the CSET statement, it evaluates the expression onEthe right of the equal sign, assigns its value to the string variable@and centers it. If the new value's length is less than the old :value's, INTOUCH pads it with leading and trailing spaces. = RNH (....................) ( Page 12 ) INTOUCH 4 READ\DATADFORMAT: DATA {num_const | str_const} [,{num_const | str_const}...] . . .< READ {num_var | str_var} [,{num_var | str_var}...]"EXAMPLE: See example topic below.BAssigns data in the DATA statement to variables listed in the READEstatement. The DATA statement may only contain constants. Data items >Dmust be separated by commas. Any legal INTOUCH variable may be used!in READ. Data types must match. CWith multiple READ statements, INTOUCH starts reading for each READDfrom the first unread item in the DATA list. Your READ list may not@contain more items than than your DATA list (unless a RESTORE is;used). READ and DATA must occur in the same program unit. 5 ExampleEXAMPLE: 10 DIM MONTHS$(12)B 20 DATA JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY@ 30 D?ATA AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER 40 FOR I=1 TO 12 READ MONTHS$(I) PRINT MONTHS$(I) NEXT I 50 FOR I = 1 TO 2 FOR J = 1 TO 6 READ MONTHS$(J) PRINT MONTHS$(J) NEXT J NEXT I 60 END 4 RESTOREFORMAT: RESTORE.EXAMPLE: 10 DIM MONTHS$(12), MORE_MONTHS$(12)B 20 DATA JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, @JULY@ 30 DATA AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER 40 FOR I=1 TO 12 READ MONTHS$(I) PRINT MONTHS$(I), NEXT I 45 RESTORE 50 FOR I=1 TO 12# READ MORE_MONTHS$(I)% PRINT MORE_MONTHS$(I), NEXT I 60 ENDCRestores all DATA statements in a program unit so that they may be Bused again. The next READ statement causes INTOUCH to go back to Athe first ADATA statement and begin assigning items in its list. 4 LETFORMAT: [LET] var = expr%EXAMPLE: 10 INPUT 'Last name': LAST$' INPUT 'First name': FIRST$- LET NAME$ = FIRST$ + ' ' + LAST$ PRINT NAME$ 20 ENDEAssigns a value to a variable. The variable can be any legal INTOUCHDvariable including a structure reference. The expression's value is@stored in the variable. The data type of the expression and theDvariable must match. INTOBUCH rounds real values assigned to integerAvariables. String variables are dynamic in length and can be up Ato 65535 characters long. Variables must be designated with the Eproper symbol ($ for strings and % for integers). The keyword LET isFoptional. INTOUCH always uses the last value assigned to a variable. 5 Variable_namesEThe variable name is used to reference a storage location. Variable names: = o consist of letters, numbers, and the underscore  C character (_)4 o must start with a letter [A...Z, a...z] , o may be up to 31 characters longC o must be followed by the proper data type designation--- % for integers and $ for strings 3 DECLARE7FORMAT: DECLARE {STRING | INTEGER | REAL} var, var... EXAMPLE: 5 DECLARE STRING NAME DECLARE INTEGER AGE$ 10 INPUT 'Your name': NAME) INPUT SCREEN 'Your age': AGE( 20 PRINT NAME; ' is'; DAGE; '.' 30 ENDBDECLARE declares the data type of a variable. That way, you don'tChave to repeat it everytime you use the variable. STRING indicates?the following are string variables. INTEGER indicates integer <numeric variables and REAL indicates real numeric variables.COnly one of the three data types may be used per DECLARE statement.<Any number of variables may be declared with each statement.4 OPTION_REQUIRE_DECLARE FORMAT: OPTION REQUIRE DECLARE#EXAMPLE: E10 OPTION REQUIRE DECLARE) 20 DECLARE STRING NAME, COMMENT, 30 INPUT 'Your name, please': NAME, 40 LINE INPUT 'A comment': COMMENT( 50 PRINT NAME;' says ';COMMENT 60 ENDFCauses INTOUCH to require that all variables in a program be declared.DIf OPTION REQUIRE DECLARE is used and a variable is left undeclared,EINTOUCH returns an error when program execution is attempted. OPTIONEREQUIRE DECLARE should occur before any DECLARE statements and befForeany variables are assigned. 3 CLEAR3FORMAT: CLEAR [AREA [BOX:] row1,col1 , row2,col2]EXAMPLE: 5 CLEAR- 10 INPUT 'Your name, please': NAME$# 20 PRINT 'Hello, '; NAME$ 30 END>CLEARS clears the screen and positions the cursor in the lowerFleft-hand corner, or to clear specific areas of the screen. CLEAR can@also be used to clear specific parts of the screen. AREA causesFINTOUCH to clear the rectangular area whose upper left and lower rightDcorn Gers have the respective coordinates. Row1,col1 is the first setAof coordinates specifying the upper left corner of the rectangle.BRow2, col2 specifies the lower right corner of the rectangle. BOX#creates an empty box with a frame. ' row1,col1 +---------------------+' | |+ | | 1 +---------------------+ row2,col23 PRINT?FORMAT: PRINT [AT row, col] [,BLINK] [,UNDERLINE] [,REVERSE] < H [,BOLD] [,USING "print_mask":] expr [, expr...] [;] orE PRINT [option[,option...]:]expr|tab(col)[,|;[expr|tab(col)]]!EXAMPLE: See example topic below.DPrints an expression to the terminal. Expr can be any legal INTOUCHDexpression. INTOUCH prints the value at the current cursor position@and generates a new line. PRINT by itself generates a new line.BMultiple expressions must be separated by commas or semicolons. ABsemicolon causes the next item to immeIdiately follow the first. AFcomma causes the next item to print in a new print zone. Zones have aBdefault width of 20. If an item is too long, INTOUCH continues itFinto the next print zone. The options listed below are also available with PRINT. 4 ExampleEXAMPLE: 10 INPUT NAME$ # PRINT "Hello, "; NAME$< PRINT BOLD, UNDERLINE: "Here is a number: 1.93" 20 END4 Semicolon_example$EXAMPLE: 10 ALPHA$='ABCDEFGHIJKLM'" J BET$='NOPQRSTUVWXYZ' PRINT ALPHA$; BET$ 20 END RNH% ABCDEFGHIJKLMNOPQRSTUVWXYZ  INTOUCH4 Comma_example$EXAMPLE: 10 INPUT NAME_1$, NAME_2$, 20 PRINT NAME_1$, 'MARY', NAME_2$ 30 END RNH ? FRED, JOHN7 FRED MARY JOHN INTOUCH 4 AT_optionDAT can be used to position the cursor prior to printing. ItK must beGused at the beginning of the PRINT statement. Only one AT may be used 5per PRINT statement. The format of the AT option is:" AT row, col:ARow is the row to print at. Col is the column to print at. Row 3and col must be given as integer numeric constants.! 10 INPUT NAME_1$, NAME_2$? 20 PRINT AT 3,10:NAME_1$;TAB(20);'MARY';TAB(35);NAME_2$ 30 END RNH ? FRED, JOHN. FRED MARY JOLHN INTOUCH4 Printing_Numeric_Values:The following rules govern the printing of numeric values:Eo Numbers are always followed by a space, even if the separator is I a semicolon. Positive numbers and zero are also preceded by a space.2o Negative numbers are preceded by a minus sign.Ho If a number can be represented as an integer of 12 or fewer digits,  it is printed as such.Go If a number can be rounded to a decimal number of twelve digits or less, Mit is printed as such.@o If a number can't be printed in one of the above ways, it is1 printed in standard scientific (E) notation. >o INTOUCH prints 10 digits of precision for integer numbers.;o INTOUCH prints 12 digits of precision for real numbers.4 Positioning_the_Cursor@If a separator (comma, semicolon, TAB function or AT option) is Bthe last item in the PRINT statement, INTOUCH advances the cursor ?to the position specified and ^@does not\@ generate a new line."N 10 PRINT TAB(5);7, PRINT 10; PRINT 20 20 END RNH* 7 10 20  INTOUCH4 Printing_Attributes@Printing attributes can be used to highlight special text. The Efollowing options may be used to highlight expressions on the screen:<BLINK Shows the expressions in the print list blinking.>UNDERLINE Shows the expressions in the prOint list underlined.>BOLD Shows the expressions in the print list to in bold  (high intensity).DREVERSE Shows the expressions in the print list in reverse video. These options may be combined. 0 10 PRINT BOLD, REVERSE: "HELLO"5 20 PRINT UNDERLINE, BLINK: "GOODBYE" 30 END4 USING_optionGUSING provides a print mask. The print mask is used to print the data 6in the print list. The format of the USING option is:P@ USING "[text] field [ [text] field...]": expr [,expr...] [;]DThe print mask consists of ^@fields\@ and optional text. It must beCenclosed in quotes. Text can precede or follow a field. The mask 7may be given as either a constant or a string variable.?Fields are made up of format characters. A number of ^@format Fcharacters\@ may be used to control how expressions are printed. The 7characters available are described in the topics below. 5 Example EXAMPLE: 1 Q fields print list1 / ~\ / \" 10 LET A$ = "#.## ##.##"$ 20 PRINT USING "#.##": 1.9( 10 PRINT USING A$: 1.93, -1.93 20 END RNH 1.90 1.93 -1.93 INTOUCH 5 Print_listAExpressions in the USING print list are separated by commas. The@expressions are printed according to the the format. A trailingBsemicolon will cause INTOUCH to leave the cuRrsor at the end of the print line. 5 10 PRINT USING "###.## ###.##": 22.88, 45;" 20 PRINT " and others." 30 END RNH$ 22.88 45.00 and others. INTOUCH@If your expression is too large to fit in a field, INTOUCH gives an exception. 5 #_strings:Can be used to indicate a character position. For example:2 10 PRINT USING "#### ##": 'TEST', 'HI' 20 END RNH TEST HIS INTOUCHCTwo field are show in the above print mask. The first consists of Ffour character positions. The second consists of two. If the printed?expression is smaller than the field, the expression is printedcentered within the field.5 <BUsed to left-justify text within a field. The less than sign must=appear at the beginning of a field. It counts as a characterCposition. Justification only occurs in the field following the less than sign. 4 10T PRINT USING "#### <###": 'TEST', 'HI' 15 PRINT '123456789' 20 END RNH TEST HI 123456789 INTOUCH5 >FUsed to right-justify text within a field. The greater than sign must=appear at the beginning of a field. It counts as a characterFposition. Justification only occurs in the field following the greater than sign. 4 10 PRINT USING "#### >###": 'TEST', 'HI' 15 PRINT '123456789'U 20 END RNH TEST HI 123456789 INTOUCH 5 #_numericBCan be used to specify numeric characters. Each # represents one Bnumeric digit position. If you indicate more character positions Ethan the expression contains, the expression will be right justified and padded with spaces:" 5 PRINT "1st 2nd 3rd"5 10 PRINT USING "### ### ###": 193, 19, -1 20 END RNH V 1st 2nd 3rd 193 19 -1 INTOUCHCINTOUCH normally prints a minus sign in front of negative numbers. EINTOUCH does not print a sign in front of positive numbers. Positive;numbers are printed without any spaces or special notation.5 .DUsed to include a decimal point in the number. If you indicate more=character positions to the left of the decimal point than the@expression contains, the expression will be printed with leadingEspaces. If you indicate morWe character positions to the right of theBdecimal point than the expression contains, the expression will beprinted with trailing spaces: # 5 PRINT "--1-- ---2--"3 10 PRINT USING "##.## ###.##": 1.3, 1.9 20 END RNH --1-- ---2-- 1.30 1.90 INTOUCH5 ,'Used to include commas in your numbers. 5 A$="##,###.##"' 10 PRINT USING A$: 28290.06& 20 PRINT USING A$:X 8290.06% 30 PRINT USING A$: 290.06 40 END RNH 28,290.06 8,290.06 290.06 INTOUCH.Commas may not be used in exponential formats.5 %_(percent) =Can be used instead of pound signs to specify numeric digits.;If the expression is smaller than the format, INTOUCH will @right justify the expression and pad it with leading ^@zeros\@. :Only numeric digits may be printed where a % is specified.Y" 5 PRINT "-1- -2- -3-"4 10 PRINT USING "%%% %%% %%%": 193, 19, 1 20 END RNH -1- -2- -3- 193 019 001 INTOUCH5 *_(asterisk)DCan be used instead of pound signs to represent character positions.@If the expression is smaller than the format, INTOUCH will right6justify the expression and pad it with ^@asterisks\@: " 5 PRINT "-1- -2- -3-"4 10 PRINT USING "*** *** ***": 193,Z 19, 1 20 END RNH -1- -2- -3- 193 *19 **1 INTOUCH 5 +_(plus)BCauses INTOUCH to print a leading plus or minus sign. The + sign Fcounts as a character position in the format. The character position (is used to print the sign of the number:% 5 PRINT " -1- -2- -3-"8 10 PRINT USING "+### +### +###": 193, 19, -1 20 END RNH -1- -2- -3- +1[93 +19 -1 INTOUCH 5 -_(minus)FCauses INTOUCH to print a leading minus sign for negative numbers, andBa leading space for positive numbers. The - counts as a characterDposition in the format. The character position is used to print theminus sign or space. % 5 PRINT " -1- -2- -3-"8 10 PRINT USING "-### -### -###": 193, 19, -1 20 END RNH -1- -2- -3- 193 19 -1 INTOUC\H5 $_(dollar_sign)@Causes INTOUCH to print a floating dollar sign. The dollar sign;appears before the numeric expression. $ causes INTOUCH toEprint a minus sign before negative numbers and leave positive numbers;unsigned. The minus sign appears immediately ^@after\@ the'dollar sign and ^@before\@ the number. & 5 PRINT "1st col 2nd col": 10 PRINT USING "$###.## $###.##": 11.93, -1.93 20 END RNH 1st col 2nd col] $11.93 $-1.93 INTOUCH5 +$ @Causes INTOUCH to print a floating dollar sign. The dollar signEappears immediately before the numeric expression. +$ causes INTOUCHDto print a plus sign before positive numbers and a minus sign beforeFnegative numbers. +$ adds two character positions to the format. OneAposition contains the dollar sign, the other contains the plus orBminus sign. The plus or minus sign appears immediately before the dollar sign: ( ^ 5 PRINT "1st col 2nd col"< 10 PRINT USING "+$###.## +$###.##": 11.93, -1.93 20 END RNH 1st col 2nd col +$11.93 -$1.93 INTOUCH5 -$ACauses INTOUCH to print a floating dollar sign. The dollar sign Eappears immediately before the numeric expression. -$ causes INTOUCH@to print a minus sign before negative numbers and a space beforeFpositive numbers. The minus sign or space appears immedia_tely before the dollar sign:( 5 PRINT "1st col 2nd col"< 10 PRINT USING "-$###.## -$###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $11.93 -$1.93 INTOUCH5 $+ACauses INTOUCH to print a floating dollar sign. The dollar sign Cappears before the numeric expression. $+ causes INTOUCH to print =a minus sign before negative numbers, and a plus sign before Epositive numbers. The sig`n appears after the dollar sign and before the number:( 5 PRINT "1st col 2nd col"< 10 PRINT USING "$+###.## $+###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $+11.93 $-1.93 INTOUCH5 $-ACauses INTOUCH to print a floating dollar sign. The dollar sign Cappears before the numeric expression. $- causes INTOUCH to print Aa minus sign before negative numbers and a space before positiave Cnumbers. The minus sign or space appears after the dollar sign andbefore the number:( 5 PRINT "1st col 2nd col"< 10 PRINT USING "$-###.## $-###.##": 11.93, -1.93 20 END RNH 1st col 2nd col $ 11.93 $-1.93 INTOUCH3 Handling_exceptionsDYou can use INTOUCH's exception handlers to intercept exceptions andFhandle them. An exception is a run-time error which causes INTOUCH to;print an exc beption message and/or stop program execution. EThere are two parts to any exception handler. The protected block isDthe block of code the handler protects. The handler is the block ofCcode which is executed if an exception occurs. There are two typesGof INTOUCH exception handlers. The WHEN EXCEPTION IN handling routine Cincludes the handler with the block of code it protects. The WHEN HEXCEPTION USE calls a handler routine in the case of an exception. The JWHEN EXCEPTION USE handlcers can be called by any number of USE statements.FThere are also several exception handling statements which you can usewithin handler routines. 4 WHEN_EXCEPT_INFORMAT: WHEN EXCEPTION IN! --- protected block USE --- handler  END WHEN"EXAMPLE: See example topic below.ETraps an exception in the protected block and uses the handler in theGUSE block to resolve it. Everything between the WHEN EXCEPTION IN and GUSE statements condstitutes the protected code. Everything between the FUSE and the END WHEN statements constitutes the handling routine. If @an exception occurs in the protected block, the handler code is executed. 5 Example-EXAMPLE: 10 INPUT 'Your name, please': NAME$ 20 WHEN EXCEPTION IN+ INPUT 'How old are you': AGE USE( PRINT '*Not a valid age*' RETRY END WHEN 30 PRINT$ PRINT NAME$; ' is'; AGEe 40 END RNH! Your name, please? JOHN& How old are you? thirty-four *Not a valid age* How old are you? 34 John is 34  INTOUCH5 Handling_statements7 RETRY Causes INTOUCH to leave a handler and : re-execute the statement which generated ! the exception. > CONTINUE Causes INTOUCH to exit the exception handler = and continue progfram execution at the first C statement following the statement which generated ! the exception. > RESUME Causes INTOUCH to exit the exception handler < and resume program execution at the target " line specified. 5 EXIT HANDLER Exits the current handler routine. 4 WHEN_EXCEPT_USE'FORMAT: WHEN EXCEPTION USE handl_name --- protected block END WHEN ... HAND gLER handl_name --- handler END HANDLER"EXAMPLE: See example topic below.=Traps an exception and uses the HANDLER to resolve it. If anBexception occurs in the protected block, INTOUCH calls the handlerDspecified. (If the handler isn't found, an error is generated.) The@handl_name must meet the specifications for variable names. ENDAHANDLER returns control to the statement following END WHEN. TheAhandler may occur before the protected block. One handler may bhe7called by any number of WHEN EXCEPTION USE statements. 5 ExampleFIn the example below, INTOUCH would normally return an exception when @it tried to divide 25.00 by 0. FIX_AVERAGE resolves this error: 10 HANDLER FIX_AVERAGE AVERAGE=0 CONTINUE END HANDLER3 20 INPUT 'Enter total sales amount': TSALES0 INPUT 'Enter number of sales': NSALES) 30 WHEN EXCEPTION USE FIX_AVERAGE& LET AVERAGE=TSALES/NSALESi END WHEN* 40 PRINT 'The average is'; AVERAGE 50 END RNH' Enter total sales amount? 25.00 Enter number of sales? 0 The average is: 05 Handling_statements7 RETRY Causes INTOUCH to leave a handler and : re-execute the statement which generated ! the exception. > CONTINUE Causes INTOUCH to exit the exception handler = and continue program execution at the first j9 statement following the statement which + generated the exception. > RESUME Causes INTOUCH to exit the exception handler < and resume program execution at the target " line specified. 5 EXIT HANDLER Exits the current handler routine. 4 RETRY FORMAT: USE --- RETRY END WHEN or HANDLER handl_name --- RETRY END HANDLER"EXAMkPLE: See example topic below.?Causes INTOUCH to leave a handler and re-execute the statement Bwhich generated the exception. May be used within either type of exception handling routine. 5 Example-EXAMPLE: 10 INPUT 'Your name, please': NAME$ 20 WHEN EXCEPTION IN, INPUT 'How old are you': AGE USE) PRINT '*Not a valid age*' RETRY END WHEN 30 PRINT$ PRINT NAME$; ' is'; AGEl 40 END RNH! Your name, please? JOHN& How old are you? thirty-four Not a valid age How old are you? INTOUCH 4 CONTINUEFORMAT: USE  --- CONTINUE END WHEN or HANDLER handl_name --- CONTINUE END HANDLER"EXAMPLE: See example topic below.ACauses INTOUCH to exit the exception handler and continue program>execution at the first statememnt following the statement which@generated the exception. CONTINUE can be used in either type ofhandling routine. 5 Example5EXAMPLE: 10 INPUT 'Enter total sales amount': TSALES2 INPUT 'Enter number of sales': NSALES+ 20 WHEN EXCEPTION USE FIX_AVERAGE$ AVERAGE=TSALES/NSALES END WHEN- 30 PRINT 'The average is:'; AVERAGE 40 HANDLER FIX_AVERAGE AVERAGE=0 CONTINUE END HANDLERn 50 END RNH) Enter total sales amount? 18.00" Enter number of sales? 0 The average is: 0 INTOUCH4 RESUME FORMAT: USE  --- RESUME target END WHEN or HANDLER handl_name --- RESUME target END HANDLER"EXAMPLE: See example topic below.?Causes INTOUCH to exit the exception handler and resume programEexecution at the target line specified. RESUMoE can be used in either<type of handling routine. Target can be a line number or analphanumeric label. 5 Example5EXAMPLE: 10 INPUT 'Enter total sales amount': TSALES2 INPUT 'Enter number of sales': NSALES+ 20 WHEN EXCEPTION USE FIX_AVERAGE$ AVERAGE=TSALES/NSALES END WHEN- 30 PRINT 'The average is:'; AVERAGE 40 HANDLER FIX_AVERAGE LET AVERAGE=03 PRINT 'Invalid numbers. Try again.' p RESUME 10 END HANDLER 50 END RNH) Enter total sales amount? 18.00" Enter number of sales? 0& Invalid numbers. Try again.) Enter total sales amount? 18.00" Enter number of sales? 3 The average is: 6 INTOUCH4 EXIT_HANDLER FORMAT: USE --- EXIT HANDLER END WHEN or  HANDLER handl_name --- EXIT HANDLERq END HANDLER"EXAMPLE: See example topic below.FExits the current handler routine. EXIT HANDLER may be used in eitherBtype of handling routine. If the current handler is nested withinFanother, INTOUCH jumps to the outside handler. If there is no outside;exception handler, control returns to the INTOUCH system. 5 Example'EXAMPLE: 10 WHEN EXCEPTION USE MISTAKE* INPUT 'Enter your age': AGE END WHEN, PRINT 'You are';AGE;'years old'r 20 HANDLER MISTAKE PRINT 'Oops...' EXIT HANDLER END HANDLER 30 END RNH% Enter your age? thirty-four Oops...8 Non-numeric input when number expected at 10.1 Enter your age? INTOUCH 3 PROGRAMFORMAT: PROGRAM prog_name!EXAMPLE: 10 PROGRAM Display_Name- 20 INPUT 'Your name, please': NAME$# PRINT 'Hello, '; NAME$ 30 ENDsEPROGRAM is used to name programs. Prog_name must meet the rules for variable names.3 STOPFORMAT: STOP-EXAMPLE: 10 INPUT 'Your name, please': NAME$ 20 WHEN EXCEPTION IN+ INPUT 'How old are you': AGE USE& PRINT 'Not a valid age' STOP END WHEN$ 30 PRINT NAME$; ' is'; AGE 40 END=Ends program execution, prints a message specifying the line Bcontaining the stop and returns to tthe INTOUCH prompt. STOP acts Elike the END statement except STOP does not mark the physical end of 3your program, and you may use any number of STOPS. 3 END FORMAT: END-EXAMPLE: 10 INPUT 'Your name, please': NAME$# 20 PRINT 'Hello, '; NAME$ 30 ENDAEND marks the end of your program. When INTOUCH executes the ENDEstatement, it stops executing code and returns to the INTOUCH prompt.ABefore returning to the prompt, INTOUCH writes all active output 4buffers uand closes all files in the current program.3 HALTFORMAT: HALT-EXAMPLE: 10 INPUT 'Your name, please': NAME$ 20 WHEN EXCEPTION IN+ INPUT 'How old are you': AGE USE& PRINT 'NOT A VALID AGE' HALT END WHEN$ 30 PRINT NAME$; ' is'; AGE 40 END<HALT stops program execution. HALT does not close files or Astructures and does not write active output buffers. You can use.any number of HAvLT statements in your program.3 DELAYFORMAT: DELAY num_exprEXAMPLE: 10 RANDOMIZE: 20 INPUT 'Pick a number between 1 and 10': PICK%= IF PICK%<1 OR PICK%>10 THEN CAUSE EXCEPTION 1001 30 LET NUMBER%=RND(10)9 IF NUMBER%=PICK% THEN LET TEXT$="correct!" &+ ELSE LET TEXT$="incorrect"% 40 PRINT 'Your number is '; DELAY .5 PRINT TEXT$ 50 ENDBDELAY causes INTOUCH to pause for the wspecified number of seconds Cbefore continuing program execution. Num_expr specifies the number7of seconds to wait before continuing program execution.3 CAUSE_EXCEPTION*FORMAT: CAUSE EXCEPTION exception_number"EXAMPLE: 10 INPUT 'Your age': AGE 20 IF AGE>125 THEN &C CAUSE EXCEPTION 1001 ! if the age is over 125 use : 30 PRINT AGE ! the error message 8 40 END ! "Illegal number"ECAUSE EXCEPTION causes I xNTOUCH to generate the exception specified. BWhat effect this has is determined by the value of the expression @and the error handler that is in effect when CAUSE EXCEPTION is ?executed. Excep_num is the number of the exception you want to generate. 2 CommandsFCommands are words which you type at the INTOUCH prompt. The commandsGcause INTOUCH to perform some action. For instance, RUN causes INTOUCH)to execute the program in current memory.ITo use an INTOUCH command, type the ycommand and press the RETURN or ENTERkey on your keyboard.3 NEWFORMAT: NEW "workspace_name"EXAMPLE: NEW "HELLO"FNEW clears current memory and assigns a name to the current workspace.Workspace_name: 9 o may be up to, but not longer than, 19 characters.! o must start with a letter., o may consist of letters and numbers. @The default workspace name is "NONAME". The workspace name will@appear at the "Program:" prompt in the upper right corner zof theCscreen. When you use the NEW command, current memory is cleared. FTherefore, any programs in memory are lost. INTOUCH writes all active;output buffers, closes all files and releases all storage. 3 SAVEFORMAT: SAVE ["file_spec"]EXAMPLE: SAVE "HELLO"DUsed to save unique files--files with a unique file spec. Programs Eare ordered sequentially by line number and saved as VMS text files. @A file specification can be included with the SAVE command. TheDdefault file s{pec is the current workspace name with an extension of>".INT". (See the Command Language and DCL User's Guide--Volume@2--Section 3, of the VAX/VMS Version 4.0 documentation set for a"description of legal file_specs.) ETo replace a saved file with a revised file, use the REPLACE command.3 RNHFORMAT: RNH ["file_spec"]EXAMPLE: RNH "HELLO"FExecutes or "runs" the program in current memory without displaying a Bheader on the screen. RNH will run the specified program with|out Cdisplaying the program header. Other than suppressing the header, +RNH operates the same as the RUN command. @A file specification can be given. If a file spec is included, @INTOUCH will search for the file, load it, and then run it. TheBfile must contain a saved INTOUCH program. The default extension is ".INT". 3 RUNFORMAT: RUN ["file_spec"]EXAMPLE: RUN "HELLO"?Executes or "runs" the program in current memory. When RUN is Cexecuted, INTOUCH disp}lays a header with the program name, current Fdate and time. INTOUCH then executes the program in current memory. @A file specification can be given. If a file spec is included, @INTOUCH will search for the file, load it, and then run it. TheBfile must contain a saved INTOUCH program. The default extension is ".INT". 3 REPLACEFORMAT: REPLACE ["file_spec"]EXAMPLE: REPLACE "HELLO"CReplaces the last version of the file specified with the version inEcurrent ~memory. Previous versions of the file remain unchanged. If@no earlier version is found, INTOUCH creates a new file with theCspecifications given. The program in current memory is not changed&when the REPLACE command is executed. CFile_spec can be any legal VMS file spec. The default extension isD".INT". The default file spec is the current workspace name and theextension ".INT". 3 OLDFORMAT: OLD ["file_spec"]EXAMPLE: OLD "HELLO"FClears memory and loads the file specified into current memory. If noBfile spec is included, INTOUCH tries to load the file carrying theEcurrent workspace name and an extension of ".INT". If a file_spec isBgiven, INTOUCH loads the file and assigns the file name (minus theDextension) to the current workspace. The default extension for the file spec is ".INT".FThe contents of any variables in the olded program are cleared (set toEzero for numeric variables and the null string for string variables).CIf INTOUCH canno€t find the file specified an exception is generated2and the file in current memory remains in memory. 3 LNH&FORMAT: LNH [label {- | ,} label...]EXAMPLE: LNH 510-570, FREDFDisplays lines from the program in current memory without a preceding Cheader. Other than suppressing the header, LNH operates like LIST.ELNH without any options lists the entire program in current memory. 5Program lines are listed sequentially by line number. 4 LNH_ERROSFORMAT: LNH ERRORSEXAMPLE: LNH ERRORSELists compile-time errors to the terminal. LNH ERRORS suppresses theEheader and then displays the line number and source code of all lines with errors. 3 LIST'FORMAT: LIST [label {- | ,} label...]EXAMPLE: LIST 510-570, FREDHLIST without options lists a header and the program in current memory. ELines are listed sequentially by line number. Sections may be listedCwith the options below. Options may be combined. Lines are‚ listedJin the sequence of the LIST command. LINE NUMBERS ARE CONSIDERED LABELS. @LIST label lists the line with the label specified HLIST label,label... lists the first line, the second line and so on. ELIST line_num-line_num lists the first line through the second line.@LIST line_num- lists from the specified line number on. 4 LIST_ERRORSFORMAT: LIST ERRORSEXAMPLE: LIST ERRORSBLists compile-time errors to the terminal. LIST ERRORƒS displays aAheader and then the line number and source code of all lines witherrors. 3 EDIT'FORMAT: EDIT [label {- | ,} label...]!EXAMPLE: EDIT 410, 510-570, FRED?Transfers control to the VAX/VMS editor--EDT. Upon exiting theCeditor, control returns to INTOUCH. The program must be in currentEmemory to use the EDIT command. EDIT without options puts the entireFprogram into EDT. Sections can be edited by referencing the program'sFlabels. LINE NUMBERS ARE CONSID„ERED LABELS. The methods below can beDcombined. Lines are placed in the editor in the sequence specified with the EDIT command. 2EDIT label edits the label specified FEDIT label, label... edits the first line, the second line, and so  on.EEDIT line_num-line_num edits the first line through the second line.?EDIT line_num- edits all lines from the first line on. 3 RENUMBERFORMAT: RENUMBEREXAMPLE: RENUMBER@Re…numbers or resequences the program in current memory. Starts Erenumbering at line 1000 and increments lines by 10. All references Bto line numbers are also changed to match. The program must be incurrent memory. 3 FRAME_ONFORMAT: FRAME ON EXAMPLE: FRAME ONDClears the screen and turns the INTOUCH frame on. The INTOUCH frameAconsists of the highlighted bars across the top and bottom of theAscreen and the information they contain. FRAME ON does NOT clear'†current memory. 3 FRAME_OFFFORMAT: FRAME OFFEXAMPLE: FRAME OFFEClears the screen and turns the INTOUCH frame off. The INTOUCH frameAconsists of the highlighted bars across the top and bottom of theBscreen and the information they contain. FRAME OFF does NOT clearcurrent memory. 3 REFRESHFORMAT: REFRESHEXAMPLE: REFRESHF"Repaints" the INTOUCH screen. INTOUCH clears the screen and repaintsFthe INTOUCH frame and prom&‡pt. REFRESH does NOT clear current memory. 3 IDE FORMAT: IDE EXAMPLE: IDECCauses INTOUCH to display the copyright and version number for yourFversion of INTOUCH. The information is displayed in the center of thescreen. 3 COMPILEFORMAT: COMPILE EXAMPLE: COMPILE DConverts the program in current memory into an INTOUCH RUN file. TheDRUN file can then be executed from outside the INTOUCH environment. DCOMPILE operates on the prˆogram in current memory. The compiled copyFis saved under the current workspace name, with the extension ".RUN". *Old compiled versions are left untouched. ?Compiled programs can be run by typing INTOUCH followed by the )filename at the VAX prompt. For example: $ INTOUCH HELLO@would start INTOUCH and run the compiled version of the program GHELLO. When program execution completes, INTOUCH exits and returns to the VAX prompt.3 GO FORMAT: GO EXAMPLE: GO‰BResumes program execution after it has been interrupted. GO lets Eyou resume execution even after code has been changed. If a STOP or CBREAK statement was used, execution resumes at the first statement after the STOP or BREAK.3 UNSAVEFORMAT: UNSAVE ["file_spec"]EXAMPLE: UNSAVE "HELLO"@Deletes or unsaves the file specified. The default file spec isCthe current workspace name. The default extension is ".INT". The Asource program remains in current memory Š when UNSAVE is executed. 3 %INCLUDEFORMAT: %INCLUDE "File_spec"(EXAMPLE: 10 %INCLUDE "TTI_RUN:EXAMPLE" 20 ENDG Use to include source code from another file into the current INTOUCH Cprogram. (The %INCLUDE is replaced by the content of the included Dfile.) The included file cannot contain line numbers. The default $extension for the file_spec is .INC. 2 StructuresDINTOUCH's information management system stores data in structure ‹s. $Structures look something like this:"R FIELDS-E / | \6C Client Last name First name"O ID Number CR +---------+-----------------------------+---------------------DD -- |8|0|5|4|3|C|a|s|s| | | | | | | | | | | |C|a|t|h|y| | | | | | |ES -- |8|0|5|4|2|B|r|o|o|k| | | | | | | | | | |B|u|d| | | | | | | | | ARecords are the horizontal lines of information. Fields are the <co Œlumns of information. To reference a field, indicate the 8structure name and field name: struc_name(field_name). 3 Field_expressionsBField expressions may be given by: specifying the field name as a=string expression or specifying the field number as a numericEexpression. You may use a string constant to specify the field name.EIf you give the field name as a string constant, you need not encloseit in quotes. FIf the field expression is given as a numeric expression or other th anFa string constant, it must be preceded by a pound sign. The pound signEtells INTOUCH that the following characters are not to be interpretedFas the field name. If you do not include the pound sign, INTOUCH will*interpret the characters as a field name: 8 ASK STRUCTURE CL, FIELD #FIELDNAME$: DESCRIPTION A$# /> the field is specified by the variable FIELDNAME$ 7 ASK STRUCTURE CL, FIELD #FIELDNUM%: DESCRIPTION A$"  /= the field is specified by the variable FIELDNUM%3 OPEN_STRUCTURE;FORMAT: OPEN STRUCTURE struc_name: NAME 'struc_filename' = [,ACCESS INPUT | OUTIN] [,LOCK] [DATAFILE filename]"EXAMPLE: See example topic below.?Opens a data structure. Struc_name is a name you assign to theCstructure (like a channel number). It must be unique and currentlyBunassigned or an exception is generated. Struc_name must meet theDrequirements for variable names. NAME gives the file specificationsCfor the structure file being opened. The file spec can be given asDany valid string expression. ACCESS INPUT opens the file for inputConly. ACCESS OUTIN opens it for input and output. If no ACCESS is=given, INTOUCH opens the structure for INPUT. LOCK locks theCstructure from write access by others. LOCK may have the effect ofBspeeding up extracts. DATAFILE overrides the default datafile as specified by the structure. 4 Example;EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT", LOCK! 20 EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA'- EXCLUDE CL(PHONE)[1:3] = '619') SORT ASCENDING BY CL(LAST) END EXTRACT? 30 PRINT 'List of my California clients by last name' FOR EACH CL5 PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) NEXT CL 40 CLOSE STRUCTURE CL 50 END3 CLOSE_STRUCTURE$FORMAT: CLOS‘E STRUCTURE struc_name5EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"! 20 EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA'- EXCLUDE CL(PHONE)[1:3] = '619') SORT ASCENDING BY CL(LAST) END EXTRACT2 30 PRINT 'List of my California Clients' FOR EACH CL5 PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) NEXT CL 40 CLOSE STRUCTURE CL 50 END>Closes a structure ’ from further access. The structure name is"assigned with the OPEN statement. 3 EXTRACT_STRUCTUREDFORMAT: EXTRACT STRUCTURE struc_name [:KEY field=expr1 [TO expr2]]+ [INCLUDE | EXCLUDE] cond_expr; [SORT [ASCENDING | DESCENDING] BY expression] ... END EXTRACT&EXAMPLE: See the example topic below.CCreate a list of records for use. Struc_name is the structure nameAassociated with the structure. For each record in the structure, “?INTOUCH executes the code between the EXTRACT STRUCTURE and ENDDEXTRACT statements. INCLUDE includes records which meet a specifiedFcondition. EXCLUDE excludes records from the list which do not meet a@specified condition. SORT sorts the list in either ascending orBdescending order and according to the expression specified. These+options are discussed in the topics below. 4 Example 5EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"! 20 EXTRACT STRUCTURE CL' ” INCLUDE CL(STATE) = 'CA'- EXCLUDE CL(PHONE)[1:3] = '619') SORT ASCENDING BY CL(LAST) END EXTRACT2 30 PRINT 'List of my California Clients' FOR EACH CL5 PRINT CL(FIRST);' ';CL(LAST),CL(STATE) NEXT CL 40 CLOSE STRUCTURE CL 50 END4 EXCLUDE_optionFORMAT: EXTRACT struc_name ---  EXCLUDE cond_expr ---  • END EXTRACT6EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"" 20 EXTRACT STRUCTURE CL. EXCLUDE CL(PHONE)[1:3] = '619'6 PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) END EXTRACT 30 CLOSE STRUCTURE CL 40 ENDCExcludes records from the extract list, depending on the value of aCconditional expression. If cond_expr is true, INTOUCH excludes the?current record from the extract list. Cond_expr must match the@fiel–d's data type. For instance, the example program creates anEextract list of all the clients in the CLIENT structure--except thosewith an area code of 619. 4 INCLUDE_optionFORMAT: EXTRACT struc_name --- INCLUDE cond_expr --- END EXTRACT5EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"! 20 EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA'5 PRINT CL(FIRST);' ';CL(LAST),CL(STATE) — END EXTRACT 30 CLOSE STRUCTURE CL 40 ENDDIncludes records depending on the value of a conditional expression.FIf cond_expr is TRUE, INTOUCH includes the record in the extract list,Cotherwise INTOUCH excludes the record from the list. Cond_expr mustDmatch the field's data type. The example program creates an extract:list containing only those clients located in California. 4 SORT_option%FORMAT: EXTRACT STRUCTURE struc_name ---9 [SORT [A ˜SCENDING | DESCENDING] BY expression] --- END EXTRACT"EXAMPLE: See example topics below.CSorts the extract list. INTOUCH evaluates the expression (which isEusually a structure reference) for each record and stores the value. AWhen all the records have been extracted, INTOUCH orders the list"according to these stored values. CMultiple sorts can be used. Either ASCENDING or DESCENDING must beFspecified with SORT. ASCENDING orders records from lowest to hi™ghest.DDESCENDING orders records from highest to lowest. String values aresorted by ASCII value. 5 Example4 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT" 20 EXTRACT STRUCTURE CL( SORT ASCENDING BY CL(LAST) END EXTRACT 30 FOR EACH CL4 PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) NEXT CL 40 CLOSE STRUCTURE CL 50 END RNH* Al Abott (202) 566-9892* Bud Brock š(218) 555-4322* Cathy Cass (619) 743-8582* Dale Derringer (818) 223-9014* Earl Errant (408) 844-7676* Fred Farmer (305) 552-7872 INTOUCH5 Multiple_sort_example6EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"" 20 EXTRACT STRUCTURE CL+ SORT ASCENDING BY CL(STATE)* SORT ASCENDING BY CL(LAST) END EXTRACT 30 FOR EACH CL7 PRINT CL(LAST)›;', ';CL(FIRST),CL(STATE) NEXT CL 40 CLOSE STRUCTURE CL 50 END RNH# Cass, Cathy CA# Derringer, Dale CA# Errant, Earl CA# Farmer, Fred FL# Brock, Bud MN# Abott, Al NY INTOUCH 4 KEY_optionDFORMAT: EXTRACT STRUCTURE struc_name: KEY field = expr1 [TO expr2] ..." END EXTRACT œ%EXAMPLE: See the example topic belowEIncludes records depending on the record's key. INTOUCH uses the keyClist when the KEY option is specified. Struc_name is the structureCname associated with the structure. Field is the name of the fieldBwhich contains the key. INTOUCH evaluates expr1 and extracts onlyCthose records with matching keys. The structure must be an indexedCstructure and field must specify the key field. The key option canCconsiderably speed up extracts. The TO option establishes a range Aof keys to extract. INTOUCH extracts everything in the range of Cexpr1 to expr2. The expressions must match the field's data type. 5 Example5EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"9 20 INPUT 'Enter the lowest ID to check': LOWEST; INPUT 'Enter the highest ID to check': HIGHEST= 30 EXTRACT STRUCTURE CL: KEY ID = LOWEST TO HIGHEST. PRINT CL(ID); TAB(10); CL(LAST) END EXTRACT 40 CLOSE STRUCTURE 50 END RNH- Enter the lowest ID to check? 80540. Enter the highest ID to check? 80570 80542 Brock 80543 Cass" 80561 Derringer  INTOUCH!4 Detail_of_the_EXTRACT_construct8When an EXTRACT is done, each record of the structure is<examined in order. If a KEY option is specified, only thoseBrecords with a key matching the KEY expression are examined. For ,each exa Ÿmined record, the following is done:A 1. Each INCLUDE and EXCLUDE statement is checked in turn. The? examined record is not extracted if an include statement ? evaluates to FALSE, or an EXCLUDE statement evaluates to TRUE. @ 2. If any SORT specifications are given, a sort key is built 8 using the SORT expression as the key. If no SORT : specifications are given, the record is immediately  extracted. ?When all records have been examined, the sor  t keys, if any, are>sorted. A list of extracted records is then built. This list@can be accessed later by the FOR EACH loop. Up to 16 sort keys $and 32 extract criteria are allowed.3 Partial_lookup_keyDPARTIAL LOOKUP key is used in the EXTRACT STRUCTURE to look for partDof a key value. For example, we have a structure with the followingclient information: ; ID # LAST FIRST CITY STATE PHONE= +------+-----------+--------+--------------+--+----------+= | ¡80543 |Roberts |Cathy | San Diego |CA|6197438582|= |80542 |Roske |Bud | Duluth |MN|2185554322|= |80522 |Rost |Earl | Monterey |CA|4088447676|= |80561 |Rosty |Dale | Los Angeles |CA|8182239014|= |80531 |Abott |Al | New York |NY|2025669892|HCheck the example where it creates an extract list containing only thoseDclients with the last name started with "ROS" and is using a partial lookup key. 4 Example17EXAMPLE: 10 O¢PEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"& 20 EXTRACT STRUCTURE CL: &, KEY LAST = "Ros" to "Rosz"  END EXTRACT> 30 PRINT "Clients with last name started with Ros" PRINT FOR EACH CL- PRINT CL(FIRST);' ';CL(LAST) NEXT CL! 40 CLOSE STRUCTURE CL 50 END 3 REEXTRACT)FORMAT: REEXTRACT STRUCTURE struc_name  ---- [INCLUDE | £EXCLUDE] cond_expr...< [SORT [ASCENDING | DESCENDING] BY expression... --- END EXTRACT"EXAMPLE: See example topic below.<Does an extract on the list of records previously extracted.DStruc_name is the structure name associated with an open structure. @REEXTRACT operates the same as the EXTRACT construct except that@REEXTRACT extracts from a previously extracted list. All options5available with EXTRACT are available with REEXTRACT. 4 Example¤CEXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT", ACCESS INPUT! 20 EXTRACT STRUCTURE CL% INCLUDE CL(STATE)='CA' END EXTRACT# 30 REEXTRACT STRUCTURE CL, EXCLUDE CL(PHONE)[1:3]<>'619') SORT ASCENDING BY CL(LAST) END EXTRACT5 40 PRINT 'List of Clients in Area Code 619' FOR EACH CL6 PRINT CL(FIRST); ' ';CL(LAST),CL(PHONE) NEXT CL 50 C¥LOSE STRUCTURE CL 60 END3 FOR_EACH\NEXTFORMAT: FOR EACH struc_name$ --- block of code NEXT struc_name"EXAMPLE: See example topic below.=Executes a block of code for each record in the extract list.AStruc_name is the structure name associated with the structure. ?The REPEAT, ITERATE and EXIT FOR statements may be used in the FOR EACH loop. 4 Example5EXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT"! 20¦ EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA'- EXCLUDE CL(PHONE)[1:3] = '619') SORT ASCENDING BY CL(LAST) END EXTRACT 30 FOR EACH CL5 PRINT CL(FIRST);' ';CL(LAST),CL(PHONE) NEXT CL 40 CLOSE STRUCTURE CL 50 END RNH* Dale Derringer (818) 223-9014* Earl Errant (408) 844-7676 INTOUCH3 DELETE_STRUCTURE%FORMAT: DELETE S§TRUCTURE struc_nameCEXAMPLE: 10 OPEN STRUCTURE CL: NAME 'TTI_RUN:CLIENT', ACCESS OUTIN! 20 EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA' END EXTRACT1 30 ! Delete all clients from California FOR EACH CL< PRINT 'Deleting ';CL(FIRST);' ';CL(LAST);'...'; DELETE STRUCTURE CL% PRINT 'record deleted' NEXT CL 40 CLOSE STRUCTURE CL 50 ENDHDeletes the curren¨t record from the structure specified. Struc_name is 1a structure name associated with the structure. 3 ADD_STRUCTURE"FORMAT: ADD STRUCTURE struc_name' --- * [LET] struc_name(field) = expr --- END ADD &EXAMPLE: See the example topic below.CAdds a record to a structure. Struc_name is a name associated withEthe structure. Use the block of code between the ADD and the END ADDEto add field © data to the structure. LET assigns a value to the fieldBspecified. Struc_name(field) specifies a field in the structure. FWhen INTOUCH executes the LET statements, it evaluates the expression Fand then assigns the value of this expression to the field specified. CEND ADD writes out the new record. The expressions must match the field's data type. 4 ExampleCEXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT", ACCESS OUTIN) 20 INPUT "Enter id number": ID%+ INPªUT "Enter last name": LAST$, INPUT "Enter first name":FIRST$' INPUT "Enter state":STATE$ 30 ADD STRUCTURE CL1 PRINT 'Adding ';LAST$; ', ';FIRST$ LET CL(ID) = ID%" LET CL(LAST)= LAST$$ LET CL(FIRST)= FIRST$% LET CL(STATE) = STATE$ END ADD  40 CLOSE STRUCTURE CL 50 END RNH Enter id number? 80522# Enter last nam«e? Hinsdale Enter first name? John Enter state? CA Adding Hinsdale, John INTOUCH3 LOCK\UNLOCK_STRUCTURE.FORMAT: {LOCK | UNLOCK} STRUCTURE struc_nameCEXAMPLE: 10 OPEN STRUCTURE CL: NAME "TTI_RUN:CLIENT", ACCESS OUTIN! 20 EXTRACT STRUCTURE CL' INCLUDE CL(STATE) = 'CA' END EXTRACT 30 FOR EACH CL+ PRINT CL(FIRST);' ';CL(LAST)> LOCK STRUCTURE CL ! Gives us exclus ¬ive access9 INPUT 'Enter the new phone number': PHONE$% LET CL(PHONE) = PHONE$A UNLOCK STRUCTURE CL ! puts the record out to disk 6 ! and releases it NEXT CL 40 CLOSE STRUCTURE CL 50 END?Overrides INTOUCH's automatic locking features. LOCK STRUCTUREElocks the data currently being accessed giving the program exclusive 5access. UNLOCK unlocks the current record or data. ww