INTOUCH® 4GL
A Guide to the INTOUCH Language


Previous Contents Index

1.5.2 Running an INTOUCH program

To run or execute the sample INTOUCH program, you can enter RUN or RNH. RUN will print a program header and RNH will not.

When you run the program, you will be asked to enter your name. Enter your name and press [Return].

Example 1-6 Running an INTOUCH Program


 
10  input 'Please enter your name': name$ 
20  print 'Hello, '; name$ 
30  end 
run 
NONAME        30-APR-1996 14:51 
Please enter your name? Sally 
Hello, Sally 
 
INTOUCH
 
rnh 
Please enter your name? Sam 
Hello, Sam 
 
INTOUCH
 

1.5.3 Interrupting and Changing an INTOUCH program

You can interrupt an INTOUCH program while it is running, make immediate changes and continue execution. This can be done because INTOUCH compiles each statement as it is entered. And, as you have seen previously, it returns any compile-time errors immediately.

The following shows how to run the sample program, iterrupt it, make a change and continue execution.

Interrupting the Program

To interrupt an INTOUCH program, enter [Ctrl/C] while the program is running.

To interrupt the sample program, RUN the program and at the "Please enter your name?" prompt, enter [Ctrl/C]. INTOUCH will interrupt program execution and tell you where it stopped.

Example 1-7 Interrupting an INTOUCH Program


INTOUCH                       Program: NONAME                                   
The Next Generation Language  Status :  BREAK at 10                             
 
 
INTOUCH
 
run 
NONAME        30-APR-1996 15:33 
 Cancel nter your name? 
 
BREAK at 10 
 
INTOUCH
 
 

BREAK at 10 tells you that the program was stopped when it was executing line 10.

You are now at the INTOUCH prompt and can make changes.

Listing Program Lines

Before making changes, you can list the current program lines by entering the word LIST. For example:

Example 1-8 Listing Program Lines


 
INTOUCH
 
list 
NONAME        30-APR-1996 16:11 
10  input 'Please enter your name': name$ 
20  print 'Hello, '; name$ 
30  end 
 
INTOUCH
 

Changing the Sample Program

You can change the sample program by entering the following two lines:



 
10  name$ = 'Sunny' 
25  print day$ 
 

Resuming Program Execution

You have changed the sample program and are now ready to resume execution. You want the program to start running at line 10. To continue program execution, enter GOTO 10 and press [Return].

Example 1-9 Resuming INTOUCH Program Execution


INTOUCH
 
10  name$ = 'Sunny' 
25  print day$ 
goto 10 
Hello, Sunny 
Sunday 
 
INTOUCH

INTOUCH started program execution at line 10 and ran all the program lines including line 25, the line you added.

As you can see, INTOUCH makes it easy to add and change program code.

1.6 Using EXIT and Back

When you want to get out of the INTOUCH environment, enter EXIT and you will be returned to the system prompt (the $ prompt).

When you EXIT out of INTOUCH, you lose the environment you have set up. Any unsaved changes you have made to the environment are lost. When you re-enter INTOUCH, you will begin again with the default INTOUCH environment.

Summary Message Line

When you are in INTOUCH and at the INTOUCH prompt or in an INTOUCH program, utility or routine, you will see a summary message line at the bottom of the screen frame.



 
 
INTOUCH
 
 
                                                                                
EXIT = Exit                                                \ = Back  HELP = Help

The summary message reminds you that, while you are in INTOUCH:

You also have access to these three commands from within your own INTOUCH programs. Here is an example of how they are used in a program:



        10  DO 
              INPUT 'Please enter your name': name$ 
              IF  _HELP  THEN  MESSAGE 'Type in your name' 
              IF  _HELP  or  _BACK  THEN  REPEAT DO 
              IF  _EXIT  THEN  EXIT DO 
              PRINT 'Hello '; name$ 
            END DO 
        20  END 
 
        RNH 
        Please enter your name? help 
        Please enter your name? \
        Please enter your name? exit 
 
 
                        Type in your name 

When in an INTOUCH program or routine, you can also press the [Help] key to get help and press [Ctrl/Z] to exit.

Summary

You can enter EXIT or press [CTRL/Z] from within a program to do one of the following:

1.7 Messages in INTOUCH

INTOUCH displays system, program and procedure messages within the bottom screen frame. For example:



 
 
INTOUCH
 
 
                                                                                
           .New mail on node FAST from FAST::SARALEE      (22:33:15)            
EXIT = Exit                                                \ = Back  HELP = Help

If the screen frame is not on, messages will be displayed on the bottom line of the screen. These are INTOUCH's default message lines. If you want messages to appear elsewhere on the screen you can change the default line (see Section 9.9, ASK| SET MESSAGELINE).

1.8 Using the [Tab] Key Features

When in INTOUCH, the [Tab] key can be used to perform various operations that cut down the time it takes to write program code. As you get familiar with INTOUCH and the INTOUCH language, you will find that the [Tab] key features can be very helpful.

1.8.1 [Tab] Key Indenting

When you use the [Tab] key at the INTOUCH prompt or while in the INTOUCH editor, you will find that [Tab] indents in the following ways:

1.8.2 Command Completion

When entering an INTOUCH command, you can enter part of the command, and then press the [Tab] key. INTOUCH will then supply the full name of the command. If the command is ambiguous, a selection menu of all valid choices will appear.

In the following example, INTOUCH completes so to form the command sort:



20  so[Tab]              <--- your entry 
 
20  sort                <--- INTOUCH supplies 

In this example, in is ambiguous, so INTOUCH provides a menu of choices:



                                                 +--Choices---+ 
                                                 |  INCLUDE   | 
                                                 |  INF       | 
                                                 |  INPUT     | 
                                                 +------------+ 
 
30      in 

1.8.3 Spelling Correction

The [Tab] key can be used to correct misspelled words in INTOUCH. Just position the cursor on the misspelled word and press the [Tab] key. The word will be replaced with its correct spelling. In the example below, the misspelled command SET STRCTRE is changed instantly to the correct command spelling when the [Tab] key is pressed.



50  set strctre[Tab]
50  set structure 

1.8.4 Expanding Abbreviations

INTOUCH uses abbreviations for a number of statements. You can use the [Tab] key with any of the specific abbreviations to expand the appreviations. To use this feature, enter an abbreviation and then press the [Tab] key. The current abbreviations that can be used are:
os. OPEN STRUCTURE
es. EXTRACT STRUCTURE
ee. END EXTRACT
in. INCLUDE
ex. EXCLUDE
fe. FOR EACH
e. EDIT
l. LIST
p. PRINT
pu. PRINT USING
ss. SET STRUCTURE
pa. PRINT AT
li. LINE INPUT
pc. PRINT #
oc. OPEN #
pe. PRINT _EXTRACTED
lm. LINE INPUT MENU
ls. LINE INPUT SCREEN

1.9 Other INTOUCH Features

You can enter INTOUCH program code at the INTOUCH prompt. You can also use the INTOUCH editor to create and change program code. Refer to Section 2.3.9, EDIT for information on the INTOUCH editor.

The appendix sections of this Guide provide information on INTOUCH's built-in fuctions, error and exception messages and other general topics. You will want to get familiar with the built-in functions as they will allow you to easily manipulate data.

Now that you have an idea of how to use and work in the INTOUCH environment, the remainder of this Guide will provide the information you need to create and use INTOUCH programs.


Chapter 2
INTOUCH Commands

2.1 Presentation of Command and Statement Information

Part of this chapter and several other chapters in this Guide describe the commands and statements in the INTOUCH language. The purpose of this section is to explain how the command and statement information is presented.

Statements that can only be used in connection with one another, such as IF THEN or the SELECT CASE statements, are described together. Each command and statement description includes the following information:

FORMAT:


        INPUT [options] var [, var...]                                (example 1) 
 
 
        EXTRACT STRUCTURE struc_name: KEY field = expr1 [TO expr2]    (example 2) 
                  --- 
                  ---  block of code 
                  --- 
        END EXTRACT 

The FORMAT contains the command or statement format. This includes the required keywords and the optional elements, if there are any.

Keywords are words that must be typed exactly as shown in the format. Keywords are shown in UPPER-CASE, e.g. EXTRACT STRUCTURE, KEY, TO, END EXTRACT. The elements in lower-case represent information that must be provided by the user in order to use the statement. For example, "struc_name" (the structure name) must be provided by the user in this statement. "field" and "expr1" information must also be provided.

Keywords and lower-case elements in brackets are optional. Multiple options are separated with commas.

INTOUCH is space sensitive, so spaces must be included where they are shown in the format. Either the single quote or double quote can be used as long as they are paired.

For information on elements (struc_name, expr1, etc.) and their representations, bracket usage and other conventions used in this Guide, you can refer to Conventions Used in this Manual.

EXAMPLE:


        10  INPUT 'Enter full name', TIMEOUT 30, ELAPSED x%: name$ 
            PRINT name$ 
            PRINT 'Elapsed time: '; x% 
        20  END 
 
        RNH 
        Enter full name? TTI Tester 
        TTI Tester 
        Elapsed time:  13 

The EXAMPLE shows how the command or statement is used. Wherever possible, the example is a full program rather than a program fragment.

You are encouraged to type in the INTOUCH examples and try running them.

PURPOSE:

In some cases, PURPOSE information is provided for usage clarity.

DESCRIPTION:

The DESCRIPTION is a detailed description of the command or statement which tells about the command or statement, explains how it works and other specific information.

2.2 About INTOUCH Commands

INTOUCH COMMANDS cause INTOUCH to take some action. You can use the commands at the INTOUCH prompt. For instance, in the following example, the command RUN executes the entered program.



10  INPUT 'Your name, please': name$ 
20  PRINT 'Hello, '; name$ 
30  END 
 
RUN 
NONAME       21-APR-1996 17:40 
Your name, please? Tester 
Hello, Tester 
 
INTOUCH

2.3 INTOUCH Commands

The following sections describe and explain how to use many of the INTOUCH commands.

2.3.1 NEW

FORMAT:


        NEW ['workspace_name'] 

EXAMPLE:



INTOUCH                       Program: print_name                               
The Next Generation Language  Status :                                          
 
 
 
 
INTOUCH
 
 
NEW 'print_name' 
 
INTOUCH
 
 
                                                                                
EXIT = Exit                                                \ = Back  HELP = Help

DESCRIPTION:

NEW clears current memory and assigns a name to the current workspace. The workspace name:

Whenever you begin writing a new program, type NEW followed by the name of the new program. If you do not enter a workspace name, INTOUCH uses the default name "NONAME".

When INTOUCH executes the NEW command, it clears current memory and assigns the name you specify or NONAME, if you do not specific a name, to the current workspace. The workspace name appears to the right of the "Program:" heading in the upper right corner of the screen.

Note

When you use the NEW command, current memory is cleared and any programs in memory are lost. Therefore, if you want to save what is in current memory, you need to do a SAVE or REPLACE before you use the NEW command. INTOUCH writes all active output buffers, closes all files and releases all storage.

2.3.2 SAVE

FORMAT:


        SAVE ['file_spec'] 

EXAMPLE:



SAVE 'print_name' 
 
INTOUCH

DESCRIPTION:

After a NEW program has been created, the SAVE command is used to save it for later use.

The SAVE command is used to save original files. An original file is one which has a unique file specification (i.e., there are no other files saved under that name). When INTOUCH saves a program, it is ordered sequentially by line number. INTOUCH saves programs as text files.

SAVE, with no file specification, saves your file under the current workspace name with an extension of .INT. You can include a complete file specification with the SAVE command. For example:


        SAVE 'testdisk:[programs]print_name' 

If a file specification is included, INTOUCH tries to save the file under the specification. (See the Command Language and DCL User's Guide Volume 2--Section 3, of the OpenVMS Version 5.5 documentation set for a description of file specifications.)

If you do not give a complete file specification, or if you do not give a directory, INTOUCH saves the program in your current (default) directory.

For the SAVE command, the file specification must be unique. If the file specification is not unique (if a file with the same name has already been saved), an exception will result. (Exceptions are discussed in Appendix C, INTOUCH's Error and Exception Messages.)

After you have saved a file once, you use the REPLACE command to save the copy or changed version.

2.3.3 REPLACE

FORMAT:


        REPLACE ['file_spec'] 

EXAMPLE:



REPLACE 'print_name' 
 
INTOUCH

DESCRIPTION:

After you make changes to a program, use REPLACE to save the new version.

The REPLACE command replaces the last version of your program with the version in current memory. If an earlier version of the file cannot be found, INTOUCH creates a new file with the specification given. file_spec is the specification for the file being replaced. If no file specification is included, INTOUCH uses the current workspace name and the default .INT.

If an earlier version does exist, INTOUCH saves the copy in current memory and increments the version number by 1. Previous versions of the file remain unchanged. The program in current memory is not changed when the REPLACE command is executed.

2.3.4 ABORT

FORMAT:


        ABORT [int_expr] 


Previous Next Contents Index