Workbook for SLD Offline Users - Handling Files on VMS


This section of the Workbook teaches you the basics of handling files in the VMS operating system. Experienced VMS users can skip this page.

In many of the examples in this section, the mark

is used to indicate the standard prompt you get from a VMS system when it is waiting for a command. Properly, this mark is called the "DCL prompt," but you will also hear people call it the "VMS prompt."

Your actual DCL prompt may vary depending on the VMS host you are logged on to and on how your LOGIN.COM file is configured. For many users, the DCL prompt includes the name of the VMS host. For example:


Most of what is discussed here is available in more details in any book on the VMS operating system.

In addition, VMS comes with a very detailed help system to provide details on all VMS commands.

To get to this help online from the DCL prompt, type

> help followed by the command name

or just type

> help


In the First Day section of this Workbook, you learned just enough about the VMS directory structure to set up your account. To learn more about getting around the VMS directory structure, you first need to know the VMS convention for specifying directories and files.
Armed with this recipe, you should be able to find any file you want.

If you are ever unsure about the correct name of a file or directory you want to find, you can use the "wildcard" character: *. The * translates to match any string. For example

> directory [mymain]*.f*

will give you a listing of all files in the "mymain" directory with extensions starting with the letter "f". It would match extensions, .FOR, .FLI, .F77, and so on.

> directory [mymain.*]

will list all files in all the subdirectories immediately below "mymain".

To go to a new directory, you use the set default command:

> set default [directory]

Thereafter, any time you omit the full directory name, VMS will assume you mean this default directory.

Note that in the above set defaultcommand, we omitted the nodename and diskname since we weren't interested in changing them.

To see what your current default directory is at any time, simply type:

> show default

Try this now. You should be at your main directory; if not, go there. To see what's in it, type:

> dir

Here we have used the normal abbreviation for the directory command. Included in this listing should be the new directory you made in the First Day, listed as FIRST.DIR.

Creating a Directory

In the First Day section of this workbook, you already created some directories (a scratch directory and a directory called FIRST). You did this using the create/dir command. The complete form of that command is

> create/dir nodename::diskname:[directory]

nodename and diskname can be ommitted if they are to be the same as your current default directory.

If you are creating a new subdirectory of one of your other directories (this is the most common case), you can just set your current directory appropriately and then issue the create/dir command with just the new subdirectory name.

Try this now. Create a new directory called SECOND.DIR as a subdirectory of your login directory,

> set default [your login directory]

> create/dir [.SECOND]

If you issue a dir command now you will see that you have two subdirectories, named FIRST.DIR and SECOND.DIR.

Editing a File

To create new files, use the EVE editor. EVE stands for Extensible Vax Editor. We'll show you a little about how to use EVE here in the Workbook, but we'll refer you to EVE's own extremely useful and detailed built-in help system for all the details.

To start the editor, just type eve.

You will find yourself in a full-screen editing environment with a large "eve window" where your file can be typed and a small "command line" at the bottom of the window that accepts a variety of editing commands. These two areas are separated by a line of editor status information.

Initially the cursor will appear at the top of the window. To create your file, just start typing.

You should be able to move around in the file using the arrow keys.

To access many of the more powerful editing commands, you need to get the cursor to the bottom section of the window. The down arrow will not do this. Instead, you have to hit something called the Do key. The Do key toggles you between the top and bottom areas of the window. The Do key is the most important of the special command buttons on the keyboard. If you have a VMS style keyboard, the key will be labeled Do. The PF4 key may also do the trick. Otherwise, ask your collaborators or system manager how the keyboard is mapped for your terminal. Tell them right away that you need to know which are the Do, Select, Insert, Remove and Find keys. If there are no keys already mapped for these functions, use the Define command to redefine any keys that you can spare for that purpose.

To find out more about how to use EVE, hit the Help (on some terminals, PF2) button or type help from the command line. This will invoke EVE's online Help facility which can tell you far more about how to use EVE than we have space for here.

Take a quick look at help right away. Start by studying the commands Do, Select, Insert, Remove, Find, Get and Write. These are the very minimum that you need to learn.

In the above example, you just typed EVE to start the editor. If you also include a file description in your EVE command, EVE will start right out with your file in the buffer.

For example, the following will start EVE out with your file in the buffer. This is the file that is executed whenever you log on to your VMS account. Once you know more about VMS, you will probably want to customize this file.


One of the advanced features of EVE is that it allows you to edit several files at once. To see how this works, get to the command line and type:

Command: two

This will divide the screen into two windows, both with a copy of the same file. If you then go to the command line and issue a GET FILE command, you can have different files in the different windows. Note that there is still only one Command line. You can have many editing windows, but only one Command line.

To move between the two different editing windows, go to the Command line and type other.

Commands you enter on the Command line will affect whichever buffer you were last in.

Before you leave EVE, generate at least two files to be used in the following part of the Workbook. They can have anything in them, but make one file called junk.file and another one called new.file.

To leave EVE, type: Command: exit

If you had work that was changed since the last time it was written out, you will be prompted for whether to save the changes. Old versions are saved until you explicitly delete or purge them as will be described below.

If you have many buffers and you want to get out of all of them without saving any changes, you can also exit by typing:

Command: quit

EVE will prompt you to make sure that you really mean to do this.

When you have finished this first EVE session, you may want to make sure you didn't cause any unintended permanent changes to your file. Use dir/date=modified to check that the highest numbered version of your file is still the one you want. If it isn't, delete any unintended new versions using the delete command described below. Unintended changes to your login.comfile can cause trouble next time you try to log on.

Typing Out a File

To take a quick look at the contents of a file without using the editor, use the type command. For example,

> type new.file

Look at help type for many other useful options for the type command.

Deleting a File

To delete a file, use the delete command.

Try this now on the junk.file left behind by your EVE session.

> delete junk.file;1

Note that you were required to include the version number in the file specification. Most other VMS commands will just assume the highest version number if one is not specified, but as a safety measure, the delete command always requires a version number.

To check that the file was indeed deleted, do another dir.

Go ahead and delete any other junk files or unnecessary extra versions of files you created during your EVE session. But leave the You will want it later in this workbook. Also be careful not to delete your original file.

Restoring a Deleted File from Backup Tapes

If you ever delete a file that you did not intend to delete, you may still be able to restore at least an old version of the lost file. It depends which disk the file was on.

This workbook will not actually take you through the process of restoring a deleted file from tape. It is enough for you to be aware that backups are possible.

If you ever do need to restore a deleted file, you will use the RESTORE command. This command can only be performed from the SLACVX Vax itself. You can not perform this operation from any other node in the cluster. Use SET HOST SLACVX to start a session on the SLACVX Vax.

The RESTORE command takes you through a procedure that has two main parts. The first part shows you information about what files have been stored to what backup tapes. The second part actually performs the restore.

After you type RESTORE

You should only use the RESTORE command when you really need it. The command ties up tape drives which are in short supply on the SLACVX cluster.

Deleting a File

To delete a file, use the delete command.

Try this now on the junk.file left behind by your EVE session.

> delete junk.file;1

Note that you were required to include the version number in the file specification. Most other VMS commands will just assume the highest version number if one is not specified, but as a safety measure, the delete command always requires a version number.

To check that the file was indeed deleted, do another dir.

Go ahead and delete any other junk files or unnecessary extra versions of files you created during your EVE session. But leave the You will want it later in this workbook. Also be careful not to delete your original file.

Protection of Files

On the First Day you created a new subdirectory under your main directory. As an exercise to learn about VMS file protection, try now to delete this directory.

Go to your main directory and type:

> delete SECOND.DIR;1

Note that as a safety feature, delete requires you to type the complete file specification including filename, extension and version number.

Because you are trying to delete a directory, VMS should respond with:

   %DELETE-W-FILNOTDEL, error deleting DISK$SLD_USR0:[userid]SECOND.DIR;1
   -RMS-E-PRV, insufficient privilege or file protection violation

The delete failed because when you created the directory, VMS added a high level of protection to the .DIR file. It does this to protect you from accidentally deleting a whole directory full of files.

If you really want to delete a directory, you need to change the level of "protection" of the directory file. Do this as follows:

> set protection/owner:d SECOND.DIR

This allows the owner of the file (you) to delete it, which you can now do.

You can also just abbreviate this command as:

> set prot SECOND.DIR

Note that you do not need this set prot command to delete files from the SLACVX Cluster's $SCR disk. Protection is not so strongly enforced there since that disk is not intended for long-term storage of important work.

Note also that regular files on any disk are NOT automatically protected from deletion. You can get rid of them at any time using a simple delete command. If you have important files you want to protect from accidental deletion, you can change their protection with another form of the the set protectioncommand. For details, type

> help set protection

Another hint: be VERY careful about using wildcards (*) in a delete command; you can easily end up deleting lots of files you did not intend to. The best way to avoid this is to always protect important files (as above) and use the delete/confirm option with wildcards. When you include the confirm option, delete will ask you separately whether you really want to delete each individual file.

Purging Lower Numbered Versions

Since VMS editors typically leave lots of versions of a file around as you work, VMS has a special command for deleting all of the lower numbered versions of a file. The command is purge.

If you do not already have several versions of your new.file, go back into EVE and write the file out a few times. When you leave EVE and do a dir/date, you will see that you now have several different versions of the file.

Now type: > purge new.file

If you repeat the dir/date, you will see that all of the lower numbered versions of the file have been deleted.

Notice that the purge command does not ask for a version number. It always deletes all but the highest numbered versions.

You can also type purge with no file specification. It will the delete all of the lowered numbered versions of all of the files in the current directory.

This might seem like a dangerously powerful way of deleting files, but it fits neatly with the fact that experienced VMS users do not rely on old version numbers to save important old files. Instead, put any important old versions into a different directory or give them a slightly different name.

Copying a File

Most of the time, rather than creating a file from scratch, you will start with someone else's file and then make your own changes. To do this, you will want to use the copy command. Try making a copy of the new.file you created during your EVE session.

> copy new.file copy.file

This will make a copy of your new.file called copy.file in the same directory as your first file.

Now try copy again, but this time specify a different directory for the copy to go to.

> copy new.file $SCR:[userid]copy.file

There will now be a copy.file in your personal directory on the scratch disk.

As with most VMS file handling commands, you can use the wildcard character (*) sometimes to save typing. If you want your copy to keep the same filename, you can substitute the wildcard: *.* . To see this feature at work, do:

> copy new.file $SCR:[userid]*.*

This makes another copy of the file, again in your personal directory on the scratch disk. It will have a higher version number than the previous copy.

The copy will also work if you leave specify no filename or extension at all for the copy, like

> copy new.file $SCR:[userid]

VMS will assume you want the same filename and extension.

Renaming a File

Another commonly used command is rename:

> rename new.file copy.file

If you try this you should find you now have two versions of copy.file in your current directory. You have the version you made earlier using the copy command, and you have the version you made now using the rename command. Check this out using the dir/date command.

Be careful when using purge after you have been doing complicated things with copy or rename. The purge command uses version numbers, not dates and times to tell which versions of a file to delete. If you do complicated things with copy or rename, you can get into a situation where the highest numbered version is not the newest. Edit, type or use dir/date to check which version you really want to keep.

Also be careful with dir/date. When you change the name of a file, the date you see from dir/date does not change. To see the last time anything at all was done to the file, use dir/date=modify. This gives you the "file modification date" as opposed to the "file creation date."

Printing a File

Another thing you will need to know is how to make hard copies of the text and graphics files that you generate. Unfortunately, unlike most operations on VMS, sending output to a printer is somewhat dependent on where you are and what printer you are trying to talk to. In this example, we will assume you are trying to use a printer in the SLD area (Central Lab Annex) at SLAC. You may want to ask your local colleagues about the protocol if you regularly work somewhere else.

First lets print out a hard copy of your file:

> print/queue=imcla2

This command sends the file to the IMAGEN printer on the 2nd Floor of Central Lab Annex, located near room 209. Jobs sent to this printer are arranged in a "printer queue" which has the queue name imcla2. VMS should reply:

   Job MYFILE (queue IMCLA2, entry nnnn) started on IMCLA2

to let you know that your job has entered the queue. Entry numbers are used by VMS to keep track of all jobs in all queues. When your job reaches the head of the queue it is printed.

To see the logical names of some other printers you can use (and there are many), do:

> show queue/device=printer

which will list the print queues and (in most cases) tell you where the printers are located. Again, you may want to ask your colleagues in nearby offices about which printers are best to use.

Some printers can handle only text, some can handle only graphics and some can handle both. If you try to send a formatted graphics file (such as PostScript) to some of the print queues that can only handle text, you may get many pages of useless output. The IMCLA2 queueu mentioned above has this problem. So take some care to check what the printer can handle before you send it your file.

If you accidentally do send graphics to a printer that can not handle it, or you want to stop a print job for some other reason, use the delete/entry command. Notice that this is just a special form of the delete command that you learned above to get rid of files. In general VMS gets by with a fairly small set of commands.

> delete/entry=nnnn

will take the job with entry number nnnn out of the queue before it executes. If the job has already started printing, this may not be enough. Some printers have enough internal memory that they can still be printing long after VMS itself has completely sent the file. In these cases look for instructions near the printer or ask your colleagues what to do.

Some printers have more than one queue feeding them. For example, they may have one queue for text and another queue for graphics, or they may have one queue for portrait format pages and another queue for landscape format pages. The output still goes to the same printer, but the VMS queue system handles ordering the files and configuring the printer.

In the First Day section of this Workbook, after you displayed a histogram on your X terminal, we had you output a this same image to a PostScript file on your disk. We also had you output a PostScript file of an event display to your disk. You can now try using the print command to get hard copies of these images. Since these are PostScript graphics images, make sure the printer to which you are sending them can handle PostScript. Use show queue/device=printer before you proceed if you are not sure.

Logical Names

Once you have become comfortable with the basic VMS file handling commands, you may get tired of typing in the same directory specifications and file specifications over and over again. This can become especially tiring when you are working in a complicated directory structure with lots of subdirectories. You can save much of this typing by using VMS "logical names," often referred to just as "logicals." These are names you define that VMS automatically substitutes for other names.

A logical name is a kind of a pointer. They can be used not only to create shorter strings that you type instead of long names, but they can be used to set up all sorts of useful structures. Logical names are heavily used in all SLD code to manage the vast software structures which support data taking and analysis.

Logical names are created by the define command:

> define mytem $scr:[userid]

In this example we have created the logical name mytem which stands in place of the name of your root directory on the scratch disk Many users put several of this sort of define commands into their login.comfile to define a set of useful logical names for them at the beginning of each session.

You can use this logical name just as you would any other directory name, for example:

> set def mytem

will set your default directory to $scr:[userid].

Logical names can point to more than one physical location, as in this example:

> define home $usr:[userid], $usr:[userid.first]

where here home refers to both your root directory on the user disk and the subdirectory [...first] you created on the First Day. VMS interprets this by always looking at each item in the define command in order. Hence, if you now did:

> dir home

you would get a directory listing of both $usr:[userid] and $usr:[userid.first], in that order.

In cases where VMS must return one and only one physical file (for example, edit it will return the first one it finds on the list.

To see what the meaning of a given logical name is, you can type

> show logical name

Some of the standard code in your file defines a huge number of logical names that make it possible for SLD software to find all of its pieces on your VMS system. If you have lots of time to watch a long list of names, try show logical ducs*

The logical names you create with the basic define command go away every time you log out. Put the ones you want into your file.

We'll take another look how logical names make the whole SLD software world work when we get to the section of the workbook on DUCS.


Electronic Mail is the preferred form of communication for announcements, queries, shift swaps, meeting reminders, meeting minutes, meeting meetings... you get the idea. You don't need to pick up a phone, you don't need to go through a secretary, and most people actually read and reply to their e-mail. Here we will show you the basics of how to use the VMS mailer so that you too can inundate your colleagues with the electronic equivalent of Publishers' Clearing House mailings and become just as beloved as Ed McMahon.

If you are new to the world of e-mail, remember that you should treat it just like regular mail: it is (in principle) private. You don't read other people's mail (unless invited). You don't forward private mail messages to others (unless permitted). And you make mass mailings only when necessary. Also be advised that the Department of Energy reserves the right to ignore these rules since they're paying the bill.

To use e-mail from VMS, start the mail system by typing

> mail

You will then see the MAIL>prompt, and, if you have new incoming mail, the status message

   You have new Mail messages.

Sending Mail

To send mail, type
   MAIL> send

to which the computer will respond:


For this first example, try sending mail to yourself; respond with your own userid.

Then you will be prompted to give your mail a subject heading:


Any one line response will do for this example.

You will then be put into the standard EVE editor to compose your message. When you quit the editor, the message will be sent.

In a few seconds the computer should notify you of your new mail.

   New mail on node ...

The message will appear on all of the windows that you have logged in to that VMS system, not just the one in which you are currently running mail.

Mail Addresses

To send mail to anyone on the same VMS system as you, you only need to specify his or her userid:
   To: gdc

If you want to send mail to someone on another computer you need to give a more complete address. For other users at your same institution, it is still rather simple: you only need to add the nodename of their computer:

   To: in%"gdc@unixhub"

where the in% prefix specifies an Internet address, and in this case the node is unixhub. The actual address is everything between the quotation marks. You may occasionally see other network prefix abbreviations (jnet%, com%, mil%) but Internet is rapidly becoming the "standard" US network and you are encouraged to use Internet addresses whenever possible.

To send mail to someone at a different educational institution in the US, you need to provide even more detail in the address:

   To: in%"gdc@unixhub.slac.stanford"

If they are not at an educational institution, you will need to add even more detail to the address:

   To:  in%"", in%""

where here we're sending the same mail to more than one person (at least until Scott Adams is elected President).

The part after the dot can be

Finally, the address may contain a country code at the end.

You can leave out as much of the end of the address as is the same as your own address.

Reading, Saving and Deleting Mail

To start reading your new mail, hit a <CR> at the MAIL> prompt.

To see a listing of your new mail, type

MAIL> directory

which works on mail files like the VMS directory command works on filenames. You should see your message to yourself here.

Mail files in your current "folder" will be listed by number so you can easily refer to them (for example, 2 reads message #2).

Like the VMS file directory structure, VMS Mail has a structure based on mail "folders". You can move mail between folders, create new ones or delete old ones just as you would manipulate directories. The analogous commands are pretty obvious, and we will use some below.

By default you get the folders mail, newmail and wastebasket. Also by default all Mail commands without a message number act on the message you just read (so if you just type delete after reading a message, that message is deleted). Try this on the message you just sent to yourself.

Your mail messages are automatically saved unless you specifically delete them. In practice, after you read your messages in NEWMAIL and exit that folder they are stored in mail.

Deleted messages are actually stored in wastebasket/ until you exit mail so you can retrieve them if you accidentally deleted them (retrieving them after exiting mail is much harder). To get them back, just move them out of wastebasket. Try this out on the message you just deleted

   MAIL> set folder wastebasket
   %MAIL-I-SELECTED, 1 message selected
   MAIL> dir

This should give you a listing of the old mail message. To recover it, type:

MAIL> 1 (or read 1) MAIL> move mail

This shows a strange thing about the Mail command. You must read a message before you can move it.

How to make a hardcopy

Occasionally you will receive a piece of e-mail that is so stunningly brilliant (or hopelessly strange) that you simply must print it out to save it for ever. Here we will take as an example that message that you just sent to yourself and then deleted and then recovered from the wastebasket. You should now have the tools to get there and find it. Then:
   MAIL> extract/noheader
   _File: yow.txt
   %MAIL-I-CREATED, yourdisk:[yourdirectory]YOW.TXT;1 created

You now have a plain text file called YOW.TXT which you can print out on any text printer. The /noheader qualifier gets rid of most of the mail-routing information at the top of mail messages that you usually do not want.

Getting Rid of All the Junk in the Mailbox

If you do not automatically delete your messages after reading them you will soon find that you have acquired a mountain of old mail messages that are clogging up your mailbox and using up all of your disk space. You can go back and delete them, but even then your VMS mail file (usually called MAIL.MAI) can still be taking up valuable disk space, and you can not delete it.

To get around this problem VMS Mail provides the compress command. Issue it from the MAIL> prompt, and it will make a new, smaller MAIL.MAI file as well as a big MAIL.OLD file. You can then delete the MAIL.OLD file.

Mailing Lists

Occasionally you may want to broadcast a message to many people in the collaboration. To send mail to a subset of the collaboration (more than 3 people or so), the easiest way is to use a "mailing list."

A mailing list is just a list of e-mail addresses. You can use an editor to put all the addresses you want in a file. For example, the file could be:


In our example, we store the file with the name list.dis. Then to send the same message to all these people you would type:

   MAIL> send 
   To: @LIST

The mailer will substitute the mailing list names for @LIST. You can give the file an extension other than .dis, but then you need to specify it explicitly, such as @LIST.BIG.


You have now covered the basics of VMS file handling. The actual complete set of documentation for VMS version 6 fills about five feet of shelf space, but you now know much of what you will need to use VMS for SLD offline data analysis.

The next sections of the Workbook now go on to tell you more about running SLD code in particular.

Back to Workbook Front Page

Glen Crawford
8 January 1995