





SPECPR Users' Manual                                            Page 8-f20.1


_F_2_0:  _T_e_x_t _F_i_l_e _I_n_p_u_t _a_n_d _O_u_t_p_u_t                                 _A_l_i_a_s: _r_e_a_d

     Special Function 20 has two parts to it.  The  first  part  reads  data
from  a  text file (for example, one that was generated by any program or by
using the system editor).  The second part writes data from  a  specpr  file
into a text file.

     With both parts there are options to include errors or  wavelengths  or
both.   Data, errors, and wavelengths may be written either in standard For-
tran format 'f15.6' or in exponential '1pe15.6'  format,  depending  on  the
user's  option.   The  program  works  with one set of numbers per line i.e.
wavelength, data and errors.  Without the wavelength option,  the  order  is
data, errors, and without the error option the order is wavelength, data

     When writing the data to a specpr record (i.e v123), the  program  will
put the error values in the next consecutive specpr file (i.e v124).

_U_s_i_n_g _F_u_n_c_t_i_o_n _2_0

     To run function 20, type

              _f_2_0

from math operations.  The routine will prompt you for what part (reading or
writing) you want to do.  Type

              r   for reading data,
              re  for reading data and errors,
              w   for writing
              we  for writing data and errors.

If you are writing to a text file, you are given an option for format.  Type

              f    for f format (Fortran format F15.6), or
              e    for exponential format (Fortran 1pe15.6).

Next if you are writing, you are asked if wavelengths are  to  be  included.
Type

              y          for yes to include wavelengths, and
              <return>   or any other character for no.

Then you are instructed to enter the filename of the text to which you  will
read or write data.  Currently, the file name must be 40 characters or less.

     Be sure that when you are reading, the file is in  your  directory,  or
you must give the full file name (i.e /u/smith/dataf).

     When reading, f20 will prompt you for the starting column number  where
the  data begins (e.g. col. 1 - 80).  Default is column one(1).  Columns are
character columns, not columns of numbers.  The routine does not count  tabs





properly, and if a tab or control character is encountered, it is treated as
an error and the read is terminated.

     After reading the data, you can exit normally to  plot  and  write  the
data, or elect to read the data again (type r to redo).

     If you are writing data to a text file you will be asked  the  file  id
and  record number of the specpr file that the data are from (v, w, d, u, or
y).  When the operation is finished you have the option to redo  the  opera-
tion  or  exit.   Type   r to redo the operation  at this point or e or x to
exit.  You can thus write many text files without leaving f20.


_S_e_t_t_i_n_g _U_p _t_h_e _T_e_x_t _F_i_l_e

     There are two ways of setting up a UNIX text file that can be  read  by
f20.

     First, and the easiest, is directed output.  Output  the  data  to  the
terminal and direct it to a file.  In your program write to the terminal:

                  write(6,10)data
           10     format(1x,1pe15.6)

or with errors

                  write(6,10)data,error
           10     format(1x,1pe15.6,1pe15.6)

and run the program using this method

          progname > filename

where progname is the program executable file and filename is the file to be
read by f20.

     Second, you can write your data directly into a file.   You  must  open
the  file  and  write  to it.  See your local Fortran manual on how to write
ascii files.

     When reading, enter f20 from math operations and when prompted for your
input/output filename, type in the filename of that you assigned to the text
file in the above examples.  The program will print out the  channel  number
and  the data value of that channel.  The last channel number printed is the
number of channels in the file (or the number of data values read by f20).

_A_n _f_2_0 _E_x_a_m_p_l_e (_s_q_u_a_r_e _t_h_e _d_a_t_a _a_n_d _a_d_d _1._0)

1) Operate on data using your own programs:

2) Put these values in v34 (with, for example the editor f14):

        channel 1: 0.99
                2: 0.90





                3: 0.70
                4: 0.40

3) Write v34 to file 'testa' using f20 and e format

4) Run program 'testprog <testa >testb'

5) Read testb into specpr using f20

6) List the 4 channels

Fortran program "testprog":

                            program testprog
                            real x,y
                            do 100 i = 1, 4852
                                read (5,1) x
                    1           format (1pe15.6)
                    c do a computation:
                                y = x*x +1.0
                                write (6,1) y
                    100     continue
                            end


































