Customizing VMS V1.0
UNDER CONSTRUCTION - NOT YET FINISHED!
The aim of this tutorial is to show how to customize VMS V1.0 on the SIMH VAX-11/780 simulator or a real VAX-11/780 ;-).
Contents
Tools and skills needed for customizing
The SOS line editor
You need an Editor to customize VMS.
Using an old fashioned editor is something that really needs getting used to.
VMS V1.0 includes SOS, a "Line Editor", i.e. you work on single lines of your text, no simple scrolling as we're used to nowadays.
see: AA-D030B-TE VAX-VMS Primer
Creating a New File
You create a new file by calling the EDIT command followed be the name of your new file.
$ EDIT TEST.TXT Input: DMA0:[SYSMGR]TEST.TXT;1 00100
The editor echos device, directory, and file name of your new file and presents the first (empty) line with its line number (100). Now you just proceed als follows:
$ EDIT TEST.TXT Input: DMA0:[SYSMGR]TEST.TXT;1 00100 This is the first line of a new text file. 00200 Pressing [Enter] starts a new line. 00300 Using [ESC] switches to command mode. 00400 The command mode prompt is "*". 00500 At the command mode "W" writes the file to disk, 00600 and "E" ends the editor. *W [DMA0:[SYSMGR]TEST.TXT;1] *E [DMA0:[SYSMGR]TEST.TXT;1] (NO CHANGES) $
That's all (at least if you writing without typos and changes)!
Editing an Existing File
$ EDIT TEST.TXT Edit: DMA0:[SYSMGR]TEST.DAT;1 *
The asterix (*) is the editor's command mode prompt.
When you see an * at the beginning of a line, the editor expects a command.
Specifying Lines
To specify lines you use the marks:
: (colon)
. (dot)
^ (caret)
* (asterix)
and line numbers.
| Mark | Meaning | Example | Explanation of Example |
|---|---|---|---|
| : | Range | 100:500 | Lines 100 through 500 |
| . | Current Line | .:500 | Current line through 500 |
| ^ | First Line | ^:. | First line through current line |
| * | Last Line | .:* | Current line through last line |
Displaying Lines
To display lines 100 to 600 type: P100:600
*P100:600 00100 This is the first line of a new text file. 00200 Pressing [Enter] starts a new line. 00300 Using [ESC] switches to command mode. 00400 The command mode prompt is "*". 00500 At the command mode "W" writes the file to disk, 00600 and "E" ends the editor. *
To display all lines of a file type: P^:*
Inserting Lines
Insert after the current line: I.
Insert after e.g. line number 300: I300
Renumbering Lines
Renumbering Lines: N
Deleting Lines
Delete current line: D.
Delete e.g. line number 300: D300
Replacing Lines
Replace current line: R.
Replace e.g. line number 300: R300
Replace a range of lines, e.g. 300:600: R300:600
Finding Line Contents
Find line contents following the current line:
FEnter<ESC><RETURN>
To search the whole text
P^
Find remembers the last string searched for, so:
F<RETURN>
finds the next occurrence (if any)
Substituting Text
All occurrences on a line
Ssearchtext<ESC>replacetext<ESC><RETURN>
SOS Help
*help
SOS Help Package
To print this entire package on the line printer, type the
DCL command:
PRINT LB:[1,2]SOS.HLP
This package is made up of 11 modules (listed below). Each
module in turn will now be printed at your terminal.
To skip to the next module, discarding the rest of the one
that is printing, type:
<^O> (Type O while pressing CTRL.)
To discard the rest of the Help package at any time, and to
return to Edit-mode command level, type:
<^C> (Type C while pressing CTRL.)
The next time you issue a Help command, you can follow it
with a colon and a number (H:n<CR>); SOS will print the
Help package from module number n through the end.
The modules are:
1. SOS Modes of Operation
2. Edit-Mode Commands -- Functions
3. Edit-Mode Commands -- Formats
4. Definitions for Edit-Mode Command Formats
5. Tag Options for Edit-Mode Commands
6. Alter-Mode Commands
7. Decide-Mode Commands
8. Shorthand Characters in Position Arguments
9. SOS Parameters
10. SOS Switches
11. Special Pattern-Matching Constructs
Module 1: SOS Modes of Operation
The underline (_) represents the next character position after
the prompt. nnnnn is a 5-digit line number.
Mode Prompt Use
------------------- --------- ------------------------------------
Edit *_ Edit: add, change text.
Input nnnnn _ Type in lines of text.
Alter nnnnn _ Edit within a line.
Alter/insert (none) Insert text within Alter mode.
Read-only R*_ Examine a file without changing it.
Copy-file C*_ Search, copy from another file.
Decide D*_ Decide case-by-case on substitutions.
Decide Alter nnnnn _ (Submode.) Like Alter mode.
Decide Alter/insert (none) (Submode.) Like Alter/insert.
-----------------------------------------------------------------------
To Change from One Mode to Another:
FROM mode TO mode You type:
--------- --------- --------------------------
Edit Input Input or Replace command
Alter Alter command
Read-only /READONLY<CR>
Copy-file Copy command with final /C
Input Edit <AL>
Alter Edit <CR>
---------------------------------------------------
Module 2: Edit-Mode Commands -- Functions
Command Function
------------------ -----------------------------------------
A Alter Enter Alter mode for intraline, char-
acter-by-character editing.
C Copy Copy a range of lines to another place
within a file, or from another file.
D Delete Delete a range of lines.
E End End SOS, return to MCR.
F Find Search for the occurrence of one or more
specified strings of text.
H Help List this Help file at the terminal.
I Input Enter Input mode to insert lines of text.
J Join Join two text lines into one line.
K Kill Page Mark Delete a page mark.
L List List a range of lines on the printer or
to a file.
M Mark Insert a page mark.
N reNumber Renumber a range of lines.
NA reNumber Renumber by adding the increment
to each line in the range
NP reNumber Renumber continuing to increment
line numbers across page marks
P Print Print a range of lines on the terminal.
R Replace Delete a range of lines and enter Input
mode.
S Substitute Replace one or more text strings with
other string(s) in a range of lines.
T Transfer Copy a range of lines to a new location
and delete the original lines.
W Save World Write a new file containing all the
changes made so far.
X eXtend Enter Alter/insert mode to add text to the
end of a line or a range of lines.
. Move Position Reset the position of the current line.
= Give Parameter Give the value of an SOS internal para-
meter or switch.
/ Set Parameter Reset an SOS parameter or switch.
@ Indirect File Execute the SOS commands contained in an
indirect file.
<CR> Print next line.
<AL> Print previous line.
Module 3: Edit-Mode Commands -- Formats
Command Format (*)
--------------- -------------------------------------------------
Alter A [range]
Copy C position[=filespec],range[,incr1[,incr2]]
position=filespec/C
Delete D [range]
End E [B][Q][S][T][:filespec]
Find F [[string]<AL>[range][,A][,N][,E][,-][,n]]
Help H [:n]
Input [{,incr}]
I [position][{;incr}]
[{ ;!n }]
Join J [position]
Kill Page Mark K /page
List L [range][,[S][,P[:n] or [:filespec]]]
[range][,[S][,F:filespec]]
Mark M [position]
reNumber N [A P][incr][,[range][,start]]
Print P [range][,S]
Replace [{,incr}]
R [range][{;incr}]
[{ ;!n }]
Substitute S [[oldstring<AL>newstring]<AL>[range][,D][,N][,E]]
Transfer T position,range[,incr1[,incr2]]
Save World W [B][:filespec]
eXtend X [range][,N]
Move Position . position
Give Parameter = parameter
Set Parameter / parameter[:value]
Indirect File @ filespec
<CR> <CR>
<AL> <AL>
------------------------------------------------------------------
(*) The space after the single-character command is optional. End
each command with <CR> (except the commands <CR> and <AL>).
Module 4: Definitions for Edit-Mode Command Formats
Upper-case letters represent literals that you type verbatim. (SOS
accepts either upper- or lower-case letters.) Lower-case terms
represent variables, defined below. The symbols we use mean:
:= "Is defined as."
[ ] Brackets indicate optional parts of the argument string (except
in "directory" of "filespec," in which one set of brackets
must be typed).
{ } Stacked braces mean to choose one of the enclosed expressions.
< > Angle-brackets enclose descriptive terms.
<AL> represents the altmode key (or ESCape, or SELect).
filespec := [node::][device:][[directory]]filename[.type[.version]]
incr := <a positive integer line-number increment>
l := <a line number> (less than 65536)
{ l }
line := { ^ } [+ or - m]
{ * }
{ . }
m := <an integer line-number offset>
n := <a positive integer>
p := <a page number>
{ p }
page := { ^ } [+ or - q]
{ * }
{ . }
parameter := <a legal SOS parameter or switch>
position := { line [/page] }
{ /page }
q := <an integer page-number offset>
{ }
{ position [{:position}] }
{ [{ !n }] }
range := { }
{ :position }
{ }
{ !n }
start := <a positive integer line number>
string := string1[<CR>string2[<CR>string3[<CR>string4
[<CR>string5[<CR>string6]]]]]
value := <a legal parameter value>
Module 5: Tag Options for Edit-Mode Commands
Tag
option Meaning In commands
------ -------------------------- ------------------------
,A Enter Alter mode Find
,D Enter Decide mode Substitute
,E Require exact case match Find, Substitute
,F List to disk file List
,N Type only number, not line Find, Substitute, eXtend
,P Select printer List
,S Suppress line numbers List, Print
,- Find line not matching any Find
of specified strings
------------------------------------------------------------
Module 6: Alter-Mode Commands
Command Meaning
--------------- -----------------------------------------------------
B Move pointer to start of line
[-][n]Cx... Change next/previous n characters to given characters
[-][n]D Delete next/previous n characters
E End Alter mode for this line; do not print line
[-][n]Itext<AL> Insert after/before current character; use temporary
increment n for new lines
[-][n]Kx Kill (delete) all until nth occurence of character x
L Print rest of line; recycle to beginning of line
with edits incorporated
P Print rest of line; recycle to current position
with edits incorporated
Q Quit Alter mode for this line; restore original line
[-][n]Rtext<AL> Replace next/previous n characters with inserted text
[-][n]Sx Skip forward/back to nth occurence of character x
[-][n]W Skip forward/back n words
[-][n]X Delete next/previous n words
[-][n]<BS> Space back/forward n characters
<CR> Finish Alter mode for this line; print rest of line
[-][n]<DE> Space back/forward n characters
<CR> Finish Alter mode for this line; print rest of line
[-][n]<SP> Space forward/back n characters
[-] <TA> Skip to end/start of line
<^R> Retype line to current position
<^U> Start fresh -- discard edits, recycle to beginning of
line, do not print line
[-][n]^ Invert case of next/previous n characters
[-][n]< Convert next/previous n characters to upper case
[-][n]> Convert next/previous n characters to lower case
-----------------------------------------------------------------------
Module 7: Decide-Mode Commands
Command Meaning
----------- ----------------------------------------------------
<SP> or Y Yes, make the change as shown
<DE> or N No, do not make the change
A Alter: enter Alter mode with the change already made
E or Q End: do not make the change, return to Edit mode
G Go: make the change, and make all further changes
automatically (leave Decide mode)
-------------------------------------------------------------------
Module 8: Shorthand Characters in Position Arguments
Char- Meaning
acter
------ ------------------
. Current line
/. Current page
^ First line on page
/^ First page in file
* Last line on page
/* Last page in file
---------------------------
Module 9: SOS Parameters
1. You can set any settable parameter by using the Edit-mode command
"/" (Set Parameter).
2. You can specify any settable parameters as switches on the initial
SOS command.
Can be Initial
Name(*) set? value Description
------- ------ ------- ----------------------------------------
BIG no -- Highest page number
ERROr no (null) Last error message
ESCApe yes (null) Character for input/output of escapes
ID no -- Current SOS version number
INCRement yes 100 Increment fornoumbering inserted lines
ISAVe yes 0 Controls auto-W on inserts
LENGth yes 55 Page size for List command
LOCAtion no ^/1 First line in edit buffer
MATCh yes (null) Special pattern-matching flag character
NAME no -- Output filespec
PLINes yes 16 Number of lines printed by P<CR>
SAVE yes 0 Controls auto-W on commands
STARt yes 100 Starting line number
STEP yes 100 Increment for initial line numbering
STRIng no (null) Current Find and Substitute strings
SUBStitute no 0 Number of matches in last Substitute
. no 00000/1 Current position
----------------------------------------------------------------------
(*) Minimum abbreviation is given in upper-case letters.
Module 10: SOS Switches
1. You can turn on any switch by using the Edit-mode command
Set Parameter (/).
2. You can specify any switches in the initial SOS command.
3. You can turn off any switch by using the letters NO before
its name; thus, /NOBAK<CR> turns off the BAK switch.
Initial
Name(*) value Description
------- ------- -------------------------------------
BAK on Create backup file
DECIde off Auto Decide mode on Substitute
EXACt off Exact case match for Find, Substitute
EXPErt off Experienced SOS user
LINE on Use existing line numbers
LOWEr on Uppercase, lowercase as is
READonly off Read-only file
SEPArator off Treat % $ . as alphanumeric
SEQUence on Leave output-file line numbers
-----------------------------------------------------------
(*) Minimum abbreviation is given in uppercase letters.
Module 11: Special Pattern-Matching Constructs
To enable special pattern-matching, type /MATCH<CR>. To enable
it with a flag character other than ?, type /MATCH:x<CR>, where
x is the desired flag character. To disable special pattern-
matching, type /MATCH:<CR> (note the colon).
Con- Internal Meaning
struct represen-
tation
------ --------- ----------------------------------
?/ <^T> Match any character
?: | Match any separator
?%x <^E> Match any character except x
?)x <^N> Match 0 or more of the character x
?! <^A> Match any letter, either case
?& <^F> Match any upper case letter
?1x <^V> Match 1 or more of the character x
?9 <^X> Match any alphanumeric character
?+ <^P> Match any decimal digit 0-9
?2 <^W> Match any lower case letter
?< <^\> Match a space or tab
?> <^]> Match if at either end of line
?? ? Match the flag character (?)
-------------------------------------------------------
The text strings that match the above constructs are available
to be used in the Substitute strings. Each construct above that
appears in the find string is numbered from left to right, starting
at one. To place the n'th such matching string into the resulting
text, use the following construct in the replacement string:
?*n?*
which will be replaced by the string of characters matching the
n'th special construct in the find string. To access sequential
substrings, the ?" construct can also be used:
?*n?*?"
will take the n'th and n+1'st string.
*