Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mt(7)

perror(3F)

rewind(1)

TOPEN(3F)

+U77 FORTRAN compile-line option required

NAME

topen, tclose, tread, twrite, trewin, tskipf, tstate − f77 tape I/O

SYNOPSIS

INTEGER*4 function topen (tlu, devnam, label)
INTEGER*4 tlu
character*(*) devnam
LOGICAL*4 label INTEGER*4 function tclose (tlu)
INTEGER*4 tlu INTEGER*4 function tread (tlu, buffer)
INTEGER*4 tlu
character*(*) buffer INTEGER*4 function twrite (tlu, buffer)
INTEGER*4 tlu
character*(*) buffer INTEGER*4 function trewin (tlu)
INTEGER*4 tlu INTEGER*4 function tskipf (tlu, nfiles, nrecs)
INTEGER*4 tlu, nfiles, nrecs INTEGER*4 function tstate (tlu, fileno, recno, errf, eoff, eotf, tcsr)
INTEGER*4 tlu, fileno, recno, tcsr
LOGICAL*4 errf, eoff, eotf

DESCRIPTION

These functions provide a simple interface between f77 and magnetic tape devices.  A “tape logical unit”, tlu, is “topen”ed in much the same way as a normal f77 logical unit is “open”ed. All other operations are performed via the tlu. The tlu has no relationship at all to any normal f77 logical unit. 

Topen associates a device name with a tlu. Tlu must be in the range 0 to 3.  The logical argument label should indicate whether the tape includes a tape label.  This is used by trewin below.  Topen does not move the tape.  The normal returned value is 0.  If the value of the function is negative, an error has occured.  See perror(3F) for details.

Tclose closes the tape device channel and removes its association with tlu. The normal returned value is 0. A negative value indicates an error.

Tread reads the next physical record from tape to buffer. Buffer must be of type character.  The size of buffer should be large enough to hold the largest physical record to be read.  The actual number of bytes read will be returned as the value of the function.  If the value is 0, the end-of-file has been detected.  A negative value indicates an error. 

Twrite writes a physical record to tape from buffer. The physical record length will be the size of buffer. Buffer must be of type character.  The number of bytes written will be returned.  A value of 0 or negative indicates an error. 

Trewin rewinds the tape associated with tlu to the beginning of the first data file.  If the tape is a labelled tape (see topen above) then the label is skipped over after rewinding.  The normal returned value is 0.  A negative value indicates an error. 

Tskipf allows the user to skip over files and/or records.  First, nfiles end-of-file marks are skipped. If the current file is at EOF, this counts as 1 file to skip.  (Note: This is the way to reset the EOF status for a tlu.) Next, nrecs physical records are skipped over.  The normal returned value is 0.  A negative value indicates an error. 

Finally, tstate allows the user to determine the logical state of the tape I/O channel and to see the tape drive control status register.  The values of fileno and recno will be returned and indicate the current file and record number.  The logical values errf, eoff, and eotf indicate an error has occurred, the current file is at EOF, or the tape has reached logical end-of-tape.  End-of-tape (EOT) is indicated by an empty file, often referred to as a double EOF mark.  It is not allowed to read past EOT although it is allowed to write.  The value returned in tcsr (tape control status register) will be the device-independent status word, mt_gstat as described in mt(7).

FILES

/usr/lib/libU77.a

SEE ALSO

mt(7), perror(3F), rewind(1)

NOTES

The actual errf, eoff, and eotf value returned by tstate for .true.  is 1.  For this to be interpretted as .true.  by the compiler, the LOGICAL TRUE value for the program unit must be 1, which is the default.  This value can be changed with the $LOGICAL TRUE directive, as well as with other directives and compile-line options. 

Hewlett-Packard Company  —  HP-UX Release 9.0: June 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026