Search                        Top                                  Index
TEACH FILES                                       Aaron Sloman July 1988

Files are used to store text, programs, images and other information  on
a computer. This teach file gives a brief introduction to files and what
you can do with them.

         CONTENTS - (Use <ENTER> g to access required sections)

 -- Different kinds of computer memory
 -- Files on magnetic disks
 -- Operating systems manage file stores
 -- File name formats
 -- Ownership of files
 -- File versions
 -- File Type
 -- Operating system commands concerned with files
 -- Giving DCL or SHELL commands from inside Pop-11 or VED
 -- Files available when you start
 -- Additional reading

-- Different kinds of computer memory ---------------------------------

The computer has two main forms of memory that we could characterize  as
the short term memory and the long term memory. The short term memory is
used for running programs and its contents change rapidly from moment to
moment under the control  of the computer itself.  The long term  memory
usually remains unchanged unless users request specific changes.

On most computers  the short term  memory is manufactured  out of  solid
state electronics and the  long term memory  uses magnetic disks.  There
may also be  very long term  memory on magnetic  tapes, copied from  the
disks for "backup" purposes.  The electronic memory  is very fast,  disk
memory relatively slow, and tapes even slower.

                    --------------
     --------      |   computer   |      --------       -----
    |USER's  |--<--|VED|short term|--<--|magnetic|-->--|tapes|
    |terminal|-->--|   | memory   |-->--| disks  |--<--|     |
     --------       --------------       --------       -----

If you are using a  machine that is managed  by a computing service  you
will not have to think  about tapes - they  are handled by the  operator
who regularly makes copies from the disks to the tapes. This means  that
if files  are accidentally  lost  on the  disks  they can  sometimes  be
retrieved from tapes by the operator.


-- Files on magnetic disks --------------------------------------------

Information in  the long  term memory  is organized  into 'files'  which
usually contain 'text', e.g. programs, teaching files, etc. They can
also contain other things that may not be readable by people, e.g. image
data and compiled programs.

Various things can be done to files. A file can be displayed for reading
on the screen of a terminal (perhaps with the help of a TEACH file);  it
can be read and "obeyed" by a programming system like POP-11 or Lisp, or
Prolog (in which case the file  should contain instructions), it can  be
printed on paper, or it  can be used to prepare  a new version using  an
editor (like VED the POPLOG editor  which you are probably using now  to
read this "teach" file).

A very common activity is to edit  a file, either in order to create  an
entirely new file, or to extend or modify an existing file stored on the
disk. When a file is altered using  the editor there comes a point  when
you "write" or "save" it.  At that point it  gets copied from the  short
term to the long term memory on  the disk, replacing the old version  if
there was one. (On  some systems the  old version is  saved in case  you
have made a dreadful mistake and want to get its contents back.)


-- Operating systems manage file stores -------------------------------

The management  of  files  and  the  sharing  of  the  computer  between
different users is  the task of  an "operating system".  POPLOG and  its
editor VED  can  be used  on  a  variety of  computers,  with  different
OPERATING SYSTEMS.

Operating systems have many functions - looking after files, controlling
how programs or users communicate  with other local or remote  computers
(the electronic mail system) and how we run different devices (printers,
robots, cameras, etc.).

Different operating systems may differ  in HOW they perform these  jobs.
The two main operating systems that  POPLOG runs on are versions of  VMS
and UNIX.
 (Note: VMS is a trade mark of Digital Equipment Corporation, and UNIX
 is a trade mark of ATT).

We communicate with the  VMS operating system in  a language called  DCL
which gives  the '$'  prompt and  with the  UNIX operating  system  in a
language called SHELL which gives  the '%' prompt. For more  information
about these languages see the  operating system user guides. The  Poplog
User Guide and the VED User Guide also give some information.

If you are a Poplog  user, most of the time  you can avoid using  either
DCL or the Shell, since Poplog provides many of the facilities you  will
need.


-- File name formats --------------------------------------------------

The computer's  disk  contains  your  'files'  and  other's  files.  The
organisation of these files is  determined by the operating system.  How
they are grouped into  different collections and  what their names  look
like will vary from one operating system to another, though most systems
group files together into directories.  A directory can contain  several
files, including directories that contain more files, etc.

In principle, in  order to  specify a file,  you may  have to  specify a
whole range of things, e.g.
    - which machine it is on (the "host"),
    - which disk it is on,
    - which directory it is in,
and finally
    - the name of the file.

However, it is normally possible to  avoid all except the file name,  by
working within a directory, known as the "current working directory"  or
the "default  directory".  Then  if  you  simply  name  a  file  without
specifying a directory  the computer  will assume you  mean the  current
directory.

Here are examples of file names showing directory and file names

    [POP.TEACH]FILES;23     (VMS)

    /pop/teach/files        (UNIX)

The directory part is  "[POP.TEACH]" in VMS  and "/pop/teach/" in  Unix.
Poplog allows you to use  the Unix format whether  you are using VMS  or
not. OWNER, a  NAME, possibly a  TYPE, and a  VERSION number or  marker.

In the VMS version the ";23" bit means this is version 23 of the file.

-- Ownership of files -------------------------------------------------

Files have  'owners'.  The file  you  are currently  reading  is  called
'files' and  is  owned  by  the  system  administrator  responsible  for
managing the Poplog system. - this means that you can read it and change
its appearance on the screen, but you can not make any permanent changes
to it. You can, of course, make changes to files which you own.

The owner of  a file can  specify its "protection",  i.e. whether  other
users can read  or alter it.  For details consult  user guides for  your
operating system.


-- File versions ------------------------------------------------------

The file in  the above  example is  called 'files'  and it  is the  23rd
version 'files'. In VMS the version is  marked by a number.

In UNIX the version  of the file,  if produced by  Poplog, is marked  by
dashes, the more dashes the older the version of the file e.g.

    /usr/fred/files      is a more recent version than
    /usr/fred/files-     is a more recent version than
    /usr/fred/files--

Unix Poplog will normally produce only two versions of a file, the  most
recent and  the previous  version. However,  you can  use the  variables
pop_file_versions and  vedversions  to  control  the  number  of  backup
versions saved.

If you keep all old versions, you'll run out of disk space so later  you
will have to learn how to delete old files.

If you give a file name to VMS without specifying the version it assumes
you mean the latest version.

If you want an  older version then you  must specify the version  number
(in VMS) or add the correct number of dashes to the name (in UNIX).


-- File Type ----------------------------------------------------------

Files can also have a  'type'. E.g. if you create  and edit a file  file
called TEST, with type  P, the 13th version,  after several edits  would
then have the name

    TEST.P;13

on VMS, whereas on Unix the name would simply be

    test.p

The file type can help to remind  you (or a program) what sort of  thing
the file  contains.  E.g. '.p'  files  should contain  POP-11  programs,
'.txt' files might contain essays etc.

Poplog uses the following conventions for file types

    Type        Programming language used in file

    .p          POP-11
    .pl         PROLOG
    .lsp        COMMON LISP
    .ml         Standard ML

There are other conventions used by operating systems, e.g. to indicate
"object" files, "runnable" files, command files, etc.

The type of a program file is used by Poplog to decide which compiler to
associate with it and to indicate to the editor how to behave.


-- Operating system commands concerned with files ---------------------

One of the most frequently used commands concerned with files is the
command to print out information about files in your current directory.

On VMS the command is
    $ DIRECTORY

which can be abbreviated to "DIR".

On Unix the command is

    % ls

Both files have a variety of more elaborate formats described in online
documentation that comes with the operating system. To read the online
help file, do:

on VMS      $ HELP DIRECTORY

on UNIX     % man ls

There are many more commands for copying files, printing them, re-naming
them, moving them to another directory, joining them together, deleting
them, altering their protection, etc. etc. A subset of such commands is
described in Poplog help files:

on VMS      HELP * DCL
on UNIX     HELP * SHELL


-- Giving DCL or SHELL commands from inside Pop-11 or VED -------------

POP-11 and the VED editor have been modified to understand DCL and SHELL
commands provided that you type in the dollar or percent yourself.

In order to get a directory listing, you can do the following in VED:

on VMS

    <ENTER> $ dir <RETURN>

on UNIX

    <ENTER> % ls  <RETURN>

This means that the contents of your directory will be printed out. Then
VED will tell you to  press RETURN to get back  to VED. Try that.  Other
operating system commands can be given  on the command line in the  same
way.


-- Files available when you start -------------------------------------

If you are using  a VMS operating  system then, at  this stage, you  may
find that you only have one file:

    LOGIN.COM;1

The name of the file  is LOGIN, of type COM,  and it is version 1.  That
file has commands which are obeyed when you log in. Without it,  various
things would not work for you, so  when you later learn to delete  files
you no longer need, don't delete this one!

If you  are using  UNIX then  it may  appear that  you have  no  files -
actually you do have a "login" file which performs a similar job to  the
VMS version. However your file's name is called ".login", or, on some
Unix systems ".profile". The "." makes a file invisible to a simple
"%ls" command. You may also have other "invisible" files on a unix
system, e.g.
    .cshrc  .plan   .mailrc   .rootmenu

Additional files available when you start may be

    vedinit.p   - setting up the editor VED
    init.p      - setting up Pop-11 to suit your use
    init.pl     - initialising Poplog Prolog
    init.lsp    - initialising Poplog Common Lisp

For more information on initialisation, see HELP * INITIAL

When you have finished reading  this file, press the  ESC key then Q  to
Quit and return to whatever you were doing before.


-- Additional reading -------------------------------------------------

To read one of these files, type <ESC> n to get to the "next"  asterisk,
then <ESC> h  to get the  relevant file.  You can quit  each file  after
reading it by typing <ESC> q.

HELP  *SHELL         - a summary of SHELL commands (if you have a
                       UNIX operating system)

HELP  *DCL           - a summary of DCL commands (if you have a
                       VMS operating system)

TEACH *TEACHFILES    - an overview of TEACH files

HELP  *HELPFILES     - an overview of HELP files

HELP  *DOCUMENTATION - overview of means of accessing documentation

DOC  *SYSSPEC        - an overview of the files supplied with the
                       Poplog system.

--- C.all/teach/files --------------------------------------------------
--- Copyright University of Sussex 1988. All rights reserved. ----------