\chapter{RSX-11 Operating Characeristics}
\label{RSX-11 Operating Characeristics}

\section{Startup}


     RSX-11 systems  support  all  of  the  standard  TECO  invocation
     commands, namely
\begin{verbatim}
               TECO
               TECO filespec
               TECO filespec=filespec
               MAKE filespec
               MUNG filespec
               MUNG filespec,text
\end{verbatim}
     If any of these commands are not recognized by the system,  check
     with your system manager to see that TECO is properly installed.

     TECO macros may also be invoked with the command
\begin{verbatim}
               TECO @filespec
\end{verbatim}
     It is exactly equivalent to
\begin{verbatim}
               MUNG filespec
\end{verbatim}
     In systems supporting dynamic task expansion,  TECO  will  expand
     its  buffer space as necessary.  Also, TECO'S buffer space may be
     explicitly allocated in the startup command
\begin{verbatim}
               RUN $TEC/INC=n
\end{verbatim}

\section{Initialization}


     TECO searches for  the  TECO.INI  startup  file  in  the  current
     default  device  and  directory.  TECO's memory, in which a plain
     TECO command edits the file last edited with a TECO filespec or a
     MAKE   filespec   command,  is  implemented  with  a  file  named
     TECF00.TMP,  also  stored  in  the  current  default  device  and
     directory.

     The initial value of the ED flag is always 1.

     When TECO is initially invoked it will automatically set  the  ET
     and  EU  flags  according to the user's terminal characteristics.
     If the terminal supports CRT style rubouts, then bit 1 of the  ET
     flag  is  set  to  do the same in TECO.  If the terminal supports
     lower case type in, then bit 2 of the ET flag is set and  the  EU
     flag  is set to -1 to turn off case flagging.  If the terminal is

     a CRT type terminal and the version of TECO includes  the  screen
     support  package,  then  bit  9 of the ET flag is set.  While the
     command line is being processed, bit 7 of the ET flag is also set
     to  cause  TECO  to  exit  should any errors occurr.  ET bit 7 is
     cleared every time TECO reaches prompt (*) level.


\section{File Specification}


     The file access commands {\tt ER},  {\tt EB},  {\tt EW},  and  {\tt EI}
	  accept  a  file
     specification in the standard RSX-11 format:
\begin{verbatim}
               dev:[p,pn]filename.typ;version
\end{verbatim}
     in which {\tt dev:}  is a physical device  name  or  a  logical  device
     name;   if {\tt dev:}  is not specified, {\tt SY:}  is assumed.  If 
	{\tt [p,pn]} is
     not specified, the user's current default directory  is  assumed.
     The  filename  field  must  be specified whenever the device name
     references a file structured device.  The typ  field  is  a  file
     type  and  must be explicitly given if used.  There is no default
     type except for {\tt EI} commands which default the {\tt .typ}
	 field to {\tt .TEC}.

     The {\tt /B2} file specification switch may be applied to the  {\tt ER},  
	{\tt EW},
     and  {\tt EB}  commands  and  invokes special handling of program lines
     containing {\tt \&} continuation characters.  See Appendix  
	\ref{BASIC-PLUS/BASIC-PLUS-2 Handling}  for  more
     information.

     The switch {\tt /RW} may be applied to any file specification in an 
	{\tt ER},
     {\tt EW},  and  {\tt EI}  command.   If  the  file specification references a
     magtape, the tape is rewound before the  file  is  opened.   Note
     that  for  output files, this has the effect of zeroing the tape.
     The {\tt /RW} switch is ignored for all other device types.

     The  presence  of  version  numbers  in  Files-11   causes   file
     processing to behave slightly differently under RSX-11 than under
     other operating systems.  For example, no {\tt .BAK}  files  are  used;
     each  execution of an {\tt EB} command simply produces a new version of
     the file.  Thus a user may retain any level of backup he feels to
     be  comfortable.  It also means that one must occasionally delete
     obsolete files to avoid cluttering the disk.  Thus the command

\begin{verbatim}
               EBname.typ;version`
\end{verbatim}

     is equivalent to the commands

\begin{verbatim}
               ERname.typ;version`EWname.typ;0`
\end{verbatim}

     The {\tt EW} command also creates a new version (one  higher  than  the
     current  highest)  if no version number is given.  If an explicit
     version number is given, then that number is used, and if another
     file  of  the same name, type, and version previously existed, it
     is superseded without  warning.   (See  use  of  the  {\tt EP}  and  
	{\tt EK}
     commands below.)

     In reading files, version numbers behave the  same  as  in  other
     RSX-11  utilities:   the  default  is  the highest version.  This
     leads to a problem in re-opening the input file while a  file  is
     being  edited  with {\tt EB}.  Since the output file is already created
     and in the directory, the input file is  no  longer  the  highest
     version.   One may deduce the version number of the input file by
     doing a {\tt :G*} (typing the file  string  of  the  output  file)  and
     subtracting one from that version number.

     In symmetry with the {\tt EB} command,  the  {\tt EK}  command  functions  
	by
     simply  deleting  the current output file.  Note, however, that a
     supersede ({\tt EW} of same name, type, and version) is  not  undone  -
     the file is already deleted!

     The {\tt EP} and {\tt EA} commands, while simulating two channels  each  with
     an  open file for each of input and output, in fact only keep one
     file open for each to conserve buffer  space.   This  means  that
     they  are only useful for disk files.  Also, it means that if you
     open a file and then supersede it,  you  should  not  switch  the
     input  channel  away  from it with an {\tt EP} or {\tt ER}\escape 
	command, since it
     will not be possible to open the file again.


\section{Wild Card Lookup}


     The {\tt EN} command will process wild  card  lookups  on  RSX-11.   To
     preset  the wild card lookup file specification, use the standard
     RSX-11 format
\begin{verbatim}
               dev:[p,pn]filename.typ;version
\end{verbatim}

     The device name must reference a file structured disk  device  or
     magtape.  All other fields of the file specification may be fully
     wild ({\tt *}), including either or both halves of the directory.   The
     version  number  may  be explicit, wild, or default.  As with the
     other file specification commands, there is no default file type.


\section{Exiting From Teco}


     The normal method of exiting from TECO is with  the  {\tt EX}  command.
     This  copies  the remaining input file to the output file, closes
     all files and exits.

     The \fbox{CTRL/C} (or Caret-C) command is the "give up  and  get  out"
     command.  Executed from main command level, it will cause TECO to
     exit regardless of the state of the buffer.  If there is an  open
     output  file,  it  is  deleted.   The \fbox{CTRL/C} command is roughly
     equivalent to {\tt EKHKEX}.

\section{CTRL/C}
\label{CTRL/C}

     The action taken when the user types  \fbox{CTRL/C}  depends  on  what
     TECO is doing.

     If TECO is executing commands, or is awaiting type-in for the  
	\caret{\tt T}
     command, the {\tt ?XAB} error occurs.

     If TECO is at command level, typing \fbox{CTRL/C} cancels the  command
     string currently being typed and returns TECO to its prompt.  Two
     consecutive \fbox{CTRL/C} characters  will  cause  an  instant  
	{\tt HKEKEX}
     exit.

     Sometimes it is desireable for a TECO  macro  to  detect  when  a
     \fbox{CTRL/C}  was  typed.   By  detecting the \fbox{CTRL/C}, the macro can
     exit cleanly  back  to  command  level  (pop  saved  Q-registers,
     restore  any  flag values, etc.).  To do this, the macro sets Bit
     15 (Octal 100000,  Decimal  -32768)  of  the  ET  flag.   When  a
     \fbox{CTRL/C}  is  typed, TECO will automatically turn off Bit 15, but
     will continue execution of the  macro.   The  macro  periodically
     checks  Bit  15  and  exits  cleanly  if  it  ever goes off.  For
     example:

\begin{verbatim}
              [0 [1 -32768#ETET < ... ET; > 32767&ETET ]1 ]0
\end{verbatim}

     Setting the CTRL/C intercept bit in the ET flag  must  be  done
     with  some  care;   if the bit is set inside a command loop which
     does not check it, it will be impossible for the  user  to  abort
     the  loop.   The  only remedy for this situation is to abort TECO
     from another terminal.


\section{Exit And Go}


     If TECO is exited via the  {\tt EGstring}\escape  command,  TECO  
	closes  its
     files  and  exits.   It then causes {\tt string} to be executed as an
     {\tt MCR} command using the spawn system directive.  This feature works
     only on RSX-11M V3.2 and RSX-11M+ V1 or later.


\section{ET Flag Handling}


     TECO will automatically turn off the following  bits  in  the  ET
     flag  on  every  error:   Bit 0 (image output), Bit 3 (no echo on
     \caret{\tt T}), Bit 4 (cancel \caret{\tt O}), Bit 5 (no stall on 
	\caret{\tt T}), and  Bit  15  (\caret{\tt C}
     trap).

     In addition, TECO always turns off Bit 7 (exit  on  error,  etc.)
     every time is reaches prompt (*) level.

     Bit  6  (the  detach  flag)  controls  TECO'S  treatment  of  the
     terminal.   Normally,  TECO  keeps  the terminal attached to gain
     control of \fbox{CTRL/C} interrupts.  Setting bit 6  of  the  ET  flag
     causes  TECO  to  run  with  the terminal detached.  All commands
     function normally, except that typing \fbox{<CTRL/C} causes the MCR  to
     be  activated,  allowing  other  tasks  to  be  run from the same
     terminal concurrently with TECO.  It is, of  course,  the  user's
     problem  to  sort  out the confusion that will arise if both TECO
     and another task request input from  the  terminal  at  the  same
     time.


\section{File Record Format}

     Files-11 files are record structured, while TECO'S text buffer is
     ASCII  stream.   Thus  TECO  must  make  format  conversions when
     reading and writing files.  The conversion depends on the  record
     attributes  of  the  file.  While reading a file, the records are
     packed into the buffer.  If the file is implied carriage  control
     (the  standard RSX-11 source format) or Fortran carriage control,
     TECO inserts a carriage return and line feed after each record to
     make  each  record appear as a line of text in the buffer, unless
     the record ends with {\tt <ESC>}, {\tt <CR>}, {\tt <LF>}, {\tt <VT>}
	(vertical
     tab),  or  {\tt <FF>}.  A record ending in form feed is interpreted
     as an end of page mark;  it stops the read operation and the form
     feed  is  not  entered in the buffer.  If the file has print file
     carriage control, TECO interprets the carriage control bytes  and
     inserts  the  resulting  carriage return and line feed characters
     about the record.  If the input  file  has  no  carriage  control
     (also  called  internal  carriage control), TECO simply packs the
     records together in the text buffer.

     On output, TECO scans the text buffer for carriage  return,  line
     feed,   vertical  tab,  and  form  feed  characters.   Each  such
     character delimits the end of an output record.   If  the  output
     file  is implied or Fortran carriage control, and the record ends
     with exactly carriage return / line feed, the carriage return and
     line  feed are not output with the record;  Otherwise, the record
     is output in its entirety.  The carriage return and line feed are
     also  output  with  the  record  if the record ends with ESCAPE /
     carriage return / line feed.

     Switches may be applied to the input and output files to  control
     their carriage control attributes.  The switch {\tt /CR} forces implied
     carriage control;  {\tt /-CR} forces no  (internal)  carriage  control;
     {\tt /FT}  forces  Fortran  carriage  control.  When a carriage control
     switch is applied to an input file, the file is read as if it had
     that  attribute;   when  the switch is applied to an output file,
     the file is written with that attribute.  Applying a switch to an
     {\tt EB}  file  specification  causes the switch to apply to both input
     and output files.  When an output file is created,  its  carriage
     control  attributes  are defaulted to those of the currently open
     input file as follows:
\begin{minipage}[t]{3.5in}
\begin{tabular}{ll}
          Input        &       Output \\
                       &              \\
          implied      &       implied \\
          none         &       implied \\
          FORTRAN      &       FORTRAN \\
          print file   &       implied \\

\end{tabular}
\end{minipage}

     Files read with the  {\tt EI}  command  have  their  record  attributes
     interpreted in the same manner.  This leads to an unexpected side
     effect with {\tt EI} files containing  an  entire  command.   The  last
     record of the file presumably contains as its last characters the
     two alt modes which initiate execution of the macro.  If the file
     is  implied  carriage  control, however, there are also the final
     carriage return / line feed belonging to the last  record,  which
     remain  in  the  type in buffer while the macro executes.  If the
     macro attempts to receive input with the  {\tt <CTRL/T>}  command,  the
     carriage  return  /  line  feed  will be the first two characters
     read.  Alternatively, if the macro does no type in, the  carriage
     return  /  line  feed  will  be  read  by  TECO  as the first two
     characters of the next command.  Then no asterisk ({\tt *}) will appear
     as the prompt for the next command.  The remedy for both cases is
     for the macro to execute an {\tt EI}\escape command early  on.   This 
	causes
     the  remainder  of  the indirect file to be discarded and further
     input to be read from the terminal.


\section{Command Line Processing}
\label{Command Line Processing}

     The mechanism used to process the command line in RSX-11 TECO  is
     designed   to   allow   sophisticated  TECO  users  the  greatest
     flexibility in customizing TECO for their own use.  It  functions
     as follows:

     The initialization routine places the original {\tt MCR}  command  line
     (if  any)  into  the  filename  buffer.   It copies into the text
     buffer the text of a TECO macro that will be  used  to  interpret
     the command line.  Then it starts up TECO with the command
\begin{verbatim}
               HXY HKG* HXZ HK :EITECO\escape\escape
\end{verbatim}

     in the  type  in  buffer.   This  loads  the  command  line  into
     Q-register  Z  and the macro into Q-register Y.  It then executes
     the file named {\tt TECO.TEC} located in the user's default  directory,
     if  it exists.  After the user's {\tt TECO.TEC}, and any files it might
     link to with {\tt EI}, have been executed, TECO  executes  the  command
     {\tt MY}\escape\escape,  thus executing the macro to interpret the 
	command line and
     open the files requested.

     The  {\tt TECO.TEC}  mechanism  should   not   be   used   for   simple
     initialization;   the  standard  {\tt TECO.INI} facility should suffice
     for that.  The alternate {\tt TECO.TEC} facility is  provided  for  the
     sophisticated  user who wants his own command processing and thus
     wishes to usurp control from the normal initialization.

     If an {\tt EI}\escape  command  (to  close  the  indirect  command  file)  is
     executed during the processing of a user's {\tt TECO.TEC} startup file,
     the final {\tt MY}\escape\escape which causes processing of the command 
	line is not
     executed.   This  results  from  the  fact that the 
	{\tt MY}\escape\escape normally
     appears in TECO's type in  after  all  command  files  have  been
     processed.   Executing the {\tt EI}\escape command causes all 
	``type ahead'' to
     be discarded to allow a TECO command  file  to  prompt  and  read
     input from the terminal (and not read extraneous type ahead).  It
     is assumed that a TECO startup file that executes {\tt EI}\escape  
	and  reads
     input  from  the  terminal will want to manage the rest of TECO's
     startup.  If it still wants to process the command line, it  must
     issue the {\tt MY} itself.

