INTOUCH® 4GL
Application Development Guide


Previous Contents Index

12.2.7 NEXT - Next Help File to Maintain

If you have completed maintenance to the current help text file and want to maintain a different help file, the NEXT menu option allows you to select another existing help text file to maintain.

You are asked to enter the name of the next help text file that you want to maintain. After the name is entered, the file is opened and you can add topics or perform topic maintenance.

If the entered help text file is not found, an error message is displayed and you are asked for another help file name.

If you need to create a new help file, you can use the CREATE procedure.

12.2.8 PRINT - Print a HELP.LIS

The PRINT procedure creates a list of the topics and text in the help file you are maintaining. The topics are listed in alphabetical order.

You are asked if you want to proceed with list creation. If "Yes", the list is created. After creation, a print options menu is displayed and you can select where you want to print or display the list. SCREEN is the default option which displays the list on your screen.

The name of the list file is SYS$SCRATCH:HELP.LIS. Here is an example of part of a list:



BIRTH_DATE 
 
    Enter the 8-character birth date in MMDDYYYY format. 
 
 
CITY 
 
    Enter the city. 
 
 
FIRST_NAME 
 
    Enter the first name. 
 
 
INITIAL 
 
    Enter the 1-character middle initial. 
 
 
LAST_NAME 
 
    Enter the last name. 
 
 
MENU OPTION 
 
    Use the up- and down-arrow keys to select the menu option  OR 
    enter as many characters as necessary of the option name  AND 
    then press the RETURN key. 
 
      Select  ADD      to add new records to the file. 
      Select  CHANGE   to change field information in existing records. 
      Select  DELETE   to delete existing records from the file. 
      Select  INQUIRE  to view the contents of existing records. 
 
 
PROBLEM 
 
    Enter a description of the problem. 
 
    Press the PF1 and F keys simultaneously when finished. 
 

12.2.9 SHOW - Display a List of Topics

If you want to see what topics are in your help text file, you can select the SHOW procedure.

The SHOW procedure displays a list of all the topics in the help text file. The topics are listed in alphabetical order.

Here is an example of output created by the SHOW option:



 30-Apr-1997             Maintain: APPLICATION_HELP.DAT             Option: SHOW
  birth_date 
  city 
  first_name 
  initial 
  last_name 
  menu option 
  problem 
  proceed_add 
  proceed_change 
  proceed_delete 
  solution 
  ssn 
  st 
  zip 
 
 
 
 
 
                        Press the RETURN key to continue 
EXIT = Exit                                                \ = Back  HELP = Help

12.2.10 RELATED - Display a List of Related Topics

If you want to find out what topics are "Related topics" in other topic text, select the RELATED procedure.

The RELATED procedure asks for a topic and displays a list of the other topics that include the topic you entered as a "Related topic".

This procedure is helpful if you want to delete a topic and need to find out if it is included in the text of other topics. You can also run the PRINT option and compare the two lists.

The RELATED list appears as follows:



 30-Apr-1997             Maintain: APPLICATION_HELP.DAT          Option: RELATED
Topic RELATED is a "Related topic" in these topics: 
  procedure                             rename 
  rename current 
 
 
 
 
 
 
 
 
 
 
Topic: 
 
                         RELATED is related in 3 topics 
EXIT = Exit                                                \ = Back  HELP = Help

12.3 Using the Help System in Programs

The Help System is available when writing INTOUCH programs. There are several requirements when you use the Help System in your programs.

The following lines of code MUST be part of your INTOUCH program source code. Also, the source code lines MUST be in this order. However, the lines need not be one after the other, they can be located in different sections of your program. The required source code lines are:


        %include "tti_run:help.inc" 
 
        help_structure$ = "help_file_name.DAT" 
        help_initialize 

The above "%include" statement includes the HELP.INC module (located in TTI_RUN:) into your program. This is the module that actually displays the help text to the user when they enter HELP or press the [Help] key.

The other source code lines identify the help text file that you are using in your program and initialize it. help_file_name.DAT is the name of your help text file.

12.3.1 Help Topics in Program Source Code

If you want to use the Help System in your INTOUCH program, you simply identify which help topic to use and "gosub" to the HELP module.

For each input prompt that you want to display help information for, you would include these lines of source code:


        if  _help  then 
          help_topic$ = 'topic_name' 
          gosub help 
             . 
             . 
             . 
        end if 

The topic_name must be a topic name that exists in your help text file. gosub help tells the HELP module to display the help text information associated with topic_name. The internal variable _help is set to TRUE if the user enters HELP or presses the [Help] key.

Here is a common type of input routine which displays help text:


        routine ask_city 
 
        do 
          line input prompt 'Enter city': city$ 
          if  _exit  or  _back  then exit routine 
          if  _help  then 
            help_topic$ = 'city' 
            gosub help 
            repeat do 
          end if 
        end do 
 
        end routine 


Appendix A
Sample Program

Here is a sample program which shows correct logic flow and how routines and loops are used. The routine headers tell what the routines do.


1       program application_a_1       
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! Program: CONVERT_DATE_TIME.INT 
        ! Package: INTOUCH Examples 
        ! Author : Fred Jones 
        ! Date   : June 1, 1996 
        ! Purpose: Ask the user for a date and time.  Convert the date 
        !          and time to various formats. 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
 
1000    !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! M A I N   L O G I C 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Set up the first action and dispatch to that action. 
        ! 
        ! Expected: 
        ! 
        ! Locals: 
        ! 
        ! Results: 
        !       action$ = contains the name of the first routine 
        !                 to be executed 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        action$ = 'ask_date' 
 
        do until action$ = 'exit' 
          dispatch action$ 
        loop 
        stop 
 
 
12000   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! A S K   D A T E 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Clear the screen.  Ask the user for a date in MMDDYYYY format. 
        !   Change the input date to YYYYMMDD format.  Convert the date to 
        !   various formats. 
        ! 
        ! Expected: 
        ! 
        ! Locals: 
        !       in_date$ = user input date in MMDDYYYY format 
        ! 
        ! Results: 
        !       user_date$ = user input date in YYYYMMDD format 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        routine ask_date 
          clear 
          message 'Enter a date in MMDDYYYY format' 
          line input 'Date', at 3,1, valid 'date MDY', length 8: in_date$ 
          if  _back  or  _exit  then 
            action$ = 'exit' 
            exit routine 
          end if 
          user_date$ = in_date$[5:8] + in_date$[1:4] 
          convert_date 
          action$ = 'ask_time' 
        end routine 
 
 
13000   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! A S K   T I M E 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Ask the user for a time in HHMM 24-hour format.  Validate the 
        !   input time.  Convert the 24-hour format to 12-hour format. 
        ! 
        ! Expected: 
        ! 
        ! Locals: 
        !       in_time$ = user entered time in 24 hour format - HHMM 
        ! 
        ! Results: 
        !       hour$ = hour 
        !       minute$ = minute 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        routine ask_time 
          message 'Enter the time in 24-hour HHMM format - 0030, 1215, 2245' 
          input 'Time', at 4,1, valid 'digits', length 4: in_time$ 
          if  _back  then 
            action$ = 'ask_date' 
            exit routine 
          end if 
          if  _exit  then 
            action$ = 'exit' 
            exit routine 
          end if 
          hour$ = in_time$[1:2] 
          minute$ = in_time$[3:4] 
          if  val(hour$) > 24  or  val(minute$) > 60  then 
            message error: 'Invalid time' 
            repeat routine 
          end if 
          convert_time 
          action$ = 'print_date_time' 
        end routine 
 
 
14000   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! P R I N T   D A T E   T I M E 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Print the date and time formats to the screen. 
        ! 
        ! Expected: 
        !       u_day          = "julian" of entered date 
        !       u_day$         = day of week (Monday, Tuesday, etc.) 
        !       u_yyyymmdd$    = yymmdd version of entered date 
        !       u_mmddyyyy$    = mmddyy version of entered date 
        !       u_ddmonyyyy$   = dd-mon-yyyy version of entered date 
        !       u_monthddyyyy$ = month dd, yyyy version of entered date 
        !                        (padded to 18 characters) 
        !       u_time$ = HH:MM AM  or  HH:MM PM 
        ! 
        ! Locals: 
        ! 
        ! Results: 
        !       dates are displayed on the screen 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        routine print_date_time 
          print at 6,1: 'Date formats:'; 
          print bold, at 6,15: u_day; '- Julian date' 
          print bold, at 7,16: u_day$; ' - day of week' 
          print bold, at 8,16: u_yyyymmdd$; ' - yyyymmdd version' 
          print bold, at 9,16: u_mmddyyyy$; ' - mmddyyyy version' 
          print bold, at 10,16: u_ddmonyyyy$; ' - dd-mon-yyyy' 
          print bold, at 11,16: rtrim$(u_monthddyyyy$); ' - month day, year' 
          print at 13,1: 'Time format :'; 
          print bold, at 13,16: u_time$ 
          action$ = 'exit' 
        end routine 
            
 
15000   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! C O N V E R T   D A T E 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Convert the date to various date formats. 
        ! 
        ! Expected: 
        !       user_date$ = input date in YYYYMMDD format 
        ! 
        ! Locals: 
        ! 
        ! Results: 
        !       u_day          = "julian" of entered date 
        !       u_day$         = day of week (Monday, Tuesday, etc.) 
        !       u_yyyymmdd$    = yymmdd version of entered date 
        !       u_mmddyyyy$    = mmddyy version of entered date 
        !       u_ddmonyyyy$   = dd-mon-yyyy version of entered date 
        !       u_monthddyyyy$ = month dd, yyyy version of entered date 
        !                        (padded to 18 characters) 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        routine convert_date 
          u_day          = days(user_date$) 
          u_day$         = day$(u_day) 
          u_yyyymmdd$    = date$(u_day, 0) 
          u_mmddyyyy$    = date$(u_day, 1) 
          u_ddmonyyyy$   = date$(u_day, 3) 
          u_monthddyyyy$ = rpad$(date$(u_day, 4), 18) 
        end routine 
 
 
16000   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! C O N V E R T   T I M E 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        ! 
        ! Brief description: 
        !   Convert the time (hour and minute) to a 12-hour time format. 
        ! 
        ! Expected: 
        !       hour$ = hour 
        !       minute$ = minute 
        ! 
        ! Locals: 
        ! 
        ! Results: 
        !       u_time$ = HH:MM AM  or  HH:MM PM 
        ! 
        !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        routine convert_time 
          select case hour$ 
          case is < '12' 
            u_time$ = hour$ + ':' + minute$ + ' AM' 
          case is = '12' 
            u_time$ = hour$ + ':' + minute$ + ' PM' 
          case is > '12' 
            z1% = val(hour$) 
            z1% = z1% - 12 
            u_time$ = lpad$(str$(z1%), 2, '0') + ':' + minute$ + ' PM' 
          end select 
        end routine 



Date? 07041994 
Time? 1645 
 
Date formats:  144091 - Julian date 
               Monday - day of week 
               19940704 - yyyymmdd version 
               07041994 - mmddyyyy version 
               04-Jul-1994 - dd-mon-yyyy 
               July 4, 1994 - month day, year 
 
Time format :  04:45 PM 
 


Appendix B
User Notes


Index Contents