M!INTOUCH® 4GL Y

INTOUCH® 4GL
A Guide to the INTOUCH Language

A
Previous page... 6Table of Contents
^

6.1.7 Positioning the Cursor for the Next Print Statement



@If a separator (comma, semicolon, TAB function or AT option) is Bthe last item in the PRINT statement, INTOUCH advances the cursor Cto the position specified and does not generate a new line. 

        10  PRINT TAB(5); 7,             PRINT 10;             PRINT 20         20  END          RNH $              7              10  20 
T

6.1.8 Printing Attributes--Highlighting Options



DThe video attribute options highlight text on the screen. Separate @the options from the print list with a colon. The options are:    X     3     X     =  
BLINKcauses the expressions in the print list to blink in low and high intensity
UNDERLINEcauses the print list to be underlined
BOLDcauses the expressions in the print list to appear in bold (high intensity)
REVERSEcauses the print list to appear in reverse video


GThe video options can be combined. For example, the following program Gwill print "Hello" boldfaced and in reverse video. It will then blink "and underline the word "Goodbye". 

)        10  PRINT BOLD, REVERSE: 'Hello' 4        20  PRINT UNDERLINE, BLINK: 'Goodbye'               30  END 
7

6.1.9 USING Option



@The USING option is used to format text. The print mask 5indicates the format for the data in the print list. 

FORMAT:



        USING print_mask 


3The print_mask consists of fields or >directives and text. The text can precede or follow a Gfield or directive. The print mask tells how to print the expressions in the print list. 

                       fields                         /   \#        10  LET a$  = "#.## ##.##" -        20  PRINT USING "amount = #.##": 1.9 (        30  PRINT USING a$: 1.93, -1.93         40  END          RNH         amount = 1.90         1.93 -1.93 




The USING Print List



BExpressions in the print list with the USING option are separated Bby commas. A trailing semicolon is allowed. The expressions are Dprinted according to the the format. However, a trailing semicolon Acauses INTOUCH to leave the cursor at the end of the print line. 

4        10  PRINT USING "###.## ###.##": 22.88, 45; !        20  PRINT " and others."         30  END          RNH "         22.88  45.00 and others. 
3

6.1.10 Fields



NFields are made up of format characters. The format characters tell INTOUCH 1how to print the expressions in the print list. 

I

6.1.10.1 String Format Characters



# character



:The # is used to indicate a character position---a ?place in the format where a character can occur. For example: 

0        10  PRINT USING '#### ##': 'Test', 'Hi'         20  END          RNH         Test Hi 


FIn the above example, there are two fields. When the first string is Jprinted, the word "Test" occupies all four character positions. When the Jsecond expression is printed (Hi), only two character positions are used. 

FIf the string expression being printed is smaller than the field, the =expression will be printed centered within the field. 

2        10  PRINT USING '#### ####': 'Test', 'Hi'         15  PRINT '123456789'         20  END          RNH         Test  Hi         123456789 


HIf the string expression is longer than the field, INTOUCH generates an exception. 

J

6.1.10.2 Numeric Format Characters



# character



1The # can also be used to specify digits. .Each # represents one numeric digit position. 

!        10  PRINT USING "##": 19         20  END          RNH         19 


IIf you indicate more positions than the numeric expression contains, the ;expression will be right-justified and padded with spaces. 

         10  PRINT '1st 2nd 3rd' 2        20  PRINT USING "### ### ###": 193, 19, 1         30  END          RNH         1st 2nd 3rd         193  19   1 


HINTOUCH prints a minus sign in front of negative numbers. INTOUCH does 0not print a sign in front of positive numbers. 

         10  PRINT '1st 2nd 3rd' 3        20  PRINT USING "### ### ###": 193, 19, -1         30  END          RNH         1st 2nd 3rd         193  19  -1 


IIf you indicate more positions to the left of the decimal point than the Iexpression contains, the expression will be printed with leading spaces. 

&        10  PRINT USING "###.##": 1.9         20  END          RNH           1.90 


JIf you indicate more positions to the right of the decimal point than the Iexpression contains, the expression will be printed with trailing zeros. 

         10  PRINT '--1-- --2--' 1        20  PRINT USING "##.## ##.##": 1.3, 1.25         30  END          RNH         --1-- --2--          1.30  1.25 


< character



KThe less than sign left-justifies text within a field. The less than sign Imust appear at the beginning of a field. The less than sign counts as a Gcharacter position. In this example, justification occurs only in the second field. 

5        10  PRINT USING "#### <###": 'Test', 'Hi'         20  PRINT '123456789'         30  END          RNH         Test Hi         123456789 


FIn the above example, there are two fields. When the first string is Jprinted, the word "Test" occupies all four character positions. The less Gthan sign (<) causes INTOUCH to left-justify the second expression. 



> character



IThe greater than sign is used to right-justify text within a field. The Hgreater than sign must appear at the beginning of a field. The greater *than sign counts as a character position. 

5        10  PRINT USING "#### >###": 'Test', 'Hi'         20  PRINT '123456789'         30  END          RNH         Test   Hi         123456789 


JIn the above example, there are two fields. The greater than sign (>) 7causes INTOUCH to right-justify the second expression. 



@ character



CThe @ indicates one character position with no translation. 

%        10  PRINT USING '####': 0001 %        20  PRINT USING '@@@@': 0001         30  END          RNH 
           1 
        0001 


. character



KYou can include a decimal point in a number by putting a period or decimal point in the format. 

'        10  PRINT USING "###.##": 19.3         20  END          RNH          19.30 


, character



HYou can include commas in your numbers by putting commas in the format. 

        10  a$ = "##,###.##" %        20  PRINT USING a$: 28290.06 $            PRINT USING A$: 8290.06 #            PRINT USING A$: 290.06         30  END          RNH         28,290.06          8,290.06            290.06 


-Commas cannot be used in exponential format. 



% character



4The % character pads on the left with zeros. 

         10  PRINT '-1- -2- -3-' 2            PRINT USING "%%% %%% %%%": 193, 19, 1         20  END          RNH         -1- -2- -3-         193 019 001 


* character



8The * character pads on the left with asterisks. 6You can use this symbol for setting up check amounts. 

,        10  PRINT USING '***,***.**': 19.42         20  END          RNH         *****19.42 


IIf the expression is smaller than the format, INTOUCH will right justify 1the expression and pad it with asterisks. 

         10  PRINT '-1- -2- -3-' 2            PRINT USING "*** *** ***": 193, 19, 1         20  END          RNH         -1- -2- -3-         193 *19 **1 


+ character



KA plus sign causes INTOUCH to print a leading plus or minus sign. INTOUCH Hwill print a plus sign in front of positive numbers and a minus sign in front of negative numbers. 

NThe "+" sign adds a character position to the format. The character position $is used for the sign of the number. 

#        10  PRINT ' -1-  -2-  -3-' 6            PRINT USING "+### +### +###": 193, 19, -1         20  END          RNH          -1-  -2-  -3-         +193  +19   -1 


- character



LPrints a leading or trailing minus sign for negative numbers, and a leading Nspace for positive numbers. The "-" adds a character position to the format. AThe character position is used to print the minus sign or space. 

#        10  PRINT ' -1-  -2-  -3-' 6            PRINT USING "-### -### -###": 193, 19, -1         20 END          RNH          -1-  -2-  -3-          193   19   -1 


$ character



KPrints a floating dollar sign. The dollar sign appears before the number. I$ causes INTOUCH to print '$-' for negative numbers and '$' for positive >numbers. The minus sign appears immediately after the *dollar sign and before the number. 

$        10  PRINT "1st col 2nd col" 8            PRINT USING "$###.## $###.##": 11.93, -1.93         20  END          RNH         1st col 2nd col          $11.93  $-1.93 


$+ characters



KPrints a floating dollar sign. The dollar sign appears before the numeric Nexpression. $+ causes INTOUCH to print a minus sign before negative numbers, *and a plus sign before positive numbers. 

>The sign appears after the dollar sign and before the number. 

&        10  PRINT "1st  col 2nd  col" :            PRINT USING "$+###.## $+###.##": 11.93, -1.93         20 END          RNH         1st  col 2nd  col          $+11.93   $-1.93 


-$ characters



KPrints a floating dollar sign. The dollar sign appears immediately before Hthe numeric expression. -$ causes INTOUCH to print a minus sign before Bnegative numbers and a space before positive numbers. The @minus sign or space appears immediately before the dollar sign. 

&        10  PRINT "1st  col 2nd  col" :            PRINT USING "-$###.## -$###.##": 11.93, -1.93         20  END          RNH         1st  col 2nd  col           $11.93   -$1.93 


+$ characters



L+$ causes INTOUCH to print a floating dollar sign. The dollar sign appears Nimmediately before the number. +$ causes INTOUCH to print a plus sign before Npositive numbers and a minus sign before negative numbers. The plus or minus 1sign appears immediately before the dollar sign. 

&        10  PRINT "1st  col 2nd  col" :            PRINT USING "+$###.## +$###.##": 11.93, -1.93         20  END          RNH         1st  col 2nd  col          +$11.93   -$1.93 


INotice that +$ adds two character positions to the format. One position Econtains the dollar sign, the other contains the plus or minus sign. 



$- characters



KPrints a floating dollar sign. The dollar sign appears before the number. F$- causes INTOUCH to print a minus sign before negative numbers and a ?space before positive numbers. The minus sign or space 5appears after the dollar sign and before the number. 

&        10  PRINT "1st  col 2nd  col" :            PRINT USING "$-###.## $-###.##": 11.93, -1.93         20  END          RNH         1st  col 2nd  col          $ 11.93   $-1.93 


DIf your expression is too large to fit in a field, INTOUCH gives an exception. 

7

6.1.11 Directives



>The directives used with the USING option of the PRINT 1statement tell INTOUCH what to do with the text. 

FORMAT:



+        PRINT USING 'directive' : str_expr 
9

6.1.11.1 {UCASE}?



?The UCASE directive converts the str_expr to upper-case characters. 

-        10  PRINT USING '{UCASE}?' : 'march'         20  END          RNH         MARCH 
9

6.1.11.2 {LCASE}?



?The LCASE directive converts the str_expr to lower-case characters. 

-        10  PRINT USING '{LCASE}?' : 'MARCH'         20  END          RNH         march 
9

6.1.11.3 {HYPHEN}



;The HYPHEN directive causes INTOUCH to suppress the Hhyphen character if it is the last non-blank character after the format is applied. 

4        10  PRINT USING '<#####~-####' : '92123' <            PRINT USING '{HYPHEN}<#####~-####' : '92123'         20  END          RNH         92123 -         92123 
C

6.1.11.4 {DATE [argument]}?



HGiven a str_expr that contains a date in the format YYMMDD or CCYYMMDD, @the DATE directive converts the str_expr to a default or ,specified, optionally-masked, date format. 

"These date arguments can be used: CYMD, CYMD, MDY, MDCY, DMY, DMCY, DMONY, DMONCY, MONTHDY, MONTHDCY. 1If no argument is provided, the default is MDCY. C(See FORMAT$(expr, str_expr) for examples of date argument usage.) 

FTo format the resulting date, replace the ? with a print mask. 

,        10  PRINT USING '{DATE}?': '950401' 0            PRINT USING '{DATE DMY}?': '950401' 1            PRINT USING '{DATE DMCY}?': '950401'             PRINT 2            PRINT USING '{DATE MDY}?': '19950215' 9            PRINT USING '{DATE MDY}##/##/##': '19950215' <            PRINT USING '{DATE MDCY}##/##/####': '19950215'         20  END          RNH         04011995         010495         01041995          021595         02/15/95         02/15/1995 
<

6.1.11.5 {ROTATE n}?



?The ROTATE directive rotates the last n characters in a Kstr_expr to the first position in the str_expr. Optionally, the resulting Dstr_expr can be masked by replacing the ? with a print mask. 

4        10  PRINT USING '{ROTATE 3}?': '5552527800' A            PRINT USING '{ROTATE 3}###~ ###~-####': '5552527800'             PRINT 3            PRINT USING '{ROTATE 5}?': 'TuneTommy' =            PRINT USING '{ROTATE 5}#####~ ####': 'TuneTommy'         20  END          RNH         8005552527         800 555-2527          TommyTune         Tommy Tune 
8

6.1.11.6 {TIME}?



HGiven a str_expr containing a 4 digit time in HHMM or HH:MM format or a ;6 digit time in HHMMSS or HH:MM:SS format, the TIME Bdirective converts the str_expr to HH:MM AM/PM or HH:MM:SS AM/PM. 

*        10  PRINT USING '{TIME}?': '1022' +            PRINT USING '{TIME}?': '19:45'             PRINT ,            PRINT USING '{TIME}?': '102255' .            PRINT USING '{TIME}?': '19:45:36'         20  END          RNH         10:22 AM         07:45 PM          10:22:55 AM         07:45:36 PM 
;

6.1.11.7 {ZIPCODE}?



;Given a str_expr containing a 5, 6 or 9 digit zipcode, the 5ZIPCODE directive converts the str_expr to an appropriate zipcode format. 

,        10  PRINT '5 character zipcode : '; .            PRINT USING '{ZIPCODE}?': '92126' ,            PRINT '6 character zipcode : '; /            PRINT USING '{ZIPCODE}?': 'K8A3P9' ,            PRINT '9 character zipcode : '; 2            PRINT USING '{ZIPCODE}?': '931327845'         20  END          RNH $        5 character zipcode : 92126 &        6 character zipcode : K8A 3P9 )        9 character zipcode : 93132-7845 
?

6.2 Using the INTOUCH Screen



IINTOUCH has several features that allow you to control the appearance of 5the screen. The FRAME ON and FRAME OFFFcommands discussed previously turn the INTOUCH frame on and off. The Hstatements described in the following sections can be used, within your #program, to manipulate the screen. 

.

6.3 MESSAGE



>The MESSAGE statement prints a message at line 23 (the Gdefault line) on the screen. When the INTOUCH frame is on, line 23 is within the lower frame. 



FORMAT:



4        MESSAGE [ERROR: | DELAY:] expr [; | , expr] 


EXAMPLE:



        10  CLEAR             PRINT AT 1,1:         20  DO +              MESSAGE 'Enter EXIT to exit' 4              INPUT 'Please enter your name': name$               IF  _EXIT  THEN "                MESSAGE 'The End'                 EXIT DO               ELSE                 PRINT name$                 REPEAT DO               END IF             END DO         30  END          RNH          Please enter your name?  O                               Enter EXIT to exit       (first message)  '        Please enter your name? Tester         Tester %        Please enter your name? exit  P                                    The End             (second message) 


DESCRIPTION:





LINTOUCH uses the message line (defaults to line 23) to display messages and Lerrors. You can use the MESSAGE statement to display your own messages and errors on this line. 

IWhen the INTOUCH frame is on, your messages will appear within the lower Iframe. The MESSAGE statement can print several items. Each item can be Lany INTOUCH numeric or string expression. Multiple items must be separated Awith a comma or a semicolon. The separator determines where the (next expression will be printed. 

Semicolons

JSeparating message items with a semicolon causes the items to immediately Jfollow one another. When the items are printed, no spaces appear between the items. 

Commas

>Separating items with a comma puts a space between each item. 

$INTOUCH would display this message: 

+        MESSAGE 'number is', 123; 456; 789 


as: 

        number is 123456789 



ERROR Option





JINTOUCH displays a message for at least three seconds before clearing the >message. When the ERROR option is used, INTOUCH rings Kthe device's bell, purges typeahead and displays the message. (Typeahead Mis the feature that accepts characters typed ahead of the computer's request for input.) 





FORMAT:



)        MESSAGE ERROR: expr [; | , expr] 


EXAMPLE:



        10  CLEAR             PRINT AT 1,1: )            INPUT 'Enter your age': age$ 6            MESSAGE ERROR: 'Is this really your age?'         20  END          RNH         Enter your age? 99   ;                            Is this really your age?


DELAY Option





8The DELAY option of the MESSAGE statement causes DINTOUCH to set an automatic delay, giving the user time to view the Gmessage before clearing the message. Starting with a minimum delay of Fapproximately three seconds, INTOUCH increases the delay a little for lengthier messages. 



FORMAT:



)        MESSAGE DELAY: expr [; | , expr] 


FORMAT:



        10  CLEAR M            z$ = 'This is a very, very, very, very, very, very long message'             MESSAGE DELAY: z$ +            MESSAGE DELAY: 'Short message'         20  END          RNH  K           This is a very, very, very, very, very, very long message  5                                 Short message
,

6.4 DELAY



FORMAT:



        DELAY [num_expr] 


EXAMPLE:



"        10  PRINT 'Waiting a bit'         20  DELAY 4.5         30  PRINT 'Done'         40  END          RNH         Waiting a bit 
        Done 


PURPOSE:





=Use DELAY when you need to cause a timed delay before Fcontinuing program execution---for instance, to give the user time to +read a message before clearing the screen. 



DESCRIPTION:





IDELAY causes INTOUCH to pause for the specified number of seconds before Hcontinuing program execution. The numeric expression, num_expr, Idoes not have to be a whole number, you can use fractions. For example: 

        DELAY 3.5 


BIf num_expr is omitted, INTOUCH prints this message at the bottom of the screen: 

5                    Press the RETURN key to continue 
#and waits for the user to respond. 

4If, at the "Press RETURN..." prompt, a user enters:    %     %     %  
Ctrl/Z _EXIT is set to TRUE (1)
\ or UP-arrow _BACK is set to TRUE (1)
Help _HELP is set to TRUE (1)




,

6.5 CLEAR



CThe CLEAR statement can be used to clear the INTOUCH screen I(everything within the INTOUCH frame) or to clear a specific area of the Kscreen. CLEAR can be used to clear any rectangular area within the frame. IWhen the INTOUCH frame is off, the entire screen can be manipulated with Ithe CLEAR statement. CLEAR always removes messages, even if they are in Lthe frame. You can use this statement to clear the screen before executing ,code or printing information on the screen. 



FORMAT:



E        CLEAR [AREA [BOX] [, attr_list:] row_1, col_1, row_2, col_2] 


EXAMPLE:



        10  CLEAR 2            INPUT 'Please enter your name': name$ #            PRINT 'Hello, '; name$         20  END          RNH '        Please enter your name? Tester         Hello, Tester 


DESCRIPTION:





JCLEAR, by itself, clears all text from the screen. CLEAR does not remove Jthe INTOUCH frame if the frame is on, however, it does remove any message Ftext that is displayed within the frame. If the frame is on, INTOUCH 'positions the prompt within the frame. 





AREA Option





@The AREA option clears a specific section of the screen. *The cleared area is rectangular in shape. 

Brow specifies a vertical position on the screen. Rows are Jnumbered sequentially from the top of the screen to the bottom. With the JINTOUCH frame on, there are typically 19 rows. With the frame off, there Kare usually 24 rows (The number of rows can vary depending on the terminal type and setting.) 

Dcol specifies a column--a horizontal position on the screen. KColumns are numbered sequentially from the first character position on the Nleft of the screen to the last character position on the right of the screen. PUsually there are either 80 or 132 columns (depending on the terminal setting). 

)                              columns    +                        /                 \,                       /                   \-                       1 2 3 4 5 6 7 8 9 ...  2    row 1 ------      | | | | | | | | | | | | | | 2                      --------------------------- 2    row 2 ------      | | | | | | | | | | | | | | 2                      --------------------------- 2    row 3 ------      | | | | | | | | | | | | | |  
        . 
        . 
        . 


LTwo coordinates must be specified. These coordinates mark opposite corners Iof a rectangular area. INTOUCH clears the rectangular area specified by Hthese two coordinates. For instance, the statement CLEAR AREA 2,3,8,20 would clear a rectangular area: 

.    1st coordinate (2,3)   +----------------+ .                           |                | .                           |                | .                           |                | .                           |                | .                           |                | F                           +----------------+   (8,20) 2nd coordinate 


<The first coordinate (2,3) indicates the upper-left corner. ?The second coordinate (8,20) indicates the lower-right corner. 



)

FORMAT:



4


Next page... | 6Table of Contents