Google
 

Trailing-Edge - PDP-10 Archives - bb-k345a-sb - sosug.mem
There is 1 other file named sosug.mem in the archive. Click here to see a list.


                            SOS


          (an advanced line-oriented text editor)


                        User's Guide



     This document reflects version 12 of the software.










The information in this document is subject to change  without  notice
and  should  not  be  construed  as  a  comitment by Digital Equipment
Corporation.  Digital Equipment Corporation assumes no  responsibility
for and errors that may appear in this document.

The software described in this document is furnished under  a  license
and  may  be  used or copied only in accordance with the terms of such
license.

Digital Equipment Corporation assumes no responsibility for the use or
reliability  of  its  software  on  equipment  that is not supplied by
DIGITAL.

     Copyright (C) 1971,1979 by Digital Equipment Corporation

The following are trademarks of Digital Equipment Corporation:

DIGITAL        DECsystem-10   MASSBUS
DEC            DECtape        OMNIBUS
PDP            DIBOL          OS/8
DECUS          EDUSYSTEM      PHA
UNIBUS         FLIP CHIP      RSTS
COMPUTER LABS  FOCAL          RSX
COMTEX         INDAC          TYPESET-8
DDT            LAB-8          TYPESET-10
DECCOMM        DECsystem-20   TYPESET-11
                                                                Page 2


                               CONTENTS



                                                                   Page
INTRODUCTION TO SOS                                                 5
TYPOGRAPHIC CONVENTIONS                                             5
COMMAND FORMAT NOTATION                                             6

PART I         SOS SIMPLIFIED

CHAPTER 1      INPUT MODE                                           7

        1.1    ACCESSING SOS                                        7
        1.2    STORING THE FILE: THE END COMMAND - "E"              8
        1.3    CORRECTING ERRORS                                    8

CHAPTER 2      EDIT MODE                                           10

        2.1    ENTERING EDIT MODE                                  10
        2.2    INDICATING LINE NUMBERS                             10
        2.3    EDIT MODE COMMANDS                                  11
        2.3.1  The Delete Command - "D"                            11
        2.3.2  The Insert Command - "I"                            11
        2.3.3  The Replace Command - "R"                           12
        2.3.4  The Print Command - "P"                             12
        2.3.5  The Find Command - "F"                              12
        2.3.6  The Alter Command (Intraline Edit Mode) - "A"       13
        2.3.7  The Substitute Command - "S"                        15
        2.3.8  The Copy Command - "C"                              16
        2.3.9  The Transfer Command - "T"                          16
        2.3.10 The Number Command - "N"                            16
        2.3.11 The Quit Command (Delete the Entire Edit) - "Q"     17
        2.3.12 The End Command (Extension) - "E"                   17
        2.3.13 The Save World Command - "W"                        17
        2.3.14 The Go Command - "G"                                18

CHAPTER 3      READ-ONLY MODE                                      19

PART II        SOS ADVANCED

CHAPTER 4      FILES                                               20

        4.1    BACKUP AND TEMPORARY FILES                          20
        4.2    STANDARD TEXT FILES                                 21

CHAPTER 5      LINE NUMBERS, PAGES                                 22

CHAPTER 6      EDIT MODE COMMANDS                                  23

        6.1    THE MARK COMMAND - "M"                              23
        6.2    THE DELETE COMMAND -"D"                             24
        6.3    THE INSERT COMMAND - "I"                            25
        6.4    THE REPLACE COMMAND - "R"                           27
        6.5    THE PRINT COMMAND - "P"                             27
                                                                Page 3


        6.6    THE LIST COMMAND - "L"                              29
        6.7    THE FIND COMMAND - "F"                              29
        6.8    THE ALTER COMMAND (INTRALINE EDIT MODE) - "A"       31
        6.9    THE EXTEND COMMAND - "X"                            35
        6.10   THE SUBSTITUTE COMMAND - "S"                        36
        6.11   THE COPY COMMAND - "C"                              38
        6.12   THE TRANSFER COMMAND - "T"                          39
        6.13   THE JOIN COMMAND - "J"                              40
        6.14   THE NUMBER COMMAND - "N"                            40
        6.15   THE JUSTIFY COMMAND - "JU"                          41
        6.16   THE JUSTIFY LEFT COMMAND - "JL"                     43
        6.17   THE JUSTIFY RIGHT COMMAND - "JR"                    43
        6.18   THE JUSTIFY CENTER COMMAND - "JC"                   43
        6.19   THE JUSTIFY WORD COMMAND - "JW"                     43
        6.20   THE SET COMMAND - "_"                               44
        6.21   THE GIVE INFORMATION COMMAND - "="                  44
        6.22   LINE CONTENTS SPECIFICATION - ALL COMMANDS          45
        6.23   THE QUIT COMMAND - "Q"                              47
        6.24   THE END COMMAND - "E"                               47
        6.25   THE SAVE WORLD COMMAND - "W"                        49
        6.26   THE GO COMMAND - "G"                                49

CHAPTER 7      READ-ONLY MODE                                      49

CHAPTER 8      INDIRECT COMMANDS                                   50

CHAPTER 9      UPPER AND LOWER CASE REPRESENTATION                 50

        9.1    C128 AND C64 MODES                                  50
        9.2    UPPER AND LOWER CASE                                51
        9.3    COMBINING MODES AND CASES                           51
        9.4    MODEL 37 TELETYPE: 37 MODE                          53
        9.5    ASCERTAINING MODE AND CASE: THE GIVE
                  INFORMATION COMMAND                              53
        9.6    SPECIAL CONSIDERATIONS: FIND AND
                  SUBSTITUTE COMMANDS                              54
        9.7    SPECIAL "MATCHING" CHARACTERS: FIND AND
                  SUBSTITUTE COMMANDS                              54


APPENDIX A:    ERROR MESSAGES                                      57
APPENDIX B:    SUMMARY OF COMMANDS                                 59
APPENDIX C:    DEFAULT VALUES                                      62
APPENDIX D:    ASCII CHARACTER TABLE                               63
                                                                Page 4


                         INTRODUCTION TO SOS


SOS is a line-oriented text editor that  operates  only  on  sequenced
files.  SOS provides the following features:

      1.  Simple,  but  powerful,  commands.   Each  command   usually
          consists  of  a single-lettered "verb," followed by a number
          or range of numbers indicating  the  line(s)  on  which  the
          command is to perform.

      2.  An  "indirect  command"  file.    The   user   can   put   a
          frequently-used  sequence of commands into a file.  When the
          file is called, SOS will then perform the commands.

      3.  The  full  ASCII   character   set,   including   lower-case
          characters.

      4.  A search facility.  This enables the user to search  through
          a file with strings of text instead of line numbers.

      5.  Text-justifying commands.

This manual is divided into two  parts:   Simplified  uses  of  common
editing  commands are presented in Part I, which should be read in its
entirety before any text-editing is attempted.  Part II, on the  other
hand,  describes  every  command  in  greater detail, emphasizing more
sophisticated usage.  Most of this advanced  material  is  unnecessary
for ordinary editing problems;  there are instances, however, in which
these commands can be quite useful.



                       TYPOGRAPHIC CONVENTIONS


The following typographic conventions  are  used  throughout  the  SOS
Manual.

      *   In  an  example,  text  which  is   underscored   represents
          information   typed   by   the  user.   Text  which  is  not
          underscored is produced by SOS or the DECsystem-10 Monitor.

      *   The (CR) notation appearing after most lines in the examples
          represents  the carriage return key (RETURN) on the teletype
          keyboard.  The DECsystem-10 supplies a  linefeed  with  each
          carriage return.

      *   The (LF) notation represents the linefeed key (LINEFEED)  on
          the teletype keyboard.

      *   The  (FF)  notation  indicates  a   formfeed   obtained   by
          depressing CTRL-L (see "^character" below).

      *    $  is used to indicate the ALTMODE key.  Note that SOS only
                                                                Page 5


          prints the $ without the circle.

      *   ^character within a circle represents the control (CTRL) key
          and  an  alphabetic  character  - e.g.,  ^U .  Note that SOS
          does not print the circle.  To obtain the control character,
          depress the specified alphabetic while holding down the CTRL
          key.  The  DECsystem-10  will  print  an  up-arrow  and  the
          specified  character  to  indicate  that  it  has received a
          control character.

      *   A vertical  bar   represents  the  condition  "or"  -  e.g.,
          LMAR  RMAR means either the left or right margin.



                       COMMAND FORMAT NOTATION

The following notation is used in SOS command formats:

      *   Command names appear in capital letters;  arguments in lower
          case.

      *   There  are  no  spaces  between  SOS  commands   names   and
          arguments.

      *   Angle brackets <> enclosing lower-case  letters  indicate  a
          string  of text consisting of any characters on the teletype
          (as  long  as  these  characters   satisfy   the   specified
          conditions) - e.g., <range> or <filename>.

      *   Brackets [] indicate an option which may be used or  omitted
          as desired.
-SOS-                                                           Page 6


                                PART I

                            SOS SIMPLIFIED



                              CHAPTER 1

                              INPUT MODE



1.1  ACCESSING SOS

The user can call SOS by typing the following command to the monitor:

          .R SOS(CR)

               or

          .SOS(CR)

SOS then will request the name of a file  by  printing  "FILE=";   the
user-supplied name is typed on the same line as this request.

          FILE=<filename>(CR)      FILE:

<filename> consists of a 1-6 character alphanumeric "name" (required),
which  may  be  followed  by  a  period  and a 1-3 character extension
(optional).

Alternatively, the user may type the filename directly on the  command
line and omit the initial conversation with SOS:

          .SOS <filename>(CR)      .SOS-<filename>

The following examples are all equivalent ways to call SOS:

          .SOS(CR)
          FILE=EXAMPL(CR)

               or

          .R SOS(CR)
          FILE=EXAMPL(CR)

               or

          .SOS EXAMPL(CR)

Note that ".R SOS EXAMPL(CR)" is illegal.

If there is no disk file with the supplied  name,  SOS  will  indicate
that  it  is  prepared  to  accept  input  beginning  with line 100 by
printing
-SOS-                                                           Page 7


          FILE NOT FOUND-INPUT.    INPUT:
          00100

After printing the line number, SOS waits  for  the  user  to  type  a
string  of  text  followed  by  (CR);   SOS  then prints the next line
number, incrementing by 100 each time.  When there are no  more  lines
to  input,  the ALTMODE or ESCAPE key (appreviated  $ ) should be used
after the next line number  is  printed.   The  printing  of  sequence
numbers  is  terminated,  and  the user is at the SOS command level as
indicated by the asterisk in the left margin.

          .SOS EXAMPL(CR)
          FILE NOT FOUND-INPUT
          00100 THIS IS LINE 1.(CR)
          00200 THIS IS LINE 2.(CR)
          00300  $
          *



1.2  STORING THE FILE:  THE END COMMAND - "E"

Instead of editing immediately after the file is created, the user may
want to store the file on the disk.  To do so, he uses the End command
as follows:

          *E(CR)

The file will be stored under the name assigned to  it  when  SOS  was
called.  SOS then returns the user to monitor mode by printing

          EXIT

The E command is also used at the  end  of  an  editing  session  (see
Section 2.3.12);  if the End command is not used, the unedited copy of
the file will be retained, and the edited copy will be lost.



1.3  CORRECTING ERRORS

Typographical errors can be corrected in an input line, provided  they
are noticed before (CR) is typed.

   1.  RUBOUT.  To delete  individual  chatacters,  Rubout  should  be
       depressed  once  for every character being deleted, back to and
       including the error.  The deleted characters  are  enclosed  in
       single backslaches ("\"):

          00100 THIS IS TI\I\HE FIRST LINE

       In the above example, the user typed RUBOUT once after he typed
       the  "I" of "TI".  "\I" is printed to indicate that SOS deleted
       the "I".  The next  character  typed  in  (other  than  another
       RUBOUT) is accompanied by the second backslash - "\H".
-SOS-                                                           Page 8


   2.  CTRL-U.  To delete  the  entire  input  line,  strike  U  while
       holding  down the CTRL key -  ^U .  SOS will perform a carriage
       return/linefeed, but will not print a new line number;  instead
       it  will  wait for input which will be associated with the last
       number.

          00100 THIS IS TEH ^U
          THIS IS LINE 1.(CR)
          00200
-SOS-                                                           Page 9


                              CHAPTER 2

                              EDIT MODE



2.1  ENTERING EDIT MODE

There are two ways to enter edit mode.  During the input sequence,  if
an  existing file is specified, SOS will recognize the filename, print
an asterisk, and wait  for  user  commands.   Any  editing,  then,  is
performed on the named file.

          .R SOS(CR)
          FILE=<filename>(CR)
          EDIT.
          *

               or

          .SOS <filename>(CR)
          EDIT.
          *

To complete the editing of a new file, on the  other  hand,  the  user
should  strike the ALTMODE key ( $ ) at the end of the input sequence;
this places him at the SOS command level.  He  can  either  store  the
file  for  subsequent  editing  by using the E command, or else he can
utilize any of the editing commands listed below and in Part II.

          .SOS EXAMPL(CR)
          FILE NOT FOUND-INPUT
          00100 THIS IS LINE 1.(CR)
          00200 THIS IS LINE 2.(CR)

          00600  $
          *



2.2  INDICATING LINE NUMBERS

SOS recognizes certain abbreviations which can be employed in commands
requiring  line  numbers.   The Print command is used in the following
examples to illustrate these abbreviations:

   1.  A colon between two numbers is used  to  indicate  a  range  of
       lines between, and including, the two endpoints.

          *P100:200(CR)            Print lines 100 through 200 
                                   inclusive.

   2.  A period is used to represent the current line,  as  determined
       by the last command which actually specified a line.
-SOS-                                                          Page 10


          *P0:(CR)                 Print line 0 through the current
                                   line.

   3.  An asterisk represents the last line of the file.

          *P0:*(CR)                Print all the lines of the file.

          *P.:*(CR)                Print the current line through the
                                   last line of the file.



2.3  EDIT MODE COMMANDS



2.3.1  The Delete Command - "D"

The D command corrects an error by deleting an entire line or lines.

          *D200(CR)                Delete line 200.

          *D100:200(CR)            Delete lines 100 through 200
                                   inclusive.



2.3.2  The Insert Command - "I"

The I command is used to indicate that new  lines  will  be  inserted,
beginning at the stated sequence number.  The line increment is 100 by
default, unless specifically changed.

          *I200(CR)                Accept  input  lines  beginning  at
                                   line    200,   with   the   default
                                   increment of 100.

The increment is changed as follows:

          *I200,50(CR)             Accept input lines  beginning  with
                                   line  200,  using  the increment of
                                   50.   The  default  increment   for
                                   subsequent I commands is 50.

If there already is a line with the  specified  sequence  number,  SOS
will  determine  a  different line number for the insert by adding the
line number specified in the command to the current increment.   If  a
line  exists  between  the  line specified by the command and the next
line determined by the increment (e.g., "*I200,50(CR)"  and  line  210
exists), SOS will choose a line number halfway between these two lines
(i.e., line 205).  If  any  subsequent  line  being  inserted  already
exists,  or  if  an  existing line in the file falls between two lines
determined by the Insert command,  then  the  insertion  process  will
terminate and the user will return to SOS command level.  The sequence
of line numbers may be terminated at any time using the  ALTMODE  key,
-SOS-                                                          Page 11


which will return the user to command level.

          00200 THIS IS INSERTED.
          00250  $
          *



2.3.3  The Replace Command - "R"

The Replace  command  is  a  combination  of  the  Delete  and  Insert
commands.

          *R200(CR)                Delete line 200  and  accept  input
                                   beginning at that line.

          *R200:300,50(CR)         Delete  lines   200   through   300
                                   inclusive,  and  accept input to be
                                   inserted in lines 200 through  300,
                                   with an increment of 50.

SOS responds with the number of the first line to be replaced.



2.3.4  The Print Command - "P"

The Print command tells SOS to print specified  lines  on  the  user's
teletype.

          *P(CR)                   Print all the lines of the file.

          *P200(CR)                Print line 200.

          *P100:200(CR)            Print lines 100 through 200
                                   inclusive.

          *P0:*(CR)                Print all the lines of the file.

          *P.:*(CR)                Print the current line through the
                                   last line of the file.

If SOS is ready to accept a command, striking (LF) will cause the next
line  of  the  file  to  be  printed,  while striking $ will cause the
previous line to be printed.



2.3.5  The Find Command - "F"

SOS can locate an arbitrary text string within a file  without  having
the line number specified:

          *F<text>  $  (CR)        Search for the first occurrence  of
                                   the  given  string of text starting
-SOS-                                                          Page 12


                                   with the current line.

Note that immediately after  the  file  is  opened  for  editing,  the
"current" line is the beginning of the file.

It is also possible to search through a range of line numbers for  the
first occurrence of a given text string:

          *F<text>  $  100:350(CR) Search for the first occurrence  of
                                   the  string  of  text  in lines 100
                                   through 350 inclusive.

If the specified text is located, the line and line  number  where  it
first  occurred will be printed.  If the specified text does not exist
within the given (or implied) range, SOS will indicate that the search
has failed and return the user to command level:

          %SEARCH FAILS
          *

Giving another F command with no arguments will continue the search in
the  stated  range  and  cause SOS to print the next occurrence of the
given text string (line number and content).  If  there  is  no  other
occurrence,  SOS will print %SEARCH FAILS and return to command level.
For example,

          *FOLD  $  100:500(CR)       Search for the first occurrence
          00150 THIS IS AN OLD LINE.  of OLD in lines 100 through 500

          *F(CR)                      Search for the next occurrence
          0200 THERE WAS AN OLD MAN.  of  OLD  after  line   150   and
                                      through line 500.



2.3.6  The Alter Command (Intraline Edit Mode) - "A"

It is possible to change or alter the line with the Alter command.

          *A200(CR)                Alter line 200.

The A command places the user in  a  special  intraline  editing  mode
which  has  its  own  commands  (described  below).  In this mode, the
commands  themselves  will  not  appear  on  a  full-duplex  teletype,
although any accompanying user-supplied text will.

The intraline edit mode maintains a pointer within the line indicating
the next character in the line that the next command will affect.

1.  Moving the Pointer (Space Bar and Rubout)

    To advance the pointer one position to the right, strike the space
    bar  once.   The  character  that is passed over is printed on the
    teletype.  If the pointer is already at the extreme right  of  the
    line, this command is ignored.
-SOS-                                                          Page 13


    To move the  pointer  to  the  left,  use  RUBOUT  once  for  each
    character  being  passed  over.   (Note  that this does not delete
    anything as it would in input mode.) The character(s) passed  over
    are  printed  between  single  baskslashes  (\XX\).   (The  second
    baskslash is printed when the next non-RUBOUT command  is  given).
    If  the  pointer  is  already  at  the extreme left of the line, a
    carriage return/linefeed is automatically done.  The  line  number
    will  be  reprinted,  and  the  pointer  will  again  point to the
    beginning of the line.

2.  The "D" Command (Delete)

    To delete the  character  pointed  to,  type  "D"  once  for  each
    character being deleted.  The deleted character(s) will be printed
    within double backslashes (\\X\\).  (The second  double  backslash
    is printed when the next non-D command is given.) The pointer then
    will point to the right of the last character  deleted.   If  this
    command  is  preceded  by  a  number,  only the last three deleted
    characters will be printed and  enclosed  in  double  backslashes.
    The  command  is ignored if the pointer is at the extreme right of
    the line.

3.  The "I" Command (Insert)

    To insert text immediately before the character indicated  by  the
    pointer, use the I command as follows:

          I<text>  $

    Only the inserted text is printed on the  teletype.   The  pointer
    then  will  be  at  the  character  to  the  right of the inserted
    material.

4.  Terminating Intraline Editing:  (CR) and the Quit Command

    When no more editing is necessary, the user  should  strike  (CR).
    This  causes  that portion of the line to the right of the pointer
    to be printed and ends the intraline edit mode.  SOS then  returns
    to command level.

    The Q command terminates intraline editing mode without making any
    of  the  indicated intraline changes.  SOS then returns to command
    level.

5.   ^U  (RESTART)

    To reedit a line, type U while holding down the CTRL key  -   ^U .
    The  line  will  be restored to its origional state, and intraline
    editing can be resumed as soon as the line  number  is  reprinted.
    This  is  equivalent  to  typing a Q command during intraline edit
    mode and then issuing an Alter command followed by a period (after
    the SOS command asterisk):

          <line>Q
          *A.(CR)
-SOS-                                                          Page 14


6.  The "S" Command (Skip)

    The S command will move the pointer to the right  until  the  next
    occurrence of a specified character:

          S<character>

    Every  character  passed  over  will  be  printed.   The   current
    character  is automatically passed over and is not compared to the
    character specified in the command.

    If the character does not occur in the remainder of the line,  the
    pointer will move to the extreme right.

    The following example illustrates intraline edit mode and  pointer
    movement.   Remember  that  user  commands  are not printed on the
    full-duplex teletype when this mode is utilized.

          *A200(CR)

                SX D   IW  $  (CR)  User Input

           00200LET\\X\\W=A+B+C     SOS Printout

    The user wants to alter line 200 ("LET X=A+B+C").  The pointer  is
    at the first character of the line ("L).  After "SX" is typed, the
    pointer skips to "X", and SOS then prints "LET" on  the  teletype.
    To  delete  the "X", the user issues a D command.  SOS then prints
    "\\X", and moves the pointer to the  charater  which  follows  the
    deleted character (that is, to the "=").  Typing "IW $ " completes
    the deletion process by printing another "\\";  "W" is inserted to
    the  left of the pointer and printed on the teletype.  (CR) causes
    the rest of the line to be printed and returns the user to command
    level.



2.3.7  The Substitute Command - "S"

Sometimes the same string of text occurs frequently in a file, and  it
would  be  time-consuming for the user to perform intraline editing in
every line that the string is found.   SOS  provides  a  command  that
allows the user to substitute one string of text for another with some
range in the file:


*S<oldtext> $ <newtext> $ 100:350(CR)   Substitute the  <newtext>  for
                                        the  <oldtext>  in  the  range
                                        specified.

                                 NOTE

               If no range is included in the  command,
               substitution  will  be only done for one
               line.
-SOS-                                                          Page 15


2.3.8  The Copy Command - "C"

To duplicated some line or group of lines within a file, use the  Copy
command.   This  command  acts  like  an  Insert command;  the line(s)
specified are copied but not printed on the teletype.

          *C200,100(CR)            Copy the contents of line 100  into
                                   a new line numbered 200.

          *C1000,100:500,50(CR)    Copy a portion of the  file  (lines
                                   100   through   500)   into  a  new
                                   location beginning with line  1000.
                                   As   each   line   is  copied,  the
                                   increment between lines will be 50.

If a specified increment is too large  for  the  specified  range,  an
error message ("%OUT OF ORDER" OR "%WRAP AROUND") will be printed, and
SOS automatically will indicate that it has chosen a smaller increment
by typing

          INC1=<number>

If SOS cannot choose a small enough increment, it will use  the  given
increment  and copy as many lines a possible into the available space.
As a result, only part of the text will be  copied  and  an  "%OUT  OF
ORDER" error message will be given.  To finish copying the rest of the
specified range, edit mode must be terminated  with  an  End  command.
During the next editing session, the file must be resequenced and then
the copy can be completed.



2.3.9  The Transfer Command - "T"

The Transfer command moves a set of lines from one part of a  file  to
another.   It  is similar to the Copy command, but it also deletes the
original range immediately after the transfer is completed.

          *T1000,100:500,50(CR)    Copy lines 100 through 500 into the
                                   location  beginning with line 1000,
                                   using  the  increment   50;    then
                                   delete lines 100 through 500.



2.3.10  The Number Command - "N"

The Number command alters the numbers of currently existing lines;  it
should be used if an "%OUT OF ORDER" or a "%WRAP AROUND" error message
occurs.

          *N50,100:500,1000(CR)    Renumber  lines  100  through  500,
                                   starting  at  line  1000,  with the
                                   increment of 50.
-SOS-                                                          Page 16


          *N50,100:500(CR)         Renumber  lines  100  througu  500,
                                   starting   at   line  50,  with  an
                                   increment of 50.

          *N100(CR)    or          Resequence the entire file starting
                                   at  line  100  with an increment of
                                   100.

          *N(CR)



2.3.11  The Quit Command (Delete the Entire Edit) - "Q"

Should the user realize that the current editing session is worthless,
the  Quit  command  will  return him to the monitor without saving the
edited version of the file:

          *Q(CR)                   No longer ture.

SOS will indicate the exit as follows:

          EXIT

The original file (if there was one) is still intact  after  the  Quit
command.



2.3.12  The End Command (Extension) - "E"

To differentiate an edited file from the origional,  the  new  version
may  be  filed  separately  under  a  different  name by using the End
command and the new filename.

          *E<filename>(CR)

This leaves the original file  under  its  original  name.   SOS  then
returns the user to the monitor.

          EXIT



2.3.13  The Save World Command - "W"

The Save World command is the same as the E  command  except  that  it
leaves  the  user  in  command  mode  rather than returning him to the
monitor.  This is used to save the current version of the file in case
the system crashes, and should be done every fifteen minutes while the
user is in edit mode.  If the system does crash, the  user  will  lose
only the editing that was done since the last W command was issued.

It is also possible to use a new name for the edited version with  the
W  command  (just as in the extension of the E command).  The new name
-SOS-                                                          Page 17


only has to be given once, an any subsequent W  commands  will  recall
the new filename.

          *W(CR)

            or

          *W<filename>(CR)



2.3.14  The Go Command - "G"

The G command is used  after  the  user  issues  a  program  execution
command  such  as EXECUTE, LOAD, COMPILE, etc., and then edits a file.
A filename that has been given to SOS is saved, so  that  calling  SOS
(".SOS(CR)")  again  with no filename will immediately put the user in
edit mode for the last file specified.

Once editing is completed, the G command will write the file onto  the
disk  (like  the  E  command)  and  will  cause  the  previous program
execution command to be repeated.

The following debugging sequence illustrates G command usage:

          .SOS EXAMPL.CBL(CR)      SOS assumes input mode and is ready
          FILE NOT FOUND - INPUT.  to accept lines of text beginning
          00100                    with line 100 (SOS also "remembers"
             .                     the name EXAMPL.CBL).
             .
             .
          nnnnn $                  End input and give command to user.
          *E(CR)                   The E command will save the input
          EXIT                     under the filename EXAMPL.CBL.

          .EXECUTE EXAMPL.CBL(CR)  The user issues the Monitor command
             .                     "EXECUTE EXAMPL.CBL".
             .
             .                     The program did not execute
             .                     correctly;  the user must edit the
             .                     source file.
             .
          .SOS(CR)                 SOS "remembers" EXAMPL.CBL, because
          EDIT.                    it was the last filename used, and,
          *                        therefore, assumes edit mode.
             .
             .
             .
          *G(CR)                   The user performs some editing in
             .                     the program.  The G command will
             .                     save the file
             .                     as E did and will begin
             .                     compilation, loading, and execution
             .                     of EXAMPL.CBL.
             .
-SOS-                                                          Page 18


             .
             .
          .SOS(CR)                 More execution problems.
          EDIT.                    Edit EXAMPL.CBL again.
          *
             .
             .
             .
          *G(CR)                   EXECUTE again.
             .
             .
             .


3.0  READ-ONLY MODE

SOS allows the user to access  his  file  in  a  "read-only"  mode  if
"/READONLY" (or "/REA") is included in the input sequence.

          .SOS(CR)
          FILE=<filename>/READONLY(CR)

               or

          .SOS<filename>/READONLY(CR)

This mode permits the user to find information in his file,  but  does
not allow him to perform any editing.
-SOS-                                                          Page 19


                               PART II

                             SOS ADVANCED



4.0  FILES



4.1  BACKUP AND TEMPORARY FILES

Consider the following situation.  After a  file  is  created,  it  is
stored  on  the  disk  under  a  specified  name such as PROG.FOR (See
Section 1.1).

When the user is editing this file and gives an End, Save World, or Go
command,  a  backup  file  (in  this case, PROG.BAK) is created.  This
backup file contains the origonal version of PROG.FOR, while the newly
edited version will be stored under PROG.FOR.

If the E, W, or G command specifies a  filename,  no  backup  file  is
created.   The orininal copy of the file is still named PROG.FOR;  the
edited version will have the new filename as its name.

During the editing process, SOS successively copies a file.  In  input
mode,  if  lines  are inserted in the correct sequence order, the file
can be written out as needed with no wraparound to the  start  of  the
file.   If  material  is  inserted  out  of  order, however, it may be
necessary to wrap around.  SOS does this by copying the file over from
the  beginning  of  the file to the location specified in the command.
With subsequent commands, SOS will recopy additional portions  of  the
file.

When editing an already-existing file, SOS  is  careful  not  to  make
changes  in  the  old version until the new version is complete.  Then
wraparound is required, three files  may  exist  simultaneously:   the
original;  a partially-edited copy which contains the entire file with
all changes up to the last wrap around ("TMP" file - see below);   and
a partial copy of that file up to the current position ("TEM" file).

SOS  is  always  writing  this  partial  copy  into  a   file   called
"nnnSOS.TEM"  (where "nnn" is the user's job number).  If recopying is
necessary, SOS will rename the file "nnnSOS.TMP" and use it as  input.
At  any  time during an edit, SOS will read either the user's original
file or the "nnnSOS.TMP" file.  Thus, if an "nnnSOS.TMP" file  exists,
it is complete up to the last time SOS had to recopy the partial edit.

When an "E", "G", or "W" command is given, SOS will finish copying the
edit  into  the  "nnnSOS.TEM"  file  and  rename  it  either  the name
specified in the "E", "G", or "W" command, or the original name  given
when editing began.

During an edit, SOS prints "EXIT" and returns the user to the  monitor
whenever one of the following error messages occurs:
-SOS-                                                          Page 20


     Error message                      Explanation

%NO DISK AVAILABLE                 The disk which the  user  requested
                                   is not available.

%TEMPORARY EDIT FILE IN USE        The file name which SOS assigns  to
                                   the temporary file is already being
                                   used.  This  situation  should  not
                                   occur.  If it does, the user should
                                   issure  the  Monitor  command  "DEL
                                   *.TMP,*.TEM(CR)"   to   delete  all
                                   temporary files.

%DEVICE OUTPUT ERROR               Output error - no recovery will  be
                                   attempted.

%DEVICE INPUT ERROR                Input error - no revovery  will  be
                                   attempted.

%INTERNAL CONFUSION                SOS has just encountered an
     or                            internal conflict - a systems 
%ILLEGAL UUO                       programmer will be needed.

Although "EXIT" is called and the edit is lost, the original  file  is
not  harmed.   If  a Save World command had been given prior to any of
these errors, however, the original file  would  contain  all  editing
changes performed before the W command was issued.

If the error message, "%ILLEGAL LINE FORMAT" occurs  during  an  edit,
the user probably had a line with a carriage return but no linefeed or
vice versa.  Issuing a Replace command will correct the situation.



4.2  STANDARD TEXT FILES

SOS utilizes a Standard Text File, containing Standard Text Lines  and
Standard  Page  Marks.   Standard  Text  Line  format is a line number
composed of a string of five seven-bit ASCII digits, left-justified in
a  single  word with a 1 in bit 35.  This line number is followed by a
TAB and the text (147 or fewer ASCII  characters,  not  including  the
carriage  return/linefeed).  Each disk file word is left-justified and
consists of five ASCII characters and  a  0  in  bit  35.   The  first
character  which  follows  the  line  number is a TAB and the last two
characters are (CR)(LF).  The  characters  NULL  and  DELETE  may  not
appear  in  the  text.   If necessary, the last disk file word for the
line is filled with NULLs to make a complete word.

A  Standard  Page  Mark  is  a  word  containing   5   ASCII   spaces,
left-justified  in  a  word  with  a  1  in bit 35, followed by a word
containing the characters (CR),(CR),(FF),NULL,NULL, with a  0  in  bit
35.  Standard Page Mark usage is discussed in Chapters 5 and 6.

Lines are never broken across physical disk block boundaries, and  all
unused words in a disk block are 0.
-SOS-                                                          Page 21


If the specified file was created by using an  editor  that  does  not
assign line numbers, SOS will assign a number to each line as it reads
the file, beginning with 100 and incrementing by 100.



5.0  LINE NUMBERS, PAGES

Throughout Part I, it was assumed that a file was  entirely  contained
in  one continuous group.  This is a feasible way to structure a file;
however, when a file is large, it is advantageous to  divide  it  into
pages.   For  every command that includes a line number specification,
there is also a page qualification.  Thus, a single line (<line>)  may
be specified by both the line number and page number as follows:

          <line number>/<page number>

The line number must be in the range 0 to 99999;  the first page is 1,
and there is essentially no upper limit.  A range has the form

          <line number>/<page number>:<line number>/<page number>

A range includes all text up to and including the endpoints.

Instead of a number, the symbol "." may be used to denote  either  the
current  line  or  the  current  page, depending on whether it appears
before or after the "/".  Therefore, "100/." means line number 100  on
the  current  page and "./2" means the line on page which has the same
number as the current line number.  The  current  line  and  page  are
determined  by  the last command which was executed (or, generally, by
the last line on which an operation was  performed  and  the  page  on
which that line appears).

The symbol "*" may be used to specify the last line on the  page,  but
it may not specify the last page.

Line and page specifications may be further abbreviated as follows:

          Abbreviated Specification     Full Specification

                100                         100/.

                100:500                     100/.:500/.

                100/2:500                   100/2:500/2

                /2                          0/2:*/2

                /2:/5                       0/2:*/5

                0/1:.                       0/1:./1

Addition  and  subtraction  can  also  be  used  in  line   and   page
specifications.   While  the arithmetic is straight forward for pages,
it is not for lines because of varying increments  and  prior  editing
-SOS-                                                          Page 22


changes.   A  count either goes forward ro backward from the indicated
line to include the number of lines specified.  Another  form  of  the
range specification extends the ability to use the counting technique.
The starting line is specified  in  one  of  the  above  ways  and  is
followed by an "!" and the number of lines desired.

Line specifications using arithmetic  cannot  cross  page  boundaries,
except  those  with  the  "!"  which  may  cross  page  boundaries  if
necessary.

Special Specification    Equivalent Specification

     100+2               the second line after line 100

     100!3               line 100 and the two subsequent lines

     /5-3                /2 or page 2

     /.+2                the second page after the current page

     /.-1                the previous page

     .-1:.+1             three lines, including the current line

     *+2                 *

     0-5                 0

     *!2                 */.:0+1/.+1

                         last line on current page and first line on
                         next page



6.0  EDIT MODE COMMANDS



6.1  THE MARK COMMAND - "M"

The M command will insert a  page  mark  into  the  text,  immediately
before  the  line  specified.  Note that page mark 1 is always assumed
when input is begun.

          *M<line number>/<page number>(CR)

If the line that is specified does not exist, the page  mark  will  be
inserted immediately after the line with the next lower number on that
page.  If the line specified is the first on that page, the  new  page
mark  will be placed immediately after the already-existing page mark;
therefore,  the  page  that  already  existed  will   not   have   any
accompanying  text.   If  the page specified in the M command does not
exist, the error message "%NO SUCH PAGE" will be printed and  no  page
mark  will  be  inserted.  Note that the page mark always precedes the
-SOS-                                                          Page 23


related text.

Inserting a page mark causes renumbering of all subsequent pages.  The
current  line  is set to zero;  the current page is considered the one
just created.  When the user is inserting text, the command

          *M99999(CR)

will place a page mark at the end of the current work,  and  the  next
insertion will go on the next page.



6.2  THE DELETE COMMAND - "D"

The Delete command will delete all the lines of a specified range:

          *D<range>(CR)

If there are no lines in the specified range, SOS  will  respond  with
the error message "%NO SUCH LINES(S)".

Lines in a range are specified in the usual  manner;   exceptions  are
noted below:

   1.  The Delete command does not allow a page specification for  the
       second   line   number  of  a  range.   All  deletions  extend,
       therefore, over one page only, even if the "!" is used.

          *D100/2:200/3(CR)        This is an  illegal  command;   SOS
                                   will  respond  with  an appropriate
                                   error message.

   2.  The Delete command will delete a page mark, not the contents of
       the given page:

          *D/5(CR)                 Delete  page  mark   5   (not   the
                                   contents of page 5)

       The numbers of the succeeding page marks are decreased by one.

       Deleting a page mark may result in the creation of a page  with
       line  numbers  that are out of sequence.  If so, SOS will print
       the message "%OUT OF ORDER".  In such a case, it  is  necessary
       to renumber the page immediately.

Page mark 1, or any page  mark  which  does  not  exist,  may  not  be
deleted.   If deletion is attempted, the error message "%NO SUCH PAGE"
will be printed.

All lines on a page may be deleted as follows:

          *D/:99999(CR)            Delete all lines on page 2.

The current line and page will be set to the last line deleted on  the
-SOS-                                                          Page 24


specified page.



6.3  THE INSERT COMMAND - "I"

The Insert command, which is used to insert  new  lines  into  a  fie,
accepts a single line specifier (line number/page number) as its first
argument and begins inserting at that line.  The  Insert  command  may
also be used to change the current default increment between lines, in
which case the increment is preceded by a comma.

          *I[<line>][,<increment>](CR)

                    or

          *I[<line>][;<increment>](CR)

Thus,

          *I100/2,50(CR)           Insert lines starting with line 100
                                   on  page  2  and  set  the  current
                                   increment to 50.

          *I100/2;50(CR)           Insert lines starting with line 100
                                   on  page  2.   Use the increment of
                                   50.     NOTE:     The    semi-colon
                                   indicates  that  50  is a temporary
                                   increment to  be  used  only  while
                                   this  command  is  in  effect.  The
                                   current   increment   will   remain
                                   unchanged  and  will  be used again
                                   for the next command.

          *I100/2(CR)              Insert lines starting with line 100
                                   on   page   2   using  the  current
                                   increment (since  no  increment  is
                                   specified).     NOTE:     At    the
                                   beginning of edit mode, the current
                                   increment is 100.

After a specified line is actually inserted, SOS will  add  that  line
number  to the correct increment to obtain the number of the next line
to be inserted.

If there already is a line with the same number as the specified  line
number,  the  line number of the existing line is added to the correct
increment and insertion begins there.  If  there  already  is  a  line
located  between  the two line numbers (or at the second line number),
SOS will select a line number that is halfway  between  the  indicated
line  number  and the next line in the file.  For the next insertions,
if a line already exists at the location determined by the  increment,
or  if  it is necessary to pass over a line which already exists, then
insertion mode will terminate and the user will be returned to command
level.
-SOS-                                                          Page 25


In the following example,  lines  100  and  200  already  exist;   the
current increment is 100:

        *I100(CR)
        00150  THIS IS A LINE(CR)  SOS  selects  line  150  to   begin
                                   insertion.

                                   The user  is  returned  to  command
                                   level since line 200 already exists
                                   and must be  passed  over  (200  is
                                   between 150 and 250).

If a line insertion is terminated with an  $ , the text preceding  the
 $  is inserted, and the user is returned to command mode.  If nothing
has been inserted and  $  is used, an empty line will not be inserted,
although the user will be returned to command level.

The current line  number  and  page  become  the  last  line  actually
inserted,  not the empty line terminated with  $ .  In addition, after
 $  is typed, SOS will remember the line number and page of  the  next
line  to  be  inserted;   these will be used if the I command is given
later with no argument.   The  increment  will  be  the  same  as  the
increment  used  in  the most recent complete command, including those
commands with the temporary (";") construction.

          *I100;100(CR)
          00100 THIS IS LINE 1.(CR)
          00200 THIS IS LINE 2.(CR)
          00300  $
          *P100(CR)
          00100 THIS IS LINE 1.
          *I(CR)
          00300 THIS IS LINE 3.(CR)
          00400       .
                      .
                      .

If a page which does not exist is specified,  SOS  will  respond  with
"%NO SUCH PAGE".

If an attempt is made to insert a line which contains  more  than  147
characters  (not  including  the return/linefeed at the end), SOS will
print "%LINE TOO LONG".  The line will not be inserted, and  SOS  will
return to command mode.

If the next line to be inserted has a line number greater than  99999,
insertion will terminate and the user will be in command mode.

An increment of zero  will  result  in  the  error  message  "%ILLEGAL
COMMAND".
-SOS-                                                          Page 26


6.4  THE REPLACE COMMAND - "R"

The Replace command is the same as the Delete command followed by  the
Insert  command.   Replace  accepts  a range specifier and an optional
increment, which can be either temporary  (";")  or  an  actual  (",")
update of the current increment.

          *R<range>[;<increment>](CR)

                    or

          *R<range>[,<increment>](CR)

The deletion is performed on the specified range, and insertion begins
with the first line indicated by that range.  If the first line is not
stated explicitly, the line number of the first line deleted  will  be
used as the starting point for insertion.

          *R/2,50(CR)              Replace all lines  on  page  2  and
                                   insert  new  lines,  beginning with
                                   the first line  deleted,  using  an
                                   increment of 50.

Although the Delete command will  delete  a  page  mark  and  not  the
contents  of  that  page,  the  Replace command will delete all of the
lines on the specified page and then allow insertion.

          *D/2(CR)                 Delete page mark 2

          *R/2(CR)                 Delete all the lines on page 2

Insertion may be terminated by depressing  $  after  SOS  has  printed
the  next line number.  As in the Insert command, if  $  is used after
some of the text has been  typed,  that  text  will  be  inserted  and
command mode will be reinstated.


6.5  THE PRINT COMMAND - "P"

The Print command will print out  the  lines  specified  in  a  range,
including the line numbers.

          *P[<range>][,<options>](CR)

If the range includes the boundary between two pages,  "PAGE  N"  also
will be printed to indicate the position of the page mark.

          *P100/1:100/2
          00100 THIS IS A LINE
          00200 THIS IS A LINE
            .
            .
            .
          PAGE 2
          00100 THIS IS A LINE
-SOS-                                                          Page 27


The second argument,  if  given,  consists  of  one  or  more  of  the
following options, separated by commas.

     <Option>                      Explanation

     N Number pages                Print page numbers at the bottom of
                                   the page.

      Suppress line #s             Don't print line numbers  and  page
                                   numbers  and  suppress the asterisk
                                   indicating that SOS  is  ready  for
                                   the next command.

     E Eject                       Eject at bottom of a page.

     W Wait                        At the bottom, wait for a line.

     F Final Copy                  Equivalent to S, E, and  W  options
                                   combined.

The "bottom of the page" is determined by a page mark or  an  exceeded
length (the default is 55 lines).

"Wait for a line" means that SOS will wait at the bottom of each  page
while  the  user  types  an  additional  line,  followed by a carriage
return, or a return only (if no line is added).   Typing  a  "G"  only
will  suppress  the  wait  option  in  the  remainder of the printout.
Typing a "Q" only will stop  the  printout  and  return  the  user  to
command  mode.   Typing   ^O   will  suppress  a printout in progress.
Since SOS is still moving the output to a buffer area, typing  another
 ^O   will  resume the printout at some later point in the output.  If
all output has been passed to the buffer area, the user is returned to
command level.

Common abbreviations used with Print are as follows:

     *P(CR)                        Print 16 lines, beginning with  the
                                   current   position;   the  same  as
                                   "*P.!16(CR).

     *(LF)                         Print the next line of the file.

     * $                           Print  the  previous  line  of  the
                                   file.

     *P/.(CR)                      Print all the lines of the  current
                                   page;  the same as "P0:*/.(CR)".

The current line number and page  are  determined  by  the  last  line
actually printed.

If there are no lines in the specified range, SOS will print the error
message, "%NO SUCH LINE(S)".
-SOS-                                                          Page 28


6.6  THE LIST COMMAND - "L"

It is also possible to have the file, or a part of it, printed out  on
the line printer:

          *L[<range>][,S](CR)

If no range is specified, the entire file will  be  listed.   The  "S"
option  for suppressing line numbers and headings is the same as the S
option used in the Print command.  In this case, however, the asterisk
will not be suppressed, and SOS will indicate that it is ready for the
next command.

As with Print, the List command determines the current line number and
page by the last line printed.  Line printer output will have suitable
page headings of the top of each page.  These include the name of  the
file,  the  time  and  date of the printing, and the page given in the
form "M-N".  "M" is the actual SOS page on  which  this  text  can  be
found;   "N"  denotes  the  Nth page of line printer output comprising
page M.



6.7  THE FIND COMMAND - "F"

The Find command is used to locate a given string  of  text  within  a
stated range (note that the options are discussed separately below).

          *F[[<string>] $ [<range>][,<options>]](CR)

SOS will find the first occurrence of the  string  in  the  range  and
print  the  line  containing  that string.  If the range includes more
than one page and if the string is found on  a  page  other  than  the
first one of the range, SOS will print "PAGE N" before the line number
to indicate on which page the line is located.  If the string does not
occur in the specified range, SOS will print "%SEARCH FAILS".

To find the first occurrence of a  given  text  on  a  specific  page,
simply precede the page number with a "/" as follows:

     *FLINE $ /2(CR)               Find and print out the  first  line
                                   on page 2 containing "LINE".

To locate the same string specified in the last Find command, only use
the range argument.

     *F $ /3(CR)                   Find and print out the  first  line
                                   on  page  3 containing "LINE" (from
                                   the previous Find command).

If no previous Find command was issued, SOS  will  print  "%NO  STRING
GIVEN" since no string had been specified.

If the range is omitted, then SOS will begin its search  at  the  line
following the current line and continue through the end of the file.
-SOS-                                                          Page 29


     *FALWAYS $ (CR)               Find  the   first   occurrence   of
                                   "ALWAYS"  beginning  with  the line
                                   following the current line  through
                                   the end of the file.

To indicate a range beginning with the next line through  a  specified
location,  it  is  necessary  only  to  specify the second half of the
range.

     *FALWAYS $ :/5(CR)            Find  the   first   occurrence   of
                                   "ALWAYS" in the range from the next
                                   line through  the  end  of  page  5
                                   (assuming  the  current position is
                                   before page 5).

Note that if this particular range  specification  were  used  in  any
other  command  (except  Substitute),  SOS  would  print  the  message
"%ILLEGAL COMMAND".

When the Find command is given repeatedly,  it  is  not  necessary  to
specify  the  text and range when referring to the same text and range
given in the last complete Find command.

          *F(CR)                   Continue   to   find    the    text
                                   (specified previously).  The search
                                   begins with the line after the last
                                   line  that  was  found;  the end of
                                   the range is the endpoint specified
                                   in the last complete Find command.

          *F $ (CR)                Continue   to   find    the    text
                                   (specified  previously) through the
                                   end of the file (since no range had
                                   been specified).

The current line will be set to the last  one  found.   If  the  error
message  "%SEARCH  FAILS"  is printed, the string cannot be located in
the remaining portion of the range.  In this instance the value of the
current location will be unchanged.

If is possible to use an extended form of the Find command to find  up
to  six  strings  of  text.   The  carriage  return separates the text
strings:

     *F<string1>(CR)               Search for any occurrence of any of
     <string2>(CR)                 the strings (totalling fewer than
          .                        200 characters) in the range
          .                        specified.
          .
     <stringn> $ <range>(CR)



OPTIONS
-SOS-                                                          Page 30


The complete Find command format including options, is as follows:

          *F[[<string>] $ [<range>][,A ,N][,E][,<number>]](CR)

                                         options

Find command options are defined below:

          A         Enter intraline edit mode automatically  when  the
                    string is found.  This moves the intraline pointer
                    to  the  first  character  of  the   string.    If
                    intraline  editing  is  complete  and  "*F(CR)" is
                    issued, the A option  will  still  be  in  effect.
                    (This  is  the  same  for  the  N  and  E  options
                    discussed below).

          N         Find just the line numbers of the locations  of  a
                    given  string.   N follows the range specification
                    and cannot be used with  the  A  option.   N  will
                    still be in effect if an "*F(CR)" is issued.

          E         Do not treat upper and lower case letters as being
                    equivalent.   E  follows  the  range, or A or N if
                    either is present.  E will still be in  effect  if
                    an "*F(CR)" is issued.

          <number>  "<number>" specifies the number  of  lines  to  be
                    found  -  99999  usually will find them all.  This
                    option can be used instead of  repeating  "*F(CR)"
                    until the string no longer can be found within the
                    range  specified  in  the  first   complete   Find
                    command.



6.8  THE ALTER COMMAND (INTRALINE EDIT MODE) - "A"

The Alter command (referred to by the Find command) is  used  to  make
changes  within  a  line without having to retype the line.  The Alter
command accepts a range specifier indicating those lines to be atered.

          *A<range>(CR)

For each of the lines in the range, SOS prints the  line  number,  and
then  enters a special intraline edit mode which has its own commands.
A pointer, maintained within the line, points to the next character in
the  line  that  will  be  affected  by the next command.  The special
intraline edit commands do not appear on the user's  teletype.   Thus,
the  line  shown  on  the teletype at the end of the intraline edit is
exactly the same as it is in the file (except for the backslashes  and
the  characters  between  them).   Any  command  in  this  mode may be
preceded by a number which will cause the command to be  repeated  for
that  number  of  characters.  The line number of the next line in the
range will be typed out automatically as soon as intraline editing  is
completed on the present line.
-SOS-                                                          Page 31


The current line is determined by the last line edited.

If there are no lines in the specified range, SOS will print the error
message "%NO SUCH LINE(S)"



INTRALINE COMMANDS

SPACE             This will advance the pointer one  position  to  the
                  right.  The character that is passed over is printed
                  on the teletype.  If the pointer is already  at  the
                  extreme right of the line, this command is ignored.

RUBOUT            This moves the pointer one character  to  the  left.
                  This does not delete anything as it would ordinarily
                  in  input  mode.   The  characters  moved  over  are
                  printed  between single backslashes (\XXX\).  If the
                  pointer is already at the extreme left of the  line,
                  a  (CR)(LF)  is  automatically  performed.  The line
                  number will be reprinted, and the pointer will again
                  point to the beginning of the line.

C<character>      This causes SOS to accept the  next  character  from
                  the  teletype.   The  character  pointed  to will be
                  replaced by the new character, and the pointer  will
                  be  moved one character to the right.  The character
                  accepted from the teletype is printed on the line in
                  place of the one that is deleted.  If the pointer is
                  at the extreme right of the  line,  the  command  is
                  ignored.   During  this  command, any RUBOUT that is
                  used will be ignored.  (LF),(CR), and  $  will abort
                  the remainder of the command.

D                 This will delete  the  character  pointed  to.   The
                  character(s)  deleted  will  be surrounded by double
                  backslashes (\\XXX\\).  The pointer  will  point  to
                  the  right  of  the  last character deleted.  If the
                  command is preceded by a number, only the last three
                  characters  that  were  deleted  will be printed and
                  enclosed in  double  backslashes.   The  command  is
                  ignored  if  the  pointer is at the extreme right of
                  the line.

I<string> $       This will insert the  given  string  into  the  line
                  immediately before the chracter to which the pointer
                  points.   The  pointer  remains  pointing   to   the
                  character  to the right of the inserted string.  The
                  characters being  inserted  are  typed  out  on  the
                  teletype.

                  If  RUBOUT  is  typed  before  the   $ ,  the   last
                  character that is inserted will be deleted.  If more
                  RUBOUTs are  typed  than  characters  inserted,  the
                  characters  to  the  left of the insert are deleted.
-SOS-                                                          Page 32


                  The characters  deleted  are  surrounded  by  single
                  backslashes.   If  enough characters are inserted to
                  make the line exceed  147  characters,  the  message
                  "%LINE TOO LONG" is printed, and SOS will return the
                  user to command mode without performing any  of  the
                  alterations specified for that line.

                  If a (CR) is typed before the  $ , the  insert  will
                  be  terminated;  intraline edit will terminate as in
                  the (CR) command.

                  If a (LF) is typed before the   $ ,  a  (CR)(LF)  is
                  inserted  at  that  point.   This creates a new line
                  consisting of any subsequently  inserted  characters
                  and  the  rest  of  the old line to the right of the
                  pointer.  The number of the new line  is  determined
                  as follows:

                  1.  If the I command is preceded by a  number,  this
                      number  acts  like  a temporary increment and is
                      added to the current line number to  obtain  the
                      new line number.

                  2.  If the I command is not preceded  by  a  number,
                      then the new line number is determined by adding
                      the  current  increment  to  the  current   line
                      number.  The new line is inserted at this number
                      unless it would be out of order.

                  3.  If the new line would be out  of  order  in  (2)
                      above,  the  new  line  number  will  be halfway
                      between the current line  number  and  the  next
                      line  number.   If  the next line number is only
                      one more than the current line number, an  "%OUT
                      OF  ORDER"  error  message will be printed.  SOS
                      will retype the line number and the contents  of
                      the line to the left of the pointer.  It is then
                      possible to insert more characters.

                  If no errors occur while making the  new  line,  the
                  pointer will be left pointing to the first character
                  of the new line, and the current line will be set to
                  the new line just created.

(CR)              If there is no more editing to be done, that portion
                  of  the  line  to  the  right of the pointer will be
                  printed out;  intraline  editing  is  completed  for
                  that  line  and  command returns to the user, unless
                  there are more lines in the Alter command  range  to
                  be edited.

E                 This has the same effect as  the  (CR)  key,  except
                  that  the  rest  of  the  line is not printed on the
                  teletype.
-SOS-                                                          Page 33


Q                 The  Quit  command  terminates   intraline   editing
                  without  making  any  changes  in the line presently
                  being altered.  SOS returns to command mode.

 ^U               This restarts intraline editing on  the  same  line.
                  The line will be restored to its original state, and
                  intraline editing can be started as soon as the line
                  number is reprinted.

S<character>      The Skip command will accept one character from  the
                  user's  teletype (without printing it) and will move
                  the pointer to the right until the  next  occurrence
                  of that character.  Every character passed over will
                  be printed.  The character that is  currently  being
                  pointed  to  also  will  be  printed  without  being
                  compared to the character specified in the  command.
                  If  the  character does not occur in the rest of the
                  line, the pointer will be moved to the extreme right
                  of the line.

K<character>      The Kill command is the same  as  the  Skip  command
                  except  that  it  deletes  all the characters passed
                  over instead of printing  them.   If  there  are  no
                  other  occurrences  of  the specified character in a
                  line, the command will be ignored (rather  than  the
                  remainder of the line being deleted).  As with the D
                  command, the last 3 characters deleted  are  printed
                  between double backslashes if a number precedes K.

R                 The Replace command is the same as a Delete  command
                  followed  by an Insert (even if a number is included
                  before R).

L                 The Line command prints the remainder of the line to
                  the  right  of  the  pointer,  performs  a (CR)(LF),
                  prints the number of the  line,  and  continues  the
                  intraline  editing  with the pointer pointing to the
                  first character of the line.

P                 This prints the remainder of the line to  the  right
                  of the pointer, performs a (CR)(LF), prints the line
                  number, and moves the pointer  to  the  right;   the
                  characters passed over are printed until the pointer
                  reaches the same position it had before the  command
                  was issued.

J                 This Justify command inserts a  (CR)(LF)  where  the
                  pointer  is currently pointing, and concatenates the
                  portion of the line to the right of the pointer onto
                  the  beginning  of  the next line.  The current line
                  number is set to the new line number.

                  The error message "%LINE TOO LONG" will be given  if
                  the  new line that is created contains more than 147
                  characters.  The error message "%NO NEXT LINE"  will
-SOS-                                                          Page 34


                  be printed if this line is the last one on the page.
                  Either of these two errors will cause the J  command
                  to  be  ignored;  the line number and the portion of
                  the line to the left of the pointer  will  be  typed
                  out again.

W                 The Word command moves the  pointer  to  the  right,
                  passes  over  blanks  and  tabs, then over the first
                  "word" encountered, and then over subsequent  blanks
                  and  tabs (until the next word).  Everything that is
                  passes over is printed.

                  A "word" is defined as any  collection  of  letters,
                  numbers,  and the separators ".", "%", and "$".  The
                  other separators which delimit a word will cause the
                  scan  to  stop  after the word and subsequent blanks
                  and tabs are passed over.  (See also Section 6.20 to
                  set separators.)

X<string> $       The X command moves  the  pointer  over  blanks  and
                  tabs,  deleting  them  as it moves, and then deletes
                  the next "word" and the following blanks  and  tabs.
                  After  the deletion, a string of text is inserted to
                  replace the word and subsequent  blanks  which  were
                  deleted.

Any other character, used as a command, will be ignored  in  intraline
edit mode.



6.9  THE EXTEND COMMAND - "X"

The Extend command is another way to enter intraline edit mode.

          *X<range>(CR)

With this command, however, the pointer is moved  immediately  to  the
extreme  right  of the line, the characters passed over are printed on
the teletype, and the user is  in  the  intraline  insert  mode.   The
desired text is then typed in followed by (CR).

          <text>(CR)

If a (LF) is typed instead of a (CR), a  return,  linefeed  occurs  at
that  point.   This  creates a new line consisting of anything that is
subsequently typed in, since the user is still in  insert  mode.   The
number  of  the  new  line  is  determined by the methods described in
Section 6.8.  Note that a (CR) must be  used  eventually  to  end  the
insertion, unless the sequence of line numbers does not permit another
line.  In this case, the user will be returned to SOS command level.

If an  $  is typed before the (CR), the user may then issue any of the
intraline edit mode commands.
-SOS-                                                          Page 35


          <text> $ (CR)

The following form of the command will suppress the  type-out  of  the
original line:

          *X<range>,S(CR)

Only the characters that the user types  for  the  insertion  will  be
printed on the teletype.



6.10  THE SUBSTITUTE COMMAND - "S"

The Substitute command will substitute "newstring" for all occurrences
of  "oldstring" in the specified range and print every line in which a
substitution has been made.  (Note  that  the  options  are  discussed
separately below.)

          *S[<oldstring> $ <newstring>] $ [<range>][<options>](CR)

If the first line with  a  substitution  is  not  on  the  first  page
specified in the range, or if a subsequent line with a substitution is
not on the same page as a previous line,  "PAGE  N"  will  be  printed
before the appropriate line.

To substitute the same strings specified in the last S  command,  omit
the strings and one  $  from the command:

     *SOLD $ NEW $ 100/1:100/2(CR) Substitute    "NEW"     for     all
                                   occurrences   of   "OLD"   in   the
                                   specified range.

     *S $ /3(CR)                   Change "OLD" to "NEW" (as specified
                                   previously) on page 3.

If the strings are omitted and no previous S command had  been  given,
SOS will print the error message "%NO STRING GIVEN".

If the entire range is omitted, SOS will assume a range from the  line
after the current line through the end of the file.  If the first part
of the range is omitted, it is  assumed  to  be  the  line  after  the
current  line.   The  current  line is set to the last line in which a
substitution took place.  If a substitution did not occur,  the  value
of the current line will not be updated.

It is also possible to perform several substitutions at one time.  All
text  to be located and changed is specified first, followed by an  $ 
and all the text to be substituted, followed by the range.

The form of this command is:

          S<oldstring1>(CR)
          <oldstring2>(CR)
               .
-SOS-                                                          Page 36


               .
               .
          <oldstringn> $ <newstring1>(CR)
          <newstring2>(CR)
               .
               .
               .
          <newstringn> $ <range>(CR)

If  there  are  fewer  "newstrings"  than   "oldstrings,"   the   last
"newstring"  is  substituted  for  the  extra  "oldstrings." Up to six
oldstring and six newstrings (containing 200 characters in all) may be
used;   if either is exceeded, one of the following error messages may
appear:  "%TOO MANY STRINGS" or "%STRING TOO LONG".



OPTIONS

The complete Substitute  command  format,  including  options,  is  as
follows:

*S[<oldstring> $ <newstring>] $ [<range>][,D ,N][,E][,<number>](CR)

                                                  <options>

Substitute command options are defined below:

D         By specifying this option, the user can look  at  each  line
          after  the substitutions have been made in order th "decide"
          if he prefers the new line or the old one.  After each  line
          is  printed,  SOS  will wait for the user to type one of the
          following characters:

RUBOUT    The indicated substitutions  will  not  be  made;   the  old
          version  of  the line will be retained.  SOS will then print
          the next line and, when found, will  wait  for  another  "D"
          command character.

E         SOS  will  return  immediately  to  command   mode   without
          performing the substitutions.

G         SOS will use the modified line to replace the original line;
          Decide mode will be halted and further substitutions will be
          made automatically.

A         SOS will enter intraline edit mode  with  the  substititions
          already made;  the user then can issue one of the following:

           ^U   Restore the original line.

          (CR)  Leave intraline edit mode and continue substitution.

          Q     Abort the entire process by retuning  SOS  to  command
                mode.
-SOS-                                                          Page 37


Any other character (e.g., a space or a (CR)) will automatically cause
the new line to replace the old line and substitution to continue.

N           This option will suppress the printing of those  lines  in
            which a substitution has been made.

E           This option will cause upper and lower case letters to  be
            treated as non-identical in the "old" string.  This should
            come after D or N, if either  is  present,  or  after  the
            range.  See Chapter 9.

<number>    "<number>" specifies the number of lines of a given string
            to be substituted - 99999 usually will include them all.



6.11  THE COPY COMMAND - "C"

The Copy command will insert a  copy  of  existing  text  at  a  given
location.  Its format is:

  *C<destination line number>,<source range>[,<inc1>[,<inc2>]](CR)

The Copy command acts as if an Insert command  had  been  done  for  a
given  location,  and  then  as  if  all of the lines specified by the
source range had been typed in, using the specified increment  between
destination  line  numbers.   If  the increment is too large, SOS will
print "%OUT OF ORDER" or "%WRAP AROUND", and  then  choose  a  smaller
increment, which is indicated as follows:

          INC1=<number>

If, for some reason, SOS cannot choose a small  enough  increment,  it
will print

          INC1=ORDER or INC1=WAR

The specified increment will be used, and SOS will copy as many  lines
as possible into the available space.

Since all the text to be copied must be contained in core at one time,
copying  large  blocks  of  text  may  result  in  the  error  message
"%INSUFFICIENT CORE AVAILABLE".  The only solution is to copy  several
smaller blocks of text.

If the source lines contain page marks, the renumbering  of  lines  at
the  destination  using  the first increment will cease when the first
page mark is reached;  then all lines between the first and last  page
marks  will  be  inserted with orininal numbers.  Lines after the last
page mark will be inserted with the orininal numbers, unless a  second
increment  (<inc2>)  for  the destination line numbers is specified in
the command.

If the second increment is too  large,  SOS  will  print  one  of  the
following error messages:  "%OUT OF ORDER" or "%WRAP AROUND".
-SOS-                                                          Page 38


If the second increment is not specified and renumbering is not  done,
SOS will print "%OUT OF ORDER".

In both cases, SOS will try to use a different increment, as indicated
by

          INC2=<number>

If SOS cannot find a suitable increment, it will print

          INC2=ORDER

SOS then will use  the  specified  increment  (or  the  original  line
numbers if a second increment had not been stated in the command), and
will insert as many lines as possible  into  the  remaining  available
space.

The Copy command will enable the user to copy lines from a file  other
than  the  one  presently  being  edited.  If the line numbers of this
other file are unknown, then the user will first type:

          *C<destination line number>_<source filename>/S(CR)

This will cause SOS to respond with an asterisk (*).  "/S" places  the
indicated  source file in read-only mode.  The desired lines are found
by using the Print, List, or Find commands.  After the lines have been
found, type

          *E(CR)

SOS will reply

          SOURCE LINES=

At this point, the rest of the Copy command should be typed.

          <source range>[,<inc1>[,<inc2>]](CR)

The current line will be set to the last line copied.



6.12  THE TRANSFER COMMAND - "T"

The Transfer command moves a set of lines from one location in a  file
to another.

  *T<destination line number>,<source range>[,<inc1>[,<inc2>]](CR)

The Transfer command is the same as  a  Copy  command  followed  by  a
Delete command.  With the Transfer command (unlike the Copy command) -

   1.  The source range must be in the file currently being edited.

   2.  The error  message  "%ILLEGAL  TRANSFER  DESTINATION"  will  be
-SOS-                                                          Page 39


       printed when the destination is inside the source range, as in

          *T100/3,/2:/5(CR)

If an "%OUT OF ORDER" error message is printed because of the  removal
of  a  page mark, SOS then will reinsert one page mark and print "PAGE
MARK INSERTED TO PREVENT ORDER ERROR".

If the specified destination is on a page which does  not  exist,  SOS
will  insert  the text at the end of the file and print "TEXT INSERTED
AT END OF FILE".  SOS also will insert a page mark to prevent an "%OUT
OF ORDER" error message.

Note that <inc2> must be used if line numbers other than the  orininal
are desired for the last page.



6.13  THE JOIN COMMAND - "J"

The Join command joins two consecutive lines by deleting the  carriage
return/linefeed  sequence  at  the end of one line and the line number
and TAB of the next line.

          *J<line>(CR)

<line> is the first of the pair of  lines  to  be  joined.   The  line
number  of the new line that is created will be the same as this first
line.

If there are no errors, the current line is the line that is created.

The lines will not be joined if SOS prints the  error  message  "%LINE
TOO LONG".

If the line specified as the argument is the last line  on  the  page,
SOS will give the error message "$NO NEXT LINE".



6.14  THE NUMBER COMMAND - "N"

After an "%OUT OF ORDER"  message  (or  at  any  other  time),  it  is
possible  to renumber the file, or portions of it, by using the Number
command:

          *N<increment>[,<range>[,<starting number>]](CR)

The first argument is the increment to be used in the renumbered file.
The  first  line  that  is renumbered is given this number, unless the
third argument is specified.  Each succeeding line  will  be  given  a
number  that  is  the sum of the increment and the previously assigned
line number.

If renumbering crosses a page mark, the first line  on  the  new  page
-SOS-                                                          Page 40


will  be given the "starting number" - i.e., either the third argument
or the first argument (if the third is omitted).  For example,

BEFORE RENUMBERING:

          PAGE 2    115     126     137     150

          PAGE 3    900     911     952     999

          *N10,/2:/3(CR)

AFTER RENUMBERING:

          PAGE 2    10      20      30      40

          PAGE 3    10      20      30      40

If  the  second  argument  is  absent  (indicating  the  range  to  be
renumbered),  the  entire  file  will  be renumbered.  If there are no
lines in the specified range, SOS will print the  error  message  "%NO
SUCH LINE(S)".

The Number command is useful in renumbering a  page  before  the  page
mark is deleted in order to avoid an "%OUT OF ORDER" error message.

If the user deletes the page mark before renumbering, he should  issue
the  Number  command  with  the  "/." range specification, the desired
increment, and starting point, if desired.

          *N10,/.(CR)              Renumber the current page  with  an
                                   increment and starting point of 10.

After renumbering, the current number and page  will  be  set  to  the
number  of the last renumbered line.  An increment of 0 will result in
the error message "%ILLEGAL COMMAND".  If the spedified  increment  is
so  large  that  it causes some line numbers to be greater than 99999,
the high-order digits of these line numbers will be dropped.  SOS will
then  print  the  error  message "%WRAP AROUND" along with the page on
which the problem occurred.  The page will be out of order and  should
be renumbered with a smaller increment.



6.15  THE JUSTIFY COMMAND - "JU"

The JUstify command  justifies  the  text  in  a  specified  range  by
ignoring all line numbers, returns, and linefeeds:

          *JU<range>(CR)

Line numbers, returns, linefeeds, and blanks are then inserted so that
the  line  length  is the difference between the right (RMAR) and left
(LMAR) margins plus one:

          RMAR-LMAR+1=line length
-SOS-                                                          Page 41


Inserting any additional characters will result in  unjustified  text.
Note  that  the  default  values  of  "RMAR"  and  "LMAR" are 69 and 1
respectively.

If the right margin is less than the left,  SOS  will  print  "%MARGIN
ERROR".

In this case, use the Set command to reset either or both margins.

SOS inserts extra blanks between words,  starting  from  the  left  or
right on alternate lines, to make the line length "RMAR-LMAR+1".

A word is anything between blanks.  (The end of the original  line  is
considered  a  blank.)  A  word that ends with ".", "?", or "!" may be
followed by two blanks;  otherwise, only one blank is allowed, and all
other blanks will be ignored.

SOS inserts blanks at the beginning of the new line equivalent to  the
value  of the left margin minus 1.  The new line number is the same as
the number derived by the Number command:

          *N<increment>,<range>(CR)

A page mark automatically will be inserted if  the  next  line  number
exceeds  the  maximum  line number (MAXLN) whose default is 99999.  If
this occurs, the user will be informed.

Paragraphing will cause exceptions to the above procedures.   The  end
of a paragraph is indicated by one of the following conditions:

     1.  Tab in the first character position

     2.  Blank line

     3.  Page mark

     4.  Beginning or end of specified range

When one of these conditions is encountered, the line that immediately
precedes  the  end  of the paragraph is not expanded (unless it is the
beginning of the range).  The line, however, is placed  at  the  LMAR,
with leading blanks inserted if necessary.

If the paragraph begins with a tab (8 spaces,  entered  during  Insert
mode  by  CTRL-TAB),  the  tab  is  merely  inserted  into  the  text.
Otherwise, the paragraph will begin with the paragraph  margin  (PMAR)
whose default is 1, rather than the LMAR.
-SOS-                                                          Page 42


6.16  THE JUSTIFY LEFT COMMAND - "JL"*

The Justify Left command removes leading blanks from lines of a  range
and inserts LMAR-1 blanks to move the lines to the left margin.

          *JL<range>(CR)

The first line of a paragraph is treated as in  the  JUstify  command.
No chopping, filling, or renumbering, however, is done.



6.17  THE JUSTIFY RIGHT COMMAND - "JR"*

It is also possible to right justify a range of text:

          *JR<range>(CR)

Enough blanks are inserted at the beginning of the line  so  that  the
right  end  of  the  line  is  at  the  right margin.  If any tabs are
present, the  required  blanks  are  inserted  to  the  right  of  the
rightmost tab in the line.



6.18  THE JUSTIFY CENTER COMMAND - "JC"*

The Justify Center command centers the lines of a  range  between  the
left and right margins:

          *JC<range>(CR)

JC is like the JR command, except that only half as  many  blanks  are
inserted to make the line centered between LMAR and RMAR.



6.19  THE JUSTIFY WORD COMMAND - "JW"

The Justify Word command, like the  JUstify  command  (Section  6.15),
justifies a line of text.  In this case, SOS includes as many words as
possible between LMAR and RMAR without adding blanks  or  hyphenating.
The  text,  therefore, appears as typewritten text without a justified
right margin.

The format of the JW command is as follows:

          *JW<range>(CR)


---------------
*WARNING:  After a line that exceeds RMAR-LMAR+1, SOS will  print  the
error message "%LINE TOO LONG".  The text, when printed, may not be as
expected;  the margins should be  reset  and  the  command  should  be
reissued.
-SOS-                                                          Page 43


6.20  THE SET COMMAND - "_"

The Set command sets (or changes) parameters in SOS:

          *_<parameter>[=<number>](CR)

For example, after SOS has been used for a while, the  user  may  want
shorter forms of error messages.  By typing

          *_EXPERT(CR)

all error messages will be abbreviated to five characters or less (see
Appendix A).  This is reversed by typing

          *_NOVICE(CR)

Note that SOS begins in _NOVICE mode.

For the intraline edit mode W and  X  commands,  the  per  cent  sign,
dollar  sign,  and  period  are  considered part of the word.  The use
these as separators or delimiters, type

          *_SEPARATOR(CR)

This is reversed by typing "*_NONSEPARATOR(CR)", the default condition
when SOS begain edit mode.

The parameters used in the family of  Justify  commands  (LMAR,  RMAR,
PMAR,  MAXLN), the increment parameter (INC), and the LENGTH parameter
(Print option) may be assigned new values as follows:

          *_LMAR=5(CR)        *_MAXLN=1000(CR)

          *_RMAR=65(CR)       *_INC=50(CR)

          *_PMAR=10(CR)       *_LENGTH=60(CR)

The newly-assigned values are only valid  while  editing  the  current
file.

It is possible to change the name of the resultant edited file

          *_NAME=<filename>(CR)



6.21  THE GIVE INFORMATION COMMAND - "="

Any time the user is in command mode, he may request the  value  of  a
parameter by using the Give Information command:

          *=<parameter>(CR)

Possible Give parameters are:
-SOS-                                                          Page 44


*=INC(CR)       Print the current increment.

*=.(CR)         Print <current line number>/<current page>.

*=LMAR(CR)      Print the current value for the left margin.

*=PMAR(CR)      Print the current value used for paragraph identation.

*=RMAR(CR)      Print the current value for the right margin.

*=MAXLN(CR)     Print the  maximum  line  number  allowed  in  the  JU
                command.

*=BIG(CR)       Print the page number of the largest page in the file.

*=ERROR(CR)     Print the last error message - in the long form,  even
                if "_EXPERT" is in effect.

*=STRING(CR)    Print the string  used  by  the  Find  and  Substitute
                commands:

                     SEARCH:
                <Find command string(s)>
                     SUBSTITUTE:
                <Substitute command newstring(s)>
                     FOR:
                <Substitute command oldstring(s)>

*=CASE(CR)      Print whether SEPARATOR (or other words  described  in
                Chapter 9) has been set.

*=NAME(CR)      Print the name of the resultant output file.

*=LENGTH(CR)    Print the length used for determining the end  of  the
                page in the Print command options.



6.22  LINE CONTENTS SPECIFICATION - ALL COMMANDS

In SOS it is possible to address lines by content,  rather  than  line
numbers.   This  is  done by replacing each <line number> field of any
command with

           $ <string> $ (CR)

The rest of the orininal command string continues on  the  next  line.
This   may   be  another  " $ <string> $ (CR)"  or  (CR)  alone  which
terminates the entire  command.   For  example,  to  print  everything
between  a line containing "ONE" and a line containing "TWO", type the
command

          *P $ ONE $ (CR)
          : $ TWO $ (CR)
          (CR)
-SOS-                                                          Page 45


          *

Note that three carriage returns are required:  one for each string of
text and one for terminating the Print command.

If the string between two  $ s is null, then the string last  used  in
this  context  will  be  used  again.   (Strings  from  the  Find  and
Substitute commands do NOT qualify.) Normally, the search begins  with
the  current  position  and  contunues through the end of the file.  A
range, however, may be specified as follows:

           $ [<string>] $ [<range>][,D ,N][,E][,<number>](CR)

<range> may be specified as a group  of  line  numbers,  or  the  line
contents  specification  described  above  may be substituted.  In the
latter case, <range> provides the outer  boundaries  for  the  search.
<range> may be nested a maximum of three times.

          *P $ C $ (CR)            Print all the lines between, and
          : $ B $  $ D $ (CR)      including, the first occurrence of
          : $ G $ (CR)             C and the first occurrence of B.
          (CR)                     Only  use  that  portion  of   text
                                   between  the first occurrences of D
                                   and G.

Where the sample text is:

     00300     B   _current line
     00400     C
     00500     D
     00600     B                        Search through this area
     00700     C                        for lines C and B.
     00800     A   Print these 3 lines
     00900     B
     01000     G

Adding either the ",D" or ",N"  option  will  cause  the  entire  line
(",D")  or  the line number (",N") of the first occurrence of the text
to be printed.  SOS then will print an *.  If the user types RUBOUT at
this  point, SOS will search for the next line containing the text and
then print the line or line number.  Typing any other  character  will
terminate the search for the particular text.

The ",E" option specifies that upper and lower case characters are not
equivalent (see Chapter 9).

<number> indicates a number of times the string occurs.  SOS will skip
to  the last occurrence of this specification and use that line as the
starting point for its search.

          *P $ 1 $ ,D,3(CR)   SOS would print all the lines between,
          : $ 4 $ (CR)        and including, the first occurrence of
          (CR)                1  and  the  first  occurrence   of   4;
                              however, 3 in the number field indicates
                              that SOS should use the third occurrence
-SOS-                                                          Page 46


                              of 1 as its starting point.

Where the sample text is:

          1
          2
          1
          2
          1 _starting point
          2
          3
          4
          1
          2

                                NOTE:

               RUBOUT, when used with the ",D" or  ",N"
               option,  may only be repeated "number-1"
               times.



6.23  THE QUIT COMMAND - "Q"

Should the user realize that his editing is useless, he may return  to
the monitor without saving the edited version of the file by using the
Quit command:

          *Q(CR)

SOS will respond by returning him to the monitor.

          EXIT

WARNING:  CTRL-C (^C) should never be used to return  to  the  monitor
while  SOS  is  operating  since  unnecessary  temporary files will be
saved.  Use the Quit command.



6.24  THE END COMMAND - "E"

The End command is used to terminate the current edit.

          *E[<filename>](CR)

If a filename is not specified, the original copy of  the  file  being
edited  will  be  renamed  to  <filename>.BAK;   then the newly edited
version will be stored under the original filename.

If a name is specified, it will be assenged to the edited version.  If
the user specifies a filename which already exists, SOS will ask "FILE
ALREADY EXISTS!  DELETE?(Y OR N)" and wait on  the  same  line  for  a
response:
-SOS-                                                          Page 47


          Y - Delete old file and substitute new file

          N - Do not delete old file 

If "N", SOS will respond with "FILE=" and wait for a new  name  to  be
typed;  this will be assigned to the edited file.

If "Y" and if the old file cannot be deleted (such as .BAK files), SOS
will  respond  "FILE WRITE PROTECTED.  TRY ANOTHER NAME".  An asterisk
will appear on the next line.

When SOS is finished, it will return the user to the monitor:

          EXIT

Instead of using the End command to specify the filename  under  which
the  edited  version  will  be  stored,  the  user, when beginning the
editing session, may specify the new filename as follows:

          .SOS<new filename>=<old filename>(CR)

SOS will enter edit mode for <old filename>.  "*E(CR)" at the  end  of
the editing will then cause the edited version to be stored under <new
filename>.  The user  may  also  add  "/READONLY"  or  "/REA"  to  the
command;   this  will put the <old filename> in read-only mode.  Thus,
the file named <old filename> will not be overwritten.



6.25  THE SAVE WORLD COMMAND - "W"

The Save World command

          *W[<filename>](CR)

is similar to the End command except that parameters set  by  the  Set
command are not returned to their standard settings (i.e., they remain
as they were before the command), and the user is returned to  command
mode  rather  than  to  the  monitor.   This  is useful for saving the
current version of the file in case the system crashes, and should  be
done  every  fifteen  minutes  while  in  edit mode.  Then, if the the
system does crash, only the editing done since the last W command  was
issued will be lost.

If a filename is used with this command, the edited  version  will  be
saved  under  that  name.  If the W command is issued again during the
save editing session and no filename is specified,  then  the  current
version is saved with the name last given in a previous W command.

If the system crashes and a W command had not be issued recently,  the
user may be able to recover his editing by typing the Monitor command

          .RENAME<filename not in use>=nnnSOS.TMP(CR)

(where "nnn" is the user's job number).
-SOS-                                                          Page 48


This will attach the user to a temporary file which  may  be  the  one
that  SOS  was  using before the system died.  It is then necessary to
enter edit mode with the new filename.  If this  is  not  the  correct
file,  delete  it  and  try  again using another temporary file (e.g.,
nnnSOS.TEM).  A system Directory command may be issued to see if there
are any temporary files.



6.26  THE GO COMMAND - "G"

It is possible to edit a program source file  with  SOS  and  then  to
issue  a  Monitor  command (EXECUTE, LOAD, COMPILE, etc.).  SOS can be
reentered after  the  EXECUTE,  LOAD,  or  COMPILE  is  done  and  can
determine the name of the last file edited;  thus, typing

          .SOS(CR)

next will put the user immediately into edit mode  in  the  last  file
specified.  Then, once the first DECsystem-10 Monitor command has been
given, and SOS has been entered a second time the Go command  (instead
of  End)  will  write the file onto the disk, exit from SOS, and cause
the previous Monitor command to be repeated.

          *G(CR)

A filename may also be specified with a Go command:

          *G[<filename>](CR)

This simply renames the edited version;  the name will  be  saved  for
the  next Go command.  Thus, a G command alone will store a file under
a previously-specified name;  a G command which  includes  a  filename
will store the file under that new name.



7.0  READ-ONLY MODE

As indicated earlier, once a file is created it may be called  by  SOS
in  read-only  mode  by the addition of "/READONLY" or "/REA" when the
file is named in the initial conversation with SOS:

          .SOS(CR)
          FILE=EXAMPL/READONLY(CR)

               or

          .SOS EXAMPL/READONLY(CR)

The user will not be allowed to perform any editing in the named  file
(i.e., "EXAMPL").

In read-only mode, only the following commands may  be  used:   Print,
Find, End, Go and List.
-SOS-                                                          Page 49


8.0  INDIRECT COMMANDS

If a particular  sequence  of  commands  is  used  frequently,  it  is
possible  to  insert  these  commands  in  a  file.   Then  SOS can be
instructed to read commands  from  the  file,  rather  than  from  the
teletype keyboard.  The command

          *@<filename>(CR)

will do this, provided the list of commands  is  found  in  the  named
file.   When  SOS sees this command, it will begin taking its commands
from the file.  Only the following will be printed out on  the  user's
teletype:

          1.  Error messages

          2.  Printout from the P command

          3.  Items found by the F command

          4.  Substitutions made by the S command

          5.  Lines altered by the A command

If the user includes the Substitite command with the Decide option  in
his  file,  he must type in the decision character when the Substitute
command is executed (see Section 6.10).

When SOS has executed the last command in the "indirect command" file,
the user will be reutrned to command mode.

When the user is inserting commands into the  file,  he  may  have  to
enter such characters as  $  or a (CR) without the (LF) (see Chapter 9
on SOS character sets).



9.0  UPPER AND LOWER CASE REPRESENTATION



9.1  C128 AND C64 MODES

Model 33 and 35 teletypes employ  only  upper-case  letters  and  some
special  symbols,  totaling  64  characters  in  all.  SOS is capable,
however, of using the full ASCII 128-character set.  Since  edit  mode
assumes  the  64-character set, it is necessary to specify "C128" mode
in order to represent lower-case  letters  and  the  additional  ASCII
symbols.  This C128 mode is indicated in a Set command:

          *_C128(CR)

In C128 mode, a ?  preceding any teletype character will  give  it  an
equivalent meaning as indicated in Appendix D ("SOS representation").
-SOS-                                                          Page 50


From Appendix D it is obvious that upper-case letters  are  input  the
same  in  both  C64 and C128 modes, except for the ?.  In C128 mode, a
single ?  has no meaning whatsoever;  it is necessary,  therefore,  to
type ??  in this mode to represent a single ?.

To return to C64 mode, again use a Set command:

          *_C64(CR)

In C64 mode, only the characters on the  teletype  may  be  input.   A
single  ?   will  be  echoed  during  input.  In a line printed as the
result of a Print or Find command, however, a double ?  will appear.



9.2  UPPER AND LOWER CASES

SOS initially assumes that all characters are upper  case.   Thus,  in
C128  mode  it  is necessary to precede any character considered lower
case with a ?.  The user, then, can intersperse the two cases  in  his
text in this manner to obtain all alphabetic characters.

When the text primarily is  composed  of  lower-case  letters,  it  is
easier  to assume that all characters are lower case.  Then, a special
configuration (i.e., the ?) will indicate upper case.  The Set command
is used to indicate the dominance of lower case.

          *_LOWER(CR)

To represent upper-case characters, precede each with a ?.  To  revert
back to the original upper-case mode, type

          *_UPPER(CR)



9.3  COMBINING MODES AND CASES

The following examples illustrate how  SOS  modes  and  cases  can  be
combined:

            Text                               Explanation

*I1000
01000       IS THIS A LINE?                    Inserted in C64 UPPER.

*P.
01000       IS THIS A LINE??                   Printed in C64 UPPER.
*_LOWER
*P.
01000       ?I?S ?T?H?I?S ?A ?L?I?N?E??        Printed in C64 LOWER.
*_C128
*_UPPER
*P.
01000       IS THIS A LINE??                   Printed in C128 UPPER.
-SOS-                                                          Page 51


*_LOWER
*P.
01000       ?I?S ?T?H?I?S ?A ?L?I?N?E??        Printed in C128 LOWER.

*I100
00100       WHO ARE YOU?                       Inserted in C64 LOWER.

*_UPPER
*P.
00100       ?W?H?O ?A?R?E ?Y?O?U??             Printed in C64 UPPER.
*_LOWER
P.
00100       WHO ARE YOU??                      Printed in C64 LOWER.
*_C128
*_UPPER
*P.
00100       ?W?H?O ?A?R?E ?Y?O?U??             Printed in C128 UPPER.
*_LOWER
*P.
00100       WHO ARE YOU??                      Printed in C128 LOWER.

I2000
02000       IS N?<Q??                          Inserted in C128 UPPER.

*P.
02000       IS N?<Q??                          Printed in C128 UPPER.
*_LOWER
*P.
02000       ?I?S ?N?<?Q??                      Printed in C128 LOWER.

*_C64
*_UPPER
*P.
02000       IS N?<Q??                          Printed in C64 UPPER.

*_LOWER
*P.
02000       ?I?S ?N?<?Q??                      Printed in C64 LOWER.

*i3000
03000       is this the end??                  Inserted in C128 LOWER.

*_UPPER
*P.
03000       ?I?S ?T?H?I?S ?T?H?E ?E?N?D??      Printed in C128 UPPER.
*_LOWER
*P.
03000       IS THIS THE END??                  Printed in C128 LOWER.
*_C64
*_UPPER
*P.
03000       ?I?S ?T?H?I?S ?T?H?E ?E?N?D??      Printed in C64 UPPER.
*_LOWER
*P.
03000       IS THIS THE END??                  Printed in C64 LOWER.
-SOS-                                                          Page 52


9.4  MODEL 37 TELETYPE:  37 MODE

The Model 37 teletype has the full ASCII 128-character set;   it  can,
therefore, input these characters directly to SOS.  To type lower-case
letters on terminals such as the Model 37, it is  necessary  to  issue
the system command

          .TTY LC(CR)     or     >SET TTY LC(CR)

Then, to allow SOS to output lower-case characters to  this  teletype,
the user types

          *_M37(CR)

This is reversed by  another  Set  command  ("*_M33(CR)")  which  will
essentially  make  the  Model  37  teletype act as if it were either a
Model 33 or 35  -  i.e.,  2-character  equivalents  must  be  used  as
described in Section 9.1.



9.5  ASCERTAINING MODE AND CASE:  THE GIVE INFORMATION COMMAND

If there is any doubt as to which case and mode are employed, issue  a
"Give information" command.

          *=CASE(CR)

For C64 mode, SOS will print

          C64 UPPER

             or

          C64 LOWER

For C128 mode, SOS will print

          UPPER

           or

          LOWER

For C64 mode on a Model 37 teletype, SOS will print

          MODEL 37 C64 UPPER

                 or

          MODEL 37 C64 LOWER

For C128 mode on a Model 37 teletype, SOS will print

          MODEL 37 UPPER
-SOS-                                                          Page 53


               or

          MODEL 37 LOWER



9.6  SPECIAL CONSIDERATIONS:  FIND AND SUBSTITUTE COMMANDS

For a Find command<string>, upper and lower-case  characters  will  be
considered  the  same unless the E option is used.  For the Substitute
command,  upper  and  lower-case  will  be  considered  equivalent  in
<oldstring> only.



9.7  SPECIAL "MATCHING" CHARACTERS:  FIND AND SUBSTITUTE COMMANDS

If C128 mode has been specified or if a Model  37  teletype  is  used,
there  are a few special characters which "match" some other character
in the Find and Substitute command<strings>.

                    Representation* Explanation

                ?:       Matches a SEPARATOR which  is  any  character
                         other  than a letter, a number, a ".", a "%",
                         or a "$".  See Section 6.20 on Separators.

                ?/       Matches any character.


                ?%       The   subsequent   character   matches    any
                         character  which it would not normally match.
                         A?%BC will be matched by AAC, ACC, ADC, etc.,
                         but  not by ABC (or abc unless the "E" option
                         is specified with Find or Substitute).

Combinations of the above 3 codes include:

                         ?%?:  Matches any  letter,  number,  etc.   -
                         i.e., not a SEPARATOR.

                         ?%?/ Matches only the beginning or end  of  a
                         line.   For example, ?%?/OLD finds only those
                         occurrences of "OLD" at the  beginning  of  a
                         line.

                ?7       Quotes the next character.   When  used  with
                         another  special character, ?7 will find that
                         character and not its match:

                         ?7?% Searches for the  actual  occurrence  of

---------------
*Line 1:  2-character representation
 Line 2:  Stanford representation
-SOS-                                                          Page 54


                         ?%.

                         ?7?7 Searches for ?7.

                         ?%?7?% Matches any character except ?%.

                ?)       Indicates  "any  number  of"  the  particular
                         character that follows it.  For example,

                         A?)BC Matches AC, ABC, ABBC, etc.  In case of
                         ambiguity, the shortest string is found.  For
                         the above example, A?)BC will find AC  rather
                         than ABC.

                         ?)?%?7?% Matches  any  number  of  characters
                         which are not ?%'s.

Two other special characters may be used in  the  <newstring>  of  the
Substitute  command  when  one  of the special constructions discussed
above has been specified in <oldstring>.:

                ?*       Specifies that a match which occurs by  using
                         one  of the above special constructions is to
                         be used for a later substitution.

                         ?*1?* A stand-in for  whatever  was  actually
                         matched  first  by  a  special  construction.
                         ?*2?* is for the second match, etc.

                         For example, suppose all occurrences  of  OLD
                         are  to  be  replaces by NEW, but COLD, FOLD,
                         etc., also exist in the  file.   OLD  can  be
                         given  for  the  oldstring,  but  how can the
                         SEPARATORs    be    replaced?     The    "?*"
                         construction is used as follows:

                         *S?:OLD?: $ ?*1?*NEW?*2?* $ <range>(CR)

                ?"       In more complicated specifications,  ?"  will
                         replace  successive  recurrences  of  the  ?*
                         construction when they  appear  in  the  same
                         order that they were matched.

                         For example, as the file is scanned  for  the
                         <oldstring>,  the  matches  with  the special
                         constructions  are  actually   numbered   and
                         stored  on  the disk.  (The first is 1, etc.)
                         Then,   when   the   <newstring>   is   being
                         substituted,  these  numbered  matches can be
                         named for use with ?*1?*, ?*2?*, etc.   -  if
                         they  occur  in  order, ?" can be substituted
                         for ?*<number>?*.

The constructions make it possible to isolate unknown portions of text
by  manipulating  what  comes  immediately  before  and  after.  NOTE:
-SOS-                                                          Page 55


Certain strings which can be formed  with  the  above  characters  are
illegal and will produce the message "%ILLEGAL SEARCH STRING".

Since the strings are not checked when  the  command  is  issued,  the
message  will  only  be  given  when  an  attempt is made to match the
special construction.  If ?%?), or  ?7  is  not  followed  by  another
character, or if ?% is followed by ?), SOS will print "%ILLEGAL SEARCH
STRING".

Because some of these special searches invlove  recursion  or  require
the  use  of  table  space inside SOS, it is possible to get the error
message, "%SEARCH STRING TOO COMPLEX".  If this occurs, try a  simpler
string.

Example 1

Exchange two arguments of a function:

          function (A,B) => function (B,A)

where A and B may be any  string  not  including  the  left  or  right
parenthesis or a comma.

  *Sfunction(?)?/,?)?/) $ function(?*2?*,?*1?*) $ <range>(CR)

Example 2

Change all  READ (3,#)list  to  READ (5,#) list

          *SREAD?)?%(3, $ READ?"(5, $ <range>(CR)

NOTE:   This  will  not  match  "READ(4,#)  A(3,5)"  but  will   match
"READ(3,".
-SOS-                                                          Page 56


                              APPENDIX A

                            ERROR MESSAGES


     EXPERT    NOVICE

     DDE       %DEVICE OUTPUT ERROR

     DIE       %DEVICE INPUT ERROR

     DNA       %DISK NOT AVAILABLE

     FNF       %FILE NOT FOUND

     ICN       %INTERNAL CONFUSION

     ILC       %ILLEGAL COMMAND

     ILFMT     %ILLEGAL LINE FORMAT

     ILR       %ILLEGAL REPLACEMENT ON INSERT

     ILUUO     %ILLEGAL UUO

     IRS       %ILLEGAL REPLACEMENT STRING

     ISS       %ILLEGAL SEARCH STRING

     ITD       %ILLEGAL TRANSFER DESTINATION

     LTL       %LINE TOO LONG

     NEC       %INSUFFICIENT CORE AVAILABLE

     NLN       %NO SUCH LINE(S)

     NNN       %NO NEXT LINE

     NSG       %NO STRING GIVEN

     NSP       %NO SUCH PAGE

     ORDER     %OUT OF ORDER

     STC       %STRING TOO COMPLEX

     STL       %STRING TOO LONG

     UNA       %DEVICE NOT AVAILABLE

     TMS       %TOO MANY STRINGS

     WAR       %WRAP AROUNG
-SOS-                                                          Page 57


     SRF       %SEARCH FAILS

     CMERR     %INDIRECT READ ERROR

     CMEND     %INDIRECT END-OF-FILE

     MAR       %MARGIN ERROR
-SOS-                                                          Page 58


                              APPENDIX B

                         SUMMARY OF COMMANDS


ALTER

     *A<range>(CR)

          Next Character - SPACE
          Last Character - RUBOUT
          Change - C<character>
          Delete - D
          Insert - I<string> $
          End Alter Mode - (CR)
          End Alter Mode - E (without printout)
          Quit - Q
          Start Over -  ^U
          Skip - S<character>
          Kill - K<character>
          Replace - R
          Line - L
          Print - P
          Justify - J
          Word - W
          Delete Word and Insert Text - X<string> $

COPY

     *C<destination line number>,<source range>[,<inc1>[<inc2>]](CR)

     *C<destination line number>_<source filename>/S(CR)

DELETE

          *D<range>(CR)

END
          *E[<filename>](CR)

EXTEND

          *X<range>[,S](CR)

          <text>[ $  (LF)](CR)

FIND
          *F[[<string>] $ [<range>][,A ,N][,E][,<number>]](CR)

GIVE

*=INC BIG CASE ERROR STRING . LMAR PMAR RMAR MAXLN LENGTH NAME(CR)

GO
-SOS-                                                          Page 59


          *G[<filename>](CR)

INSERT

          *I<line>[,<increment>](CR)
                       or
          *I<line>[;<increment>](CR)

JOIN

          *J<line>(CR)

JUSTIFY

          *JU<range>(CR)

JUSTIFY CENTER

          *JC<range>(CR)

JUSTIFY LEFT

          *JL<range>(CR)

JUSTIFY RIGHT

          *JR<range>(CR)

JUSTIFY WORD

          *JW<range>(CR)

LINE CONTENTS SPECIFICATION - ALL COMMANDS

          line number field =
           $ <string> $ (CR)

LIST

          *L[<range>][,S](CR)

MARK

          *M<line number>/<page number>(CR)

NUMBER

          *N<increment>[,<range>[,<starting number>]](CR)

PRINT

          *P[<range>][,<options>](CR)

QUIT
-SOS-                                                          Page 60


          *Q(CR)

REPLACE

          *R<range>[,<increment>](CR)
                       or
          *R<range>[;<increment>](CR)

SAVE WORLD

          *W[<filename>](CR)

SET

          *_<parameter>(CR)

          parameter =
               UPPER/LOWER
               M33/M37
               C64/C128
               NOVICE/EXPERT
               NONSEPARATOR/SEPARATOR

          *_<parameter>=<number>(CR)

          parameter =
               INC LMAR PMAR RMAR MAXLN LENGTH

          *_NAME=<filename>(CR)

SUBSTITUTE

  *S[<oldstring> $ <newstring>] $ [<range>][,D ,N][,E][,<number>](CR)

TRANSFER

 *T<destination line number>,<source range>[,<inc1>[,<inc2>]](CR)
-SOS-                                                          Page 61


                              APPENDIX C

                            DEFAULT VALUES


If certain <parameter>s are not assigned values by  the  Set  command,
they will assume a default value:

          INC=100
          LMAR=1
          PMAR=1
          RMAR=69
          MAXLN=99999
          LENGTH=55

Also, the following <parameter>s are "modes" in which SOS begins:

          UPPER,M33,C64,NOVICE,NONSEPARATOR

These can be reversed by using the  Set  command  with  the  following
<parameter>s:

          LOWER,M37,C128,EXPERT,SEPARATOR
-SOS-                                                          Page 62


                              APPENDIX D

                        ASCII CHARACTER TABLE


          0      1      2      3      4      5      6      7

         NUL    SOH    STX    ETX    EOT    ENQ    ACK    BEL     A
   00                                                             B
                ?!     ?"     ?#     ?$     ?%     ?&     ?'      C

         BS     HT     LF     VT     FF     CR     SO     SI
   01           TAB
         ?(

         DLE    DC1    DC2    DC3    DC4    NAK    SYN    ETB
   02
         ?+     ?,     ?-     ?.     ?/     ?0     ?1     ?2

         CAN    EM     SS     ESC    FS     GS     RS     VS
   03
         ?9     ?6     ?4     ?=     ?<     ?>     ?7     ?8

   04    SP     !      "      #      $      %      &      '

   05    (      )      *      +      ,      -      .      /

   06    0      1      2      3      4      5      6      7

   07    8      9      :      ;      <      =      >      ?
                                                          ??

   10    @      A      B      C      D      E      F      G

   11    H      I      J      K      L      M      N      O

   12    P      Q      R      S      T      U      V      W

   13    X      Y      Z      [      \      ]      ^      _

   14           a      b      c      d      e      f      g
         ?@     ?A     ?B     ?C     ?D     ?E     ?F     ?G

   15    h      i      j      k      l      m      n      o
         ?H     ?I     ?J     ?K     ?L     ?M     ?N     ?O

   16    p      q      r      s      t      u      v      w
         ?P     ?Q     ?R     ?S     ?T     ?U     ?V     ?W

                                            ESC           DEL
   17    x      y      z                                  RUB
         ?X     ?Y     ?Z     ?[     ?:     ?]     ?3


 A   128-character code
-SOS-                                                          Page 63


 B   Stanford character
 C   2-character equivalent