.sh 1 "PROGRAM STRUCTURE " 2

.sh 2 "Block Diagram of Program Structure "
.pp
Figure 2.1-1 shows the basic user control structure and the
commands used by the user to access each section.

.sh 2 "File Structure "
.pp
The file structure of SPECPR is the most complicated portion of
the program.  As far as the user is concerned, there are 6 "Devices"
each labeled by a single letter (called "file ID letters").  These
are:

.(l I
V= saVefile (Vfile)
W= raWfile (Wfile)
D= workfile (formerly Diskfile at MIT) (Dfile)
S= Starpack file
U= Ufile (sometimes referred to as savefile compliment)
Y= Yfile (sometimes referred to as rawfile compliment)
.)l
.pp
Normally the user assigns, via the file assignment routine
(section 5), the "devices" V, W, D, and S to disc files.
However, processed data is stored on magnetic tape and thus needs to be
transferred to the disc.  This is the reason for "devices" U and
Y.  Device U is usually used to transfer data on MT0 to V on the
disc.  Device Y is used to transfer data on MT1 to W on the
disc.  Originally, devices U and Y were intended to be used only
for transfer and display and were not used in any math operation.
This is why they were referred to as compliment files.  However, due to
increased needs, they have been made full working files.  Due to
limited disc space for many users (each user currently gets about
10 megabytes), all U, V, W, Y, and D cannot be assigned to disc
files at the same time.  There are 3 available disc files with
which D and two others can be assigned.  The file ID letters (U,
V, and W, Y) are paired such that, when V is assigned to disc, U
can only be assigned to tape drive 0.  When U is assigned to disc,
V can only be assigned MT0.  Similarly for W, Y and MT1.  Each of
the 5 main data files (V, W, D, U, and Y) may contain up to 2000
spectra (with their associated header information).  The starpack
file contains 50 extinction correction "starpacks" on disc.
Table 2.1-1 shows the assignment conditions between V, W, and
U, Y.  Normally W and V are assigned to the disc since processing
is faster and the tape drives are free to other people on the
TI 980 B timesharing system to use.
.pp
Errors (1 sigma standard deviations) are stored in the next file
after the data when generated.  This saves room since many files
do not contain error values.
.pp
Each I/O operation is analyzed for errors by the program.  If an
I/O error occurs, the error encountered is listed on the CRT so
the user can try and figure out what happened.
.pp
The user accesses a spectrum by typing in the File ID letter and
the record number in the file (this is technically erroneously
called a file number not record number by the program messages).
.pp
In addition, transfers between all combinations of V, W, D, U, Y,
and S are allowed if the user selected file protection permits
such transfers (see File Protection, section 2.3).

.ul
Transfer Restrictions
.pp
If the names of the data files are equal, two special restrictions
are applied.  For instance, if the name of "Vfile" is the same as
the name of the "Ufile" (e.g. a data tape is on MT0 as "Ufile"
and is to be transferred to the "Vfile" on disc), the restriction
applies to tape to disc, disc to tape, disc to disc, and tape to
tape transfers.  These restrictions are enforced in an effort to
preserve the histories which refer to a specific spectrum by data
tape name and record number (called file number).
.pp
.ul
Transfers to tape
including disc to tape and tape to tape
transfers or disc to disc transfers must be to corresponding
record numbers but do not have to begin with record 1 (if the data
file names are equal).
.pp
.ul
Transfers to disc,
including tape to disc transfers, must begin
with record number 1 (if the data file names are equal).

.ul
Default volume
.pp
The default volume for the major disc files is 2.  Be sure to
online disc T81 before assigning files from SPECPR.  The files on
disc volume 2 allow a full 2000 spectra each.  The files on disc
1 may still be used, if needed, by typing "D1" when assigning to
disc.


.sh 2 "File Protection "
.pp
All files may be totally or partially protected, or completely
unprotected.  The fourth line of the CRT header gives the
protection status for all six devices (devices V, W, D, U, V, and
S).  If the protection number is positive or zero, the device is
a read/write device where you can read up to and including the
protection, but you can only write to the protection +1 file.  A
protection number of -1 means totally unprotected so you may read
or write anywhere in the file randomly.  A protection number of
less than -1 means the device is a read-only device where you can
read up to the absolute value of the line in the initialization
routine as the file ID and protection number.  Example:
V0 D-1 U432 Y-600 W-600 S-50", where V0 means to protect 0 files
on device V (write to file 1 only, 0 files can be read); U432
means to protect files up to 432 files (write to file 433); Y-600
means that Y is a read-only device with 600 files; similarly for
W; and S is a read-only device with 50 files.  If the protection
number is zero or positive, it is incremented each time the
device is written to.  One or more device protection numbers may
be changed on the same line.

.ce
.ul
Use of SPECPR File Protection
.pp
The SPECPR file protection is designed to protect the user from
destroying existing data and to allow use of the program with
minimal thinking of where data is going (so the user can be
thinking about the science).  Protection should be used at all
times unless there is some necessary reason for not using it.
Remember that a mistake is what will destroy data in an
unprotected file--and everyone makes mistakes.
.pp
The following is an example of the use of protection:
.pp
Start SPECPR.  Say you have 2 tapes to be transferred to disc and
then do some processing.  Load the tapes (we will call them A01 and
B01):  A01 on MT0, and B01 on MT1.  Plan to assign U to MT0, Y to
MT1, V and W to Disc.  Set the protection on V and W to 0 (this
is the default).  Type in the names of the devices = U and V =
A01; Y and W = B01.  Assign the devices as noted above.  Now here
is where the protection comes in.  First, let us transfer the tape
on MT0 (A01 = U).  The protection is -2000.  Say on the label on
the tape, there are 673 files--do not believe this.  We could have
set the protection to -673, but what if the last time you added
stuff to the tape you forgot to update the number or someone
else added stuff and did not update it?  If that happened and you
then added stuff after file 673 and wrote it back to the tape,
someone might get very mad.  So--let the computer find the end
of the data.  Go to file transfer and type "U1 + 1999TV1".  All
the files up to the end of file mark will be transferred.  Say
there were realy 729 files on the tape.  Then, after the
transfer, the protection on V would be 729 and -2000 on U.  Now
transfer MT1 to the disc:  "Y1 + 1999TW1".  Say there are 463
files on MT1.  The protection after the transfer would be 463 on
W and -2000 on Y.  Now go back to change protection routine and
make the protection on U-729 and on Y-463.  All your data is
fully protected.
.pp
Now say you did some processing and added 47 files to V and 21 to
W.  You must then transfer the stuff back to the tapes.  Take the
tape off MT0 and put in a write ring (if you had a write ring in
before, you are asking for trouble).  Go to the change protection
routine and change the protection U from -729 to 729.  If the tape
was not at the load point when you put in the write ring, you
must reset the file pointer in the program.  This can be done in
one of several ways:  (1) change the tape name (change the name of
U from A01 to A01; when the name is changed, the tape is rewound);
(2) display file U1; or (3) transfer U1 to somewhere else (this is
faster than a display).  If D is assigned to disc and it is used
as a workfile (protection = -1), transfer "U1TD1" or "U1TD1000"
or even if D is assigned to Dummy.  If D is assigned to dummy, it
will read U1 before you get the illegal trasfer, device assigned
to dummy message.
.pp
Now that the tape file pointer is reset, you transfer your stuff
from V to U.  Type "V730 + 999TU730".  Note 730 is one more than
the current protection.  The transfer will continue up to the
protection limit on V (776), which after transferring V776 to
U776 the message "FILE REQUEST GREATER THAN FILE PROTECTION"
will come on--press return.  Now go to the "write-end-
of-file" routine.  Type U but no file number.  The program will
say "writing end of file after U776", which is correct.  Type Y
(for Yes) to write the end of file.
.pp
It is now a good idea to list the tape from just before the point
at which data was added to the end of file to make sure the tape
does not have any obvious errors.
.pp
Now you must transfer the stuff on W to the tape.  Reassign MT1
to dummy (since the program treats MT1 as a read-only device at
pesent).  Then take the tape A01 off MT0 and put the tape B01
(from MT1) and put it on MT0 (and put in a write ring).  Change
the protection on U to 463; then change the name of U to B01 (this
puts in the correct name and resets the file pointer).  Now go to
file transfer and type "W464 + 99TU464".  The program will stop at
the protection limit on W of 484, transferring the added 21
files.  Now go to the "write-end-of-file" routine, and type U.
The program says it is writing the end of file after U484, which
is correct; so type Y (for Yes, do the write).  Now list the type
as before to check the newly added files.
.pp
Following this method will maximize the safety of your data.  Failure
to do so will cause no sympathy from the person whose data
you accidently destroy (and you must recreate it for him or her).
