\section{Conditional Execution Commands}
\label{Conditional Execution Commands}

     All conditonal execution commands are of the form:

\medskip
\centerline{\tt n"X command-string '}
\centerline{or}
\centerline{\tt n"X then-command-string | else-command-string '}
\medskip

     In the first form of the command, {\tt n} is a  numeric  argument  on
     which  the  decision  is  based,  {\tt X}  is  any of the conditional
     execution commands listed in table~\ref{Conditional Execution Commands}, and {\tt command string}  is
     the  command  string  which  will be executed if the condition is
     satisfied.   The  numeric  argument   is   separated   from   the
     conditional  execution  command  by  a  double  quote ({\tt "}) and the
     command string is terminated with  an  apostrophe  {\tt '}.   If  the
     condition  is  not  satisfied,  the  command  string  will not be
     executed;  execution will continue with the first  command  after
     the apostrophe.

     In the second form  of  the  command,  two  command  strings  are
     specified.   The  first  one  is  executed  if  the  condition is
     satisfied and the second is executed  if  the  condition  is  not
     satisfied.   Only  one  of  the command strings will be executed.
     After execution of the appropriate command string,  control  will
     continue  with the first command after the apostrophe (unless the
     command string caused a branch out of the conditional to  occur),
     since  execution  of  the vertical bar command {\tt |} causes TECO to
     scan to the next matching apostrophe.

     Conditional commands are similar to the  IF-THEN-ELSE  constructs
     that you find in other structured programming languages, although
     none can match the brevity and elegance of TECO's implementation.
     Nonetheless,   you   must  use  these  facilities  wisely.   Good
     programming practice dictates that a branch into the range  of  a
     conditional (from outside that range) should not occur.

     Conditional execution commands may be nested in the  same  manner
     as  iteration  commands.  That is, the command string which is to
     be executed if the condition on {\tt n} is met may contain  conditional
     execution   commands,   which   may,  in  turn,  contain  further
     conditional execution commands.


\begin{table}[h]
\caption{\bf{Conditional Execution Commands}}
\label{Conditional Execution Commands}
\end{table}
\nopagebreak

\begin{list}{}{\labelsep 20pt}

     \item[{\em COMMAND}]        {\em FUNCTION}

     \item[{\tt n"A}]       Execute the following command string if  
	{\tt n}  equals  the
               ASCII  code for an alphabetic character (upper or lower
               case {\tt A} to {\tt Z}).

     \item[{\tt n"C}]       Execute the following command string if {\tt n} is the  ASCII
               code  of  any  character  that is a symbol constituent.
               This is usually one of the upper or lower case  letters
               {\tt A}  to {\tt Z}, one of the digits {\tt 0} to {\tt 9}, or 
	period, or dollar
               sign, but may include  additional  characters  on  some
               operating systems.  Consult the appropriate appendix.

     \item[{\tt n"D}]       Execute the following command string if  {\tt n}  equals  the
               ASCII code for a digit ({\tt 0} to {\tt 9}).

     \item[{\tt n"E}]       Execute the following command string if {\tt n} is  equal  to
               zero.

     \item[{\tt n"F}]       Execute the following command string  if  
	{\tt n}  is  FALSE.
               Equivalent to {\tt n"E}.

     \item[{\tt n"G}]       Execute the following command string if  
	{\tt n}  is  greater
               than zero.

     \item[{\tt n"L}]       Execute the following command string if {\tt n} is less  than
               zero.

     \item[{\tt n"N}]       Execute the following command string if {\tt n} is not  equal
               to zero.

     \item[{\tt n"R}]       Execute the following command string if  {\tt n}  equals  the
               ASCII  code  for an alphanumeric (upper or lower case {\tt A}
               to {\tt Z} or {\tt 0} to {\tt 9}).

     \item[{\tt n"S}]       Execute  the  following  command   string   if   {\tt n}   is
               SUCCESSFUL.  Equivalent to {\tt n"L}.

     \item[{\tt n"T}]       Execute the following command  string  if  {\tt n}  is  TRUE.
               Equivalent to {\tt n"L}.

     \item[{\tt n"U}]       Execute  the  following  command   string   if   {\tt n}   is
               UNSUCCESSFUL.  Equivalent to {\tt n"E}.

\ifnotintecoeight
     \item[{\tt n"V}]       Execute the following command string if  {\tt n}  equals  the
               ASCII code for a lower case alphabetic character (lower
               case {\tt A} to {\tt Z}).
               {\em [Not in TECO-8]}

     \item[{\tt n"W}]       Execute the following command string if  {\tt n}  equals  the
               ASCII  code  for  an  upper  case  alphabetic character
               (upper case {\tt A} to {\tt Z}).
               {\em [Not in TECO-8]}
\fi

     \item[{\tt n"<}]       Identical to {\tt n"L}

     \item[{\tt n">}]       Identical to {\tt n"G}

     \item[{\tt n"=}]       Identical to {\tt n"E}

\end{list}

\label{Retrieving Environment Characteristics}

     The following TECO commands return values of  interest  to  users
     who  want  information  about  their  current  job, the operating
     system, their terminal, etc.

     All negative {\tt EJ} commands return  an  operating  system  dependent
     value.   Consult  the  appendices  for  operating  system  unique
     commands.

\begin{table}[h]
\caption{\bf{Retrieving Environment Characteristics}}
\label{Retrieving Environment Characteristics}
\end{table}
\nopagebreak

\begin{list}{}{\labelsep 20pt}

     \item[COMMAND]        FUNCTION

     \item[{\tt -1EJ}]      Return a number representing the computer and operating
               system  upon  which  TECO  is  currently running.  This
               value  has  the  form  {\em 256m+n}  where  {\em m}  is  a   number
               representing  the  computer  in  use  and {\em n} is a number
               representing the  operating  system  that  is  running.
               Current values of {\em m} and {\em n} are:

	\begin{tabular}{llll}
                        \multicolumn{2}{c}{\em Computer (m)} & 
			\multicolumn{2}{c}{\em Operating System (n)} \\

                         0         & PDP-11   & 0    & RSX-11D \\
                                   &          & 1    & RSX-11M \\
                                   &          & 2    & RSX-11S   \\
                                   &          & 3    & IAS \\
                                   &          & 4    & RSTS/E \\
                                   &          & 5    & VAX/VMS  \\
                                   &          &      & (compatibility mode) \\
                                   &          & 6    & RSX-11M+ \\
                                   &          & 7    & RT-11 \\
                         1         & PDP-8    & 0    & OS/8 \\
                         2         & DEC-10   & 0    & TOPS-10 \\
                         3         & DEC-20   & 0    & TOPS-20 \\
                         4         & VAX-11   & 0    & VAX/VMS \\
                                   &          &     & (native mode) \\
	\end{tabular}

     \item[{\tt 0EJ}]       Returns  a  value  equal  to  your  job   number.    On
               single-user systems, this is always a 0.

     \item[{\tt 1EJ}]       Returns a value equal to your console  keyboard  number
               (the  keyboard  you  detached  from  if you are running
               detached).  On single-terminal systems, this is  always
               a 0.

     \item[{\tt 2EJ}]       Returns a value equal to your operating  system's  
		user
               identification  number.   This  may be called your {\em UIC},
               {\em PPN}, Group,  etc.   under  various  operating  systems.
               Consult the appendices for more information.
\end{list}

\begin{table}[h]
\caption{\bf{Setting Environment Information}}
\label{Setting Environment Information}
\end{table}
\nopagebreak

\begin{list}{}{\labelsep 20pt}

\iftecotenonly
     \item[{\tt n,1EJ}]     Set the terminal number to receive output.   This  
		will
               not  affect  terminal  input.   Your  job  will  remain
               attached to, or detached from, your terminal, whichever
               it was before.  Output will only occur if the specified
               terminal is ASSIGNed with a monitor {\tt ASSIGN} command (you
               may  \caret {\tt C},  issue  that command and continue) and 
		if your
               job has POKE privileges.  This command  also  sets  the
               terminal  to  be  reattached  if  the  set  detach flag
               ({\tt 64\&ET}) is cleared.  The reattaching operation requires
               {\tt [1,2]} or {\tt JACCT} privileges.
               {\em [TECO-10 only]}

     \item[{\tt n,2EJ}]     Sets your {\tt [p,pn]} to {\tt n} where {\tt n} 
		has the  same  format  as
               the  number  returned  by the {\tt 2EJ} command.  Issuance of
               this command requires the appropriate privileges.
               {\em [TECO-10 only]}
\fi

\end{list}
