.; SUBMISSION FOR FALL 1985 DECUS RSX SIG TAPE
.;
.;                             MENU.CMD
.;
.;  This indirect command procedure can be used by any M-PLUS system
.;  which has the appropriate DEC and DECUS software installed.  It frees
.;  the inexperienced user from having to memorize options and switches
.;  for the various utilities.  We have installed MENU.CMD in a default
.;  ICP directory (taskbuild option for ICP), so that any user can access
.;  it by simply typing in @MENU.  Optionally, it can be invoked from
.;  the LOGIN.CMD file of each user who wants to use it.
.;
.;  This procedure allows the user to do some things otherwise next-to-
.;  impossible to do without it.  For example, it allows the output of
.;  RUNOFF to be sent to either the terminal screen, an attached letter
.;  quality printer (LA100), or spooled to the lineprinter.  Sending output
.;  to an LA100 attached to the printer port of a VT100 or VT2xx terminal
.;  requires the proper escape sequence to turn on the port, and the only
.;  clean way to do this is to let IND issue the turn-on escape sequence,
.;  invoke RNO when .ENABLEd QUIET, and then issue the turn-off sequence.
.;
.;  Finally, it can be used by just about everyone, because it allows 
.;  entry of MCR or DCL commands.  This is handy for compiling, taskbuilding,
.;  etc. 
.;
.;        =====================  N  O  T  E  ==============
.;
.; THIS PROCECURE CANNOT BE USED AS IS.  YOU MUST EDIT INTO THIS PROCEDURE
.; SOME TABLES WHICH SET UP DEVICE,UIC, AND NAME CORRESPONDENCES.  THESE
.; CAN BE QUICKLY LOCATED BY USING EDT AND SEARCHING FOR THE STRING:
.;                            *NOTE*
.; EXAMPLES OF WHAT TO ENTER FOR YOUR INSTALLATION ARE GIVEN.
.; ALSO, YOU WILL HAVE TO CREATE A FILE IN LB:[2,5] WHICH IS SIMPLY
.; A TEXT FILE CONTAINING NAMES AND PHONE NUMBERS.  TO CHANGE THE DEFAULT
.; LOCATION OF THIS PHONEBOOK, MODIFY THE APPROPRIATE LINE NOTED AS ABOVE.
.;
.;  DECUS Software used: RUNOFF (Clement's, Bonner Lab)   (...RNO)
.;                       LIST                             (...LIS)
.;                       SRD (the latest (?!?))           (...SRD)
.;                       CALC                             (...CAL)
.;                       DTC                              (...DTC)
.;                       MAIL  (see DECUS pgm: ARC MAIL doc. for installation)
.;                       SPELL and DCTNRY      (...SPE and ...DCT)
.;
.;  ONE FINAL NOTE: Most of you ICP experts out there will notice that
.;                  this procedure is not exactly a sterling example of
.;                  beautiful ICP "code". But, nevertheless, it DOES get
.;                  the job done.  The original idea was to make it easier
.;                  to use RUNOFF; ie. to allow output to be selected by
.;                  the user.  However, after a few weeks, and hundreds of
.;                  hacks, this is what evolved.
.;
.;  Any questions, suggestions or bug fixes?  Send to: Jim Shultz
.;                                                     U.S. Dept. of Agriculture
.;                                                     Nutrient Composition Lab
.;                                                     Room 216 Bldg. 161 BARC-E
.;                                                     Beltsville, MD  20705
.;                                                     (301) 344-2147
.;
.ENABLE SUBSTITUTION
.ENABLE GLOBAL
.DISABLE LOWERCASE
.DISABLE DISPLAY
.SETN NESC 33
.SETS ESC "'NESC%V'"
.;
.;  TERMINAL CHARACTERISTICS FOR VT52'S AND VT100'S ONLY!
.;
.IF <TITYPE> EQ 15 .SETT VT100
.IF <TITYPE> EQ 11 .SETF VT100
.IFNDF VT100 .OPEN TI:
.IFNDF VT100 .DATA >>> Sorry.... Menu will only work with VT100 or VT52 emulators only <<<
.IFNDF VT100 .CLOSE TI:
.IFNDF VT100 .EXIT
.OPEN TI:
.DATA 
.DATA Welcome to the MENU! Please wait while I initialize a few things.
.DATA 
.CLOSE TI:
.ENABLE LOWERCASE
.;
.;  ASSIGN ESCAPE SEQUENCES FOR VT100'S .....
.;
.IFT VT100 .SETS BOLD ESC+"[1m"
.IFT VT100 .SETS BLINK ESC+"[5m"
.IFT VT100 .SETS NORM ESC+"[0m"
.IFT VT100 .SETS CLEAR ESC+"[H"+ESC+"[2J"
.IFT VT100 .SETS CLEOL ESC+"[K"
.IFT VT100 .SETS RST ESC+"c"
.IFT VT100 .SETS TMOV1 ESC+"[1;37H"
.IFT VT100 .SETS TMOV2 ESC+"[22;28H"
.IFT VT100 .SETS RPT ESC+"[2A
.;
.;  ASSIGN ESCAPE SEQUENCES FOR VT52'S .....
.;
.IFF VT100 .SETS BOLD ""
.IFF VT100 .SETS BLINK ""
.IFF VT100 .SETS NORM ""
.IFF VT100 .SETS CLEAR ESC+"H"+ESC+"J"
.IFF VT100 .SETS CLEOL ESC+"K"
.IFF VT100 .SETS RST ESC+"z"
.IFF VT100 .SETS TMOV1 ESC+"Y D"
.IFF VT100 .SETS TMOV2 ESC+"Y5;"
.IFF VT100 .SETS RPT ESC+"A"+ESC+"A"
.;
.SETF DCLI
.IF <CLI> EQ "DCL" .SETT DCLI
.ENABLE QUIET
.ENABLE DECIMAL
.IFF DCLI SET /DCL=TI:
.OPEN TI:
.MENU:

.ENABLE QUIET
.ENABLE CONTROL-Z
.SETF <EOF>
.ENABLE LOWERCASE
.GOSUB GETTIM
.ENABLE DATA
'CLEAR'                    >> The Time is: 'TIME3' <<
+----------------------------------------------------------------------+
|                        M A I N   M E N U                             |
|                                                                      |
|       Option No.            Function                                 |
|       ----------            --------                                 |
|           1  ............   'BOLD'EDT'NORM' - Create or Edit File                |
|           2  ............   'BOLD'RNO'NORM' - Document Formatter                 |
|           3  ............   'BOLD'LIST'NORM' - List a file on terminal           |
|           4  ............   'BOLD'PRINT'NORM' - Print file on line printer       |
|           5  ............   'BOLD'SPELL'NORM' - Spelling Checker                 |
|           6 .............   'BOLD'FILE SERVICES'NORM' - Directory Functions      |
|           7 .............   'BOLD'MAIL'NORM' - Electronic Mail Service           |
|           8 .............   'BOLD'DTC'NORM' - Appointment Scheduler/Viewer       |
|           9 .............   'BOLD'CALC'NORM' - Calculator Mode                   |
|           10 ............   'BOLD'PHONE'NORM' - Phone Nos. for NCL Staff         |
|           11 ............   'BOLD'>>OPSYS<<'NORM' - Operating System Services    |
|           12  ...........   'BOLD'>>BYE<<'NORM' - Log off the System             |
|           13  ...........   'BOLD'>>STATUS<<'NORM' - Display User Status         |
|           14  ...........   'BOLD'>>RESET<<'NORM' - RESET terminal               |
+----------------------------------------------------------------------+
 
.DISABLE DATA
.DISABLE LOWERCASE
.SETS OPT ""
.SETS DUMMY ""
.AGN:

.ASKS [:::1M] OPT           Enter Option No. 'CLEOL'
.IFT <EOF> .GOTO FINIS
.IFT <TIMOUT> .ENABLE LOWERCASE
.IFT <TIMOUT> .GOSUB GETTIM
.IFT <TIMOUT> .DATA 'TMOV1''CLEOL''TIME3' <<'TMOV2'
.IFT <TIMOUT> .DISABLE LOWERCASE
.IFT <TIMOUT> .GOTO AGN
.IF OPT = "" .DATA 'RPT'
.IF OPT = "" .GOTO AGN
.SETS OPT2 OPT[1:3]
.IF OPT2 = "EXI" .OR .IF OPT2 = "QUI" .GOTO FINIS
.IF OPT2 = "0" .OR .IF OPT2 = "MCR" .OR .IF OPT2 = "DCL" .GOTO OPSYS
.IF OPT2 = "1" .OR .IF OPT2 = "EDT" .GOTO EDT
.IF OPT2 = "2" .OR .IF OPT2 = "RNO" .GOTO RNO
.IF OPT2 = "3" .OR .IF OPT2 = "LIS" .GOTO LIST
.IF OPT2 = "4" .OR .IF OPT2 = "PRI" .GOTO PRI
.IF OPT2 = "5" .OR .IF OPT2 = "SPE" .GOTO SPELL
.IF OPT2 = "6" .OR .IF OPT2 = "FIL" .GOTO FILSVC
.IF OPT2 = "7" .OR .IF OPT2 = "MAI" .GOTO MAIL
.IF OPT2 = "8" .OR .IF OPT2 = "DTC" .GOTO DTC
.IF OPT2 = "9" .OR .IF OPT2 = "CAL" .GOTO CALC
.IF OPT2 = "10" .OR .IF OPT2 = "PHO" .GOTO PHONE
.IF OPT2 = "11" .OR .IF OPT2 = "OPS" .GOTO OPSYS
.IF OPT2 = "12" .OR .IF OPT2 = "BYE" .GOTO BYE
.IF OPT2 = "13" .OR .IF OPT2 = "STA" .GOTO STATUS
.IF OPT2 = "14" .OR .IF OPT2 = "RES" .GOTO RESET
.DATA 'CLEAR'
.ENABLE QUIET
'OPT'
.DISABLE QUIET
.ASKS DUMMY Hit [RETURN] to return to Main Menu
.GOTO MENU
.;
.;
.STATUS:
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       C U R R E N T   S T A T U S                       |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.IFT VT100 .SETS TTTYP "VT100"
.IFF VT100 .SETS TTTYP "VT52"
.PARSE <ACCOUN> " ," LNAM FINI SID ACNT CPU SYS QIO TAS ACT JUNK
.TESTFILE TI:
.PARSE <FILSPC> ":" TTNO JUNK
.SETS SPED ""
.DISABLE DECIMAL
.IF <TISPED> = 11 .SETS SPED "300 baud"
.IF <TISPED> = 13 .SETS SPED "1200 baud"
.IF <TISPED> = 16 .SETS SPED "2400 baud"
.IF <TISPED> = 20 .SETS SPED "4800 baud"
.IF <TISPED> = 22 .SETS SPED "9600 baud"
.ENABLE DECIMAL
.ENABLE DATA
System: '<NETNOD>'   Operating System: RSX-11M-PLUS  BL'<SYSID>'   Memory: '<MEMSIZ>' K words
 
	Logged on : 'LNAM'	Login UIC: '<LOGDEV>':'<LOGUIC>'
                         	Current UIC: '<SYDISK>''<SYUNIT>':'<UIC>'
 
	Terminal in Use: 'TTNO'   Type: 'TTTYP' class     Speed: 'SPED'
	Session ID: 'SID'
	Account No: 'ACNT'
	CPU ticks used: 'CPU'
	System Directives issued: 'SYS'
	I/O Directives issued: 'QIO'
	Tasks run since login: 'TAS'
	Tasks currently active for 'LNAM': 'ACT'
 
.DISABLE DATA
.ASKS DUMMY Hit [RETURN] to return to Main Menu.
.IFT <EOF> .GOTO MENU
.GOTO MENU
.;
.;
.OPSYS:
.ENABLE QUIET
.DATA 'CLEAR'
.SETS TMCLI OPT2
.IF TMCLI NE "MCR" .IF TMCLI NE "DCL" .ASKS TMCLI Which CLI ? (MCR or DCL): 
.IF TMCLI EQ "MCR" SET MCR=TI:
.IF TMCLI NE "MCR" .IF TMCLI NE "DCL" .GOTO OPSYS
.ENABLE DATA
 
   You may now enter 'TMCLI' commands to the system, just as if you
   were in the operating system.  Enter Ctrl-Z to return to Main Menu.
 
 
.DISABLE DATA
.ENABLE CONTROL-Z
.PRMT:
.ASKS CLISTR 'TMCLI'>>
.IFT <EOF> .IF TMCLI EQ "MCR" SET /DCL=TI:
.IFT <EOF> .GOTO MENU
'CLISTR'
.GOTO PRMT
.;
.FINIS:

.ENABLE DATA
'CLEAR'
 
 
 
                        'BOLD''BLINK'>> LEAVING MENU MODE <<'NORM'
 
 
To return to MENU MODE, type in: 'BOLD'@MENU'NORM'
 
.DISABLE DATA
.ENABLE QUIET
.IFF DCLI SET MCR=TI:
.DISABLE QUIET
.CLOSE TI:
.EXIT
.;
.;
.RESET:
.ENABLE QUIET
MCR SET /BUF=TI:80.
.DISABLE QUIET
.DATA 'CLEAR'
.DATA 'RST'
.ENABLE QUIET
.DELAY 3S
.DISABLE QUIET
.GOTO MENU
.;
.;
.EDT:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       E D T   Sub-Menu                                  |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.SETN SCRN 80
.SETN WPOS 79
.SETF WIDE
.SETF WRAP
.ASKS FNAM Enter File Name to Edit: 
.IFT <EOF> .GOTO MENU
.IFT VT100 .ASK WIDE Is 'FNAM' a W-I-D-E Document [Y/N]: 
.IFT VT100 .IFT <EOF> .GOTO EDT
.IFT WIDE .SETN SCRN 132
.IFT WIDE .SETN WPOS 131
.ASK WRAP Do you want to set the wrap now [Y/N]: 
.IFT <EOF> .GOTO EDT
.IFT WRAP .ASKN WPOS At what position do you want the wraparound: 
.IFT <EOF> .GOTO MENU  
.IF WPOS >= SCRN .SETN WPOS SCRN-1
.OPEN #1 EDTINI.EDT
.DISABLE SUBSTITUTION
.;
.; *NOTE* You can insert any EDT key definitions here, if you want
.;        to customize EDT.
.;
.DATA #1 define key gold 14 as "ext copy select to =sub1 end."
.DATA #1 define key gold 15 as "ext find =main."
.DATA #1 define key gold 13 as "ext write ?'File to write: ' =sub1."
.ENABLE SUBSTITUTION
.DATA #1 SET SCREEN 'SCRN'
.DATA #1 SET WRAP 'WPOS'
.CLOSE #1
.ENABLE QUIET
.IFT WIDE MCR SET /BUF=TI:132.
.DISABLE QUIET
.IFT WIDE .DATA 'ESC'[?3h
.ENABLE QUIET
EDT 'FNAM'
.IFT WIDE MCR SET /BUF=TI:80.
.DISABLE QUIET
.IFT WIDE .DATA 'ESC'[?3l
.ENABLE QUIET
PIP EDTINI.EDT;0/DE/NM
.DISABLE QUIET
.GOTO MENU
.;
.;
.RNO:
MCR SET /NOWRAP=TI:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       R N O   Sub-Menu                                  |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.SETF PRTR
.SETF FAST
.SETF HYPH
.SETF WAIT
.SETT ALL
.SETF MULT
.SETF WIDE
.SETN COPS 1
.SETS OUDEV "TI:"
.SETS SW1 ""
.SETS SW2 "/-HY"
.SETS SW3 ""
.SETS START ""
.SETS END ""
.ASKS FNAM Enter File Name to Runoff: 
.IFT <EOF> .GOTO MENU
.PARSE FNAM ".;" NAM TYP VERS
.IFT VT100 .ASK WIDE Is 'FNAM' a W-I-D-E Document [Y/N] : 
.IFT VT100 .IFT <EOF> .GOTO RNO
.ENABLE QUIET
.IFT WIDE MCR SET /BUF=TI:132.
.DISABLE QUIET
.IFT VT100 .ASK PRTR RNO Output to LA100 (letter-quality) printer [Y/N] : 
.IFT VT100 .IFT <EOF> .GOTO RNO
.IFF PRTR .ASK FAST RNO Output to High-Speed lineprinter [Y/N] : 
.IFT <EOF> .GOTO RNO
.IFT FAST .SETS OUDEV NAM+".DOC"
.IFF PRTR .AND .IFF FAST ;
.IFF PRTR .AND .IFF FAST ; RNO Output will be displayed on the SCREEN
.IFF PRTR .AND .IFF FAST ;
.IFF FAST .ASK MULT Is 'FNAM' a Multi-page Document [Y/N] : 
.IFT <EOF> .GOTO RNO
.IFT MULT .ASK WAIT Wait for [RETURN] between pages [Y/N] : 
.IFT <EOF> .GOTO RNO
.IFT MULT .ASK ALL Output all pages [Y/N] : 
.IFT <EOF> .GOTO RNO
.IFF ALL .ASKS START        Starting page : 
.IFT <EOF> .GOTO RNO
.IFF ALL .ASKS END            Ending page : 
.IFT <EOF> .GOTO RNO
.ASK HYPH Hyphenate Output [Y/N] : 
.IFT <EOF> .GOTO RNO
.IFT PRTR .ASKN [::1] COPS How many copies ? [default=1] : 
.IFT <EOF> .GOTO RNO
.IFT WAIT .SETS SW1 "/WA"
.IFT HYPH .SETS SW2 "/HY"
.IFF ALL .SETS SW3 "/PA:'START':'END'"
.ENABLE QUIET
.DATA 'CLEAR'
.IFT WIDE .DATA 'ESC'[?3h
.IFT PRTR MCR SET /FORMFEED=TI:
.IFT PRTR MCR SET /NOBRO=TI:
.IFT PRTR .DATA 'ESC'[5i
.IFT FAST .DATA Sending RNO output to the printer.  Please Stand By.
.SETN NCOPS 0
.RLOOP: .INC NCOPS
RNO 'OUDEV'='FNAM''SW1''SW2''SW3'
.IF NCOPS NE COPS .GOTO RLOOP
.IFT FAST .DATA
.IFT FAST .DATA Thank you for waiting!
.IFT FAST .DATA
.IFT FAST PRINT /DELETE 'OUDEV'
.IFT PRTR .DATA 'ESC'[4i
.IFT PRTR MCR SET /BRO=TI:
.IFF PRTR .AND .IFF FAST .ASKS DUMMY >>> Hit [RETURN] to return to Main Menu <<<
.IFT WIDE MCR SET /BUF=TI:80.
.IFT WIDE .DATA 'ESC'[?3l
.GOTO MENU
.;
.;
.LIST:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       L I S T   Sub-Menu                                |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.SETS SW1 ""
.ASKS FNAM Enter File Spec(s) you want to list :
.IFT <EOF> .GOTO MENU
.ENABLE QUIET
LIST 'FNAM'
.DISABLE QUIET
.GOTO MENU
.;
.;
.PRI:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       P R I N T   Sub-Menu                              |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.ASKS FNAM Enter File Spec(s) you want to Print :
.IFT <EOF> .GOTO MENU
.ASKS [::"1"] COP Number of Copies ? 
.IFT <EOF> .GOTO PRI
.ENABLE QUIET
.IF COP = "1" PRINT 'FNAM'
.IF COP > "1" PRINT JOB/CO:'COP'='FNAM'
.DISABLE QUIET
.GOTO MENU
.;
.SPELL:
.ENABLE QUIET
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+----------------------------------------------------------------------+
|                                                                      |
|                       S P E L L   Sub-Menu                           |
|                                                                      |
|         Option          Function                                     |
|         ======          ========                                     |
|          0 or Ctrl-Z ...  'BOLD'>> Return to Main Menu <<'NORM'                  |
|          1 .............  'BOLD'Spelling Checker'NORM'                           |
|          2 .............  'BOLD'Check Dictionary'NORM'                           |
|                                                                      |
+----------------------------------------------------------------------+
 
.DISABLE DATA
.SETF QUIK
.SETS WRDLST ""
.ASKS CHOOS Enter Option : 
.IF CHOOS EQ "0" .OR .IFT <EOF> .GOTO MENU
.IF CHOOS EQ "1" .GOTO CKSPL
.IF CHOOS EQ "2" .GOTO CKDIC
.GOTO SPELL
.CKSPL:
.ASKS FNAM Enter File Name you want to check: 
.IFT <EOF> .GOTO SPELL
.IF FNAM = "" .GOTO CKSPL
.SETT THERE
.TESTFILE 'FNAM'
.IF <FILERR> NE 1 .SETF THERE
.IFF THERE .DATA 'FNAM' does not exist! Please check spelling and try again!
.IFF THERE .GOTO CKSPL
.ASK QUIK Do you want QUICK Mode ? [Y/N] : 
.IFT <EOF> .GOTO SPELL
.IFT QUIK .DATA 'CLEAR' I am now checking your document.  This may take some
.IFT QUIK .DATA time, please be patient, OK? ........
.IFT QUIK SPE 'FNAM'/Q
.IFT QUIK .DATA 'CLEAR'
.IFT QUIK .SETS WRDLST "S"
.IFT VT100 .IFT QUIK .ASKS WRDLST List mispelled words on screen (S) or attached printer (P) ?  [S or P] : 
.IFT QUIK .IF WRDLST = "p" .SETS WRDLST "P"
.IFT QUIK .IF WRDLST = "P" ; Please insert a sheet of paper on the LA100 and
.IFT QUIK .IF WRDLST = "P" .ASKS DUMMY then hit [RETURN] ....
.IFT QUIK .IF WRDLST = "P" .DATA 'ESC'[5i
.IFT QUIK PIP TI:=SPELL.WRD
.IFT QUIK .IF WRDLST = "P" .DATA 'ESC'[4i
.IFT QUIK PIP SPELL.WRD;0/DE/NM
.IFT QUIK .ASKS DUMMY Hit [RETURN] to return to Spell Sub-Menu
.IFT QUIK .GOTO SPELL
.IFF QUIK .DATA 'CLEAR'
.IFF QUIK SPE 'FNAM'
.GOTO SPELL
.CKDIC:
.ENABLE DATA
'CLEAR'
Enter a reasonable attempt to spell the word you want to look up in the
dictionary.  The output will be as follows: 
 
                 0. (your attempt)
                 1. (possible spelling)
                 2. (possible spelling)
                 3. etc.
 
.DISABLE DATA
.ASKS WRD Enter your attempt : 
DCT 'WRD'
.ASKS DUMMY Hit [RETURN] to return to Spell Sub-Menu
.GOTO SPELL
.;
.FILSVC:
.DISABLE DISPLAY
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+----------------------------------------------------------------------+
|                                                                      |
|              F I L E   S E R V I C E S   Sub-Menu                    |
|                                                                      |
|       Option No.         Function                                    |
|       ----------         --------                                    |
|           0 or Ctrl-Z .. 'BOLD'>> Return to Main Menu <<'NORM'                   |
|           1 ............ 'BOLD'DIR'NORM' - Lists filenames in working directory  |
|           2 ............ 'BOLD'PURGE'NORM' - Purges files, leaves latest version |
|           3 ............ 'BOLD'RENAME'NORM' - Renames files in working directory |
|           4 ............ 'BOLD'DELETE'NORM' - Deletes files in working directory |
|           5 ............ 'BOLD'SORT'NORM' - Sorts files in working directory     |
|           6 ............ 'BOLD'FETCH'NORM' - Copy file(s) to working directory   |
|                                                                      |
+----------------------------------------------------------------------+
 
.DISABLE DATA
.DISABLE LOWERCASE
.SETS OPT ""
.SETS DUMMY ""
.AGN2: .ASKS OPT           Enter Option No. 'CLEOL'
.IFT <EOF> .GOTO MENU
.IF OPT = "" .DATA 'RPT'
.IF OPT = "" .GOTO AGN2
.SETS OPT2 OPT[1:3]
.IF OPT2 = "0" .OR .IF OPT2 = "MEN" .GOTO MENU
.IF OPT2 = "1" .OR .IF OPT2 = "DIR" .GOTO DIREC
.IF OPT2 = "2" .OR .IF OPT2 = "PUR" .GOTO PURGE
.IF OPT2 = "3" .OR .IF OPT2 = "REN" .GOTO REN
.IF OPT2 = "4" .OR .IF OPT2 = "DEL" .GOTO DEL
.IF OPT2 = "5" .OR .IF OPT2 = "SOR" .GOTO SORT
.IF OPT2 = "6" .OR .IF OPT2 = "FET" .GOTO FETCH
.DATA 'RPT'
.GOTO AGN2
.DIREC:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                      D I R E C T O R Y   Sub-Menu                       |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.SETF TODAY
.SETS SW1 ""
.ASKS [::"*.*;*"] FNAM Enter File Spec(s) : 
.IFT <EOF> .GOTO FILSVC
.ASK TODAY Restrict listing to files created TODAY only [Y/N] : 
.IFT <EOF> .GOTO DIREC
.IFT TODAY .SETS SW1 "/TODAY"
.DATA 'CLEAR'
.ENABLE QUIET
DIR 'SW1' 'FNAM'
.DISABLE QUIET
.SETT ANS
.ASK ANS Return to FILE SERVICES Sub-Menu [Y/N] : 
.IFT ANS .GOTO FILSVC
.GOTO DIREC
.;
.;
.PURGE:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                        P U R G E    Sub-Menu                            |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.ASKS FNAM Enter File Spec(s) to Purge : 
.IFT <EOF> .GOTO FILSVC
.ASKN [0:10:1] PNUM How many versions of 'FNAM' to retain : 
.IFT <EOF> .GOTO PURGE
.IF PNUM LE 0 .SETN PNUM 1
.ENABLE QUIET
PIP 'FNAM'/PU:'PNUM'
.DISABLE QUIET
.GOTO FILSVC
.;
.;
.DEL:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                        D E L E T E  Sub-Menu                            |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
.ASKS FNAM Enter File Spec(s) to Delete : 
.IFT <EOF> .GOTO FILSVC
.ENABLE QUIET
DELETE 'FNAM'
.DISABLE QUIET
.GOTO FILSVC
.;
.;
.REN:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                        R E N A M E  Sub-Menu                            |
|                                                                         |
+-------------------------------------------------------------------------+
 
.DISABLE DATA
RENAME
.GOTO FILSVC
.;
.;
.SORT:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                          S O R T    Sub-Menu                            |
|                                                                         |
+-------------------------------------------------------------------------+
 
         This function allows you to alphabetically sort the files
in your directory.  You have 2 Options:
 
                 Option 1 .......... Sort by file NAME
                 Option 2 .......... Sort by file TYPE
 
.DISABLE DATA
.ASKN CHOIC Which Option do you choose [ 1 or 2 ] : 
.IFT <EOF> .GOTO FILSVC
.IF CHOIC NE 1 .AND .IF CHOIC NE 2 .GOTO SORT
.ENABLE DATA
 
                >> This may take some time. Please be patient! <<
 
.DISABLE DATA
.ENABLE QUIET
.IF CHOIC EQ 1 SRD /NA/SR/WB/-LI
.IF CHOIC EQ 2 SRD /-NA/SR/WB/-LI
.DISABLE QUIET
.GOTO FILSVC
.;
.FETCH:
.DISABLE QUIET
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       F E T C H   Sub-Menu                              |
|                                                                         |
+-------------------------------------------------------------------------+
 
You may enter in first or last name, or hit Ctrl-Z for File Services Menu.
 
.DISABLE DATA
.ENABLE CONTROL-Z
.WHO:
.ASKS NAME Whose text do you want? 
.IFT <EOF> .DISABLE CONTROL-Z
.IFT <EOF> .GOTO FILSVC
.SETS DIR ""
.; *NOTE*
.; ------------- START NAME TO DEV:[UIC] TABLE HERE -------------------
.; FOR EXAMPLE:
.;
.IF NAME = "SHULTZ" .SETS DIR "DU0:[1,100]"
.;
.; -------------  END OF NAME TO DEV:[UIC] TABLE ---------------------
.;
.IF DIR NE "" .GOTO OK
;
; >>> Nobody here named 'BOLD''NAME''NORM'. Try again ! <<<
;
.GOTO WHO
.OK: .ASKS FILE Enter file you want to fetch : 
.IFT <EOF> .GOTO WHO
.TESTFILE 'DIR''FILE'
.IF <FILERR> EQ 1 .GOTO OK2
;
; Error in filename entry:  File: 'FILE' does not exist for 'NAME'.
;
;		Try again .......
;
.GOTO OK
.OK2: ;
;
; Fetching 'FILE' from 'NAME' .......
;
.ENABLE QUIET
PIP /NV/FO='DIR''FILE'
.DISABLE QUIET
; File 'FILE' now exists in your directory.
.GOTO WHO
.;
.;
.MAIL:
.ENABLE QUIET
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+---------------------------------------------------------------------+
|                                                                     |
|                       M A I L    Sub-Menu                           |
|                                                                     |
+---------------------------------------------------------------------+
|                                                                     |
|          Option                 Function                            |
|          ======                 ========                            |
|            0 or Ctrl-Z ......  'BOLD'> Main Menu <'NORM'                        |
|            1 ................   'BOLD'Receive'NORM'                             |
|            2 ................    'BOLD'Send'NORM'                               |
|                                                                     |
+---------------------------------------------------------------------+

 
.DISABLE DATA
.ASKS CHOOS Enter Option : 
.IFT <EOF> .GOTO MENU
.IF CHOOS EQ "0" .OR .IF CHOOS EQ "MENU" .GOTO MENU
.IF CHOOS EQ "1" .OR .IF CHOOS EQ "RECV" .GOTO MRECV
.IF CHOOS EQ "2" .OR .IF CHOOS EQ "SEND" .GOTO MSEND
.GOTO MAIL
.MRECV:
.ENABLE DATA
'CLEAR' Here is your mail .......
 
.DISABLE DATA
MAIL ME
.ENABLE DATA
 
 
.DISABLE DATA
.ASKS DUMMY Hit [RETURN] to return to MAIL Sub-Menu
.GOTO MAIL
.MSEND:
.ASKS RECVR Who is to be the recipient of the letter (last name) : 
.IFT <EOF> .GOTO MAIL
.SETS NOTE ""
.ASK REPLY Do you want 'RECVR' send you back a reply [Y/N] :
.IFT <EOF> .GOTO MAIL
.IFF REPLY .SETS NOTE "/NO"
.AGN3: .ASKS FNAM What name do you want to give your outgoing letter : 
.IFT <EOF> .GOTO MAIL
.IF FNAM EQ "" .SETS FNAM "MAIL.LTR"
.PARSE FNAM "." N1 N2
.IF N2 = "" .SETS N2 "LTR"
.SETS FNAM N1+"."+N2
.TESTFILE 'FNAM'
.SETF THERE
.IF <FILERR> EQ 1 .SETT THERE
.IFF THERE .DATA You will now enter EDT to write your letter .....
.IFF THERE .DELAY 1S
.IFF THERE EDT 'FNAM'
.IFF THERE .GOTO SEND
.;
.SETF SEEIT
.SETF MALIT
.ASK SEEIT 'FNAM' already exists. Do you want to see it first ? [Y/N] : 
.IFT <EOF> .GOTO MAIL
.IFF SEEIT .GOTO SEND
PIP TI:='FNAM'
.ASK MALIT Mail this letter to 'RECVR' ? [Y/N] : 
.IFT <EOF> .GOTO MAIL
.IFF MALIT .GOTO AGN3 
.;
.SEND:
MAIL 'FNAM''NOTE' TO 'RECVR'
.ASK SAVIT Do you want to retain a copy of the letter you just sent ? [Y/N] : 
.IFT <EOF> .OR .IFF SAVIT PIP 'FNAM';0/DE/NM
.GOTO MAIL
;
.DTC:
.ENABLE QUIET
MCR SET /NOWRAP=TI:
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+---------------------------------------------------------------------+
|                                                                     |
|                         D T C    Sub-Menu                           |
|                                                                     |
+---------------------------------------------------------------------+
|                                                                     |
|            Option 0 (or Ctrl-Z) .. 'BOLD'> Main Menu <'NORM'                    |
|            Option 1 (or V) ....... 'BOLD'VIEW'NORM' Appointments                |
|            Option 2 (or S) ....... 'BOLD'SCHEDULE'NORM' Appointment             |
|                                                                     |
+---------------------------------------------------------------------+
 

.DISABLE DATA
.TESTFILE DTC.DAT
.IF <FILERR> NE 1 PIP DTC.DAT=NL:
.ASKS CHOOS What do you choose :
.IF CHOOS EQ "0" .OR .IFT <EOF> .GOTO MENU
.IF CHOOS EQ "1" .OR .IF CHOOS EQ "V" .GOTO VIEW
.IF CHOOS EQ "2" .OR .IF CHOOS EQ "S" .GOTO SCHED
.GOTO DTC
.VIEW:
.ENABLE DATA
Display options:   "D" -- Displays the DAY, times and subjects of appointments
                   "W" -- Displays the WEEK and times allotted for appointments
                   "M" -- Displays the MONTH and days which have appointments
                   Default -- Day display for TODAY
 
.DISABLE DATA
.SETS DVIEW ""
.ASKS DSP Select Please : 
.IFT <EOF> .GOTO DTC
.IF DSP NE "D" .AND .IF DSP NE "W" .AND .IF DSP NE "M" .AND .IF DSP NE "" .GOTO VIEW
.IF DSP EQ "D" .ASKS DVIEW Date to view [ MM/DD/YY, default=TODAY ] : 
.IF DSP EQ "D" DTC T 'DVIEW'
.IF DSP EQ "W" .ASKS DVIEW Date to view [ MM/DD/YY, default=THIS WEEK ] :
.IF DSP EQ "W" DTC R 'DVIEW'
.IF DSP EQ "M" .ASKS DVIEW Month to view [ MM/YY, default=THIS MONTH ] :
.IF DSP EQ "M" DTC C 'DVIEW'
.IF DSP EQ "" DTC T
.ASKS DUMMY Hit [RETURN] to return to DTC Sub-Menu
.ENABLE DATA
 
 
 
.DISABLE DATA
.GOTO DTC
.SCHED: 
.ASKS DVIEW Date to Schedule Appointment [ MM/DD/YY, default=TODAY ] : 
.IFT <EOF> .GOTO DTC
.IF DVIEW EQ "" .SETS DVIEW <DATE>
.AGN4: .ASKS DTIME Time of Day to Schedule Appointment [ HH:MM, 8:00-5:00 ] :
.IFT <EOF> .GOTO DTC
.IF <STRLEN> NE 4 .AND .IF <STRLEN> NE 5 .GOTO AGN4
.SETS POS2 DTIME[2:2]
.SETS POS3 DTIME[3:3]
.IF POS2 NE ":" .AND .IF POS3 NE ":" .GOTO AGN4
.PARSE DTIME ":" H M
.IF M <= "59" .AND .IF M > "30" .SETS M "30"
.IF M < "30" .SETS M "00"
.SETS DTIME H+":"+M
.ENABLE LOWERCASE
.ASKS MESG Short Description of Appointment at 'DTIME' :
.DISABLE LOWERCASE
.IFT <EOF> .GOTO DTC
.IF MESG = "" .SETS MESG "<< Unspecified Appointment >>"
DTC T 'DVIEW' 'DTIME' 'MESG'
.ASKS DUMMY Hit [RETURN] to return to DTC Sub-Menu
.ENABLE DATA
 
 
 
.DISABLE DATA
.GOTO DTC
.;
.;
.CALC: .ENABLE QUIET
.ENABLE CONTROL-Z
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                       C A L C U L A T O R   M O D E                     |
|                                                                         |
+-------------------------------------------------------------------------+

You are in Calculator Mode.....  Hit Ctrl-Z to return to Main Menu.
 
.DISABLE DATA
CAL
.DISABLE QUIET
.GOTO MENU
.;
.;
.PHONE: .ENABLE QUIET
.ENABLE CONTROL-Z
.PARSE OPT " " DUMMY NAME
.IF NAME = "ALL" .GOTO ALLNUM
.ENABLE DATA
'CLEAR'
+-------------------------------------------------------------------------+
|                                                                         |
|                          P H O N E   Sub-Menu                           |
|                                                                         |
+-------------------------------------------------------------------------+

.DISABLE DATA
.DISABLE QUIET
.NLOOP: .SETS PHNUM ""
.IF NAME = "" .ASKS NAME Whose number do you want (Ctrl-Z for Main Menu, ALL for all) : 
.IFT <EOF> .GOTO MENU
.IF NAME = "ALL" .OR .IF NAME = "" .GOTO ALLNUM
.; *NOTE*
.;
.;   ------  START PHONE BOOK TABLE HERE --------------------
.;   FOR EXAMPLE:
.;
.IF NAME = "SHULTZ" .SETS PHNUM "344-2147"
.;
.;   ------  END OF PHONE BOOK TABLE ------------------------
.IF PHNUM = "" ;
.IF PHNUM = "" ; Nobody here named 'BOLD''NAME''NORM'. Try again.
.IF PHNUM = "" ; 
.IF PHNUM = "" .SETS NAME ""
.IF PHNUM = "" .GOTO NLOOP
.ENABLE DATA
 
>> The telephone number for 'BOLD''NAME''NORM' is 'BOLD''PHNUM''NORM'. <<
 
.DISABLE DATA
.SETS NAME ""
.GOTO NLOOP
.;
.;
.BYE:
.ASK LEAV Are you sure you want to LOGOFF the system now ? 
.IFF LEAV .GOTO MENU
.DATA 'CLEAR'
.IFT VT100 .DATA 'ESC'[10B
.IFT VT100 .DATA 'BOLD''BLINK''ESC'#3          Have a Nice Day !
.IFT VT100 .DATA 'BOLD''BLINK''ESC'#4          Have a Nice Day !
.IFT VT100 .DATA 'NORM''ESC'[5B
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA                              Have a Nice Day !
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.IFF VT100 .DATA 
.CLOSE TI:
.XQT BYE
.EXIT
.;
.;
.;           >> END OF MENU PROCEDURE <<<<
.;
.GETTIM:

.;
.;   LITTLE SUBROUTINE TO REPORT THE TIME IN SEVERAL FORMATS
.;
.;   TIME1 = "1300"
.;   TIME2 = "1:00 pm"
.;   TIME3 = "1:00 pm" (with bell on the hour)
.;
.SETN NBEL 7.
.SETS BEEP ""
.PARSE <TIME> "::" HR MIN SEC
.;
.SETS TIME1 HR+MIN			! TIME1
.;
.IF MIN EQ "00" .SETS BEEP "'NBEL%V'"	! If on the hour, give beep
.IF HR LT "10" .SETS HR " "+HR[2:2]	! Strip off leading zero
.IF HR LT "12" .SETS AMPM " am."	! If less than 1200 hrs, AM
.IF HR GE "12" .SETS AMPM " pm."	! If greater or equal to 1200 hrs, PM
.IF HR EQ " 0" .SETS HR "12"		! If 0000 (midnite) make HR "12"
.IF HR GT "12" .GOSUB CONVT		! If 1300-2359, convert to 12hr format
.;
.SETS TIME2 HR+":"+MIN+AMPM		! TIME2
.SETS TIME3 HR+":"+MIN+AMPM+BEEP	! TIME3
.RETURN
.;
.;; CONVT SUBROUTINE FOR GETTIM ;;
.;
.CONVT:
.SETS PMHRS "1314151617181920212223"
.SETS HRS " 1 2 3 4 5 6 7 8 91011"
.SETN INDX 1.
.HLOOP: .IF HR = PMHRS[INDX:INDX+1.] .GOTO OUT
.SETN INDX INDX+2.
.GOTO HLOOP
.;
.OUT:
.SETS HR HRS[INDX:INDX+1.]
.RETURN
.;
.;
.ALLNUM:
.; *NOTE* -- You may want to modify the location of the phonebook.
.TESTFILE LB:[2,5]PHONE.LST
.IF <FILERR> NE 1 .DATA Cannot find phone book in LB:[2,5]. Returning to Main Menu.....
.IF <FILERR> NE 1 .GO TO MENU
.DATA 'CLEAR'
.ENABLE QUIET
PIP TI:=LB:[2,5]PHONE.LST
.DISABLE QUIET
.ASKS DUMMY  Hit [RETURN] to return to Main Menu 
.GOTO MENU
.;
.; END OF MENU
