1TOPEN(3F) TOPEN(3F)
2
3
4
6 topen, tclose, tread, twrite, trewin, tskipf, tstate - f77 tape I/O
7
9 integer function topen (tlu, devnam, label)
10 integer tlu
11 character*(*) devnam
12 logical label
13
14 integer function tclose (tlu)
15 integer tlu
16
17 integer function tread (tlu, buffer)
18 integer tlu
19 character*(*) buffer
20
21 integer function twrite (tlu, buffer)
22 integer tlu
23 character*(*) buffer
24
25 integer function trewin (tlu)
26 integer tlu
27
28 integer function tskipf (tlu, nfiles, nrecs)
29 integer tlu, nfiles, nrecs
30
31 integer function tstate (tlu, fileno, recno, errf, eoff, eotf, tcsr)
32 integer tlu, fileno, recno, tcsr
33 logical errf, eoff, eotf
34
36 These functions provide a simple interface between f77 and magnetic
37 tape devices. A ``tape logical unit'', tlu, is ``topen''ed in much the
38 same way as a normal f77 logical unit is ``open''ed. All other opera‐
39 tions are performed via the tlu. The tlu has no relationship at all to
40 any normal f77 logical unit.
41
42 Topen associates a device name with a tlu. Tlu must be in the range 0
43 to 3. The logical argument label should indicate whether the tape
44 includes a tape label. This is used by trewin below. Topen does not
45 move the tape. The normal returned value is 0. If the value of the
46 function is negative, an error has occured. See perror(3F) for
47 details.
48
49 Tclose closes the tape device channel and removes its association with
50 tlu. The normal returned value is 0. A negative value indicates an
51 error.
52
53 Tread reads the next physical record from tape to buffer. Buffer must
54 be of type character. The size of buffer should be large enough to
55 hold the largest physical record to be read. The actual number of
56 bytes read will be returned as the value of the function. If the value
57 is 0, the end-of-file has been detected. A negative value indicates an
58 error.
59
60 Twrite writes a physical record to tape from buffer. The physical
61 record length will be the size of buffer. Buffer must be of type char‐
62 acter. The number of bytes written will be returned. A value of 0 or
63 negative indicates an error.
64
65 Trewin rewinds the tape associated with tlu to the beginning of the
66 first data file. If the tape is a labelled tape (see topen above) then
67 the label is skipped over after rewinding. The normal returned value
68 is 0. A negative value indicates an error.
69
70 Tskipf allows the user to skip over files and/or records. First,
71 nfiles end-of-file marks are skipped. If the current file is at EOF,
72 this counts as 1 file to skip. (Note: This is the way to reset the EOF
73 status for a tlu.) Next, nrecs physical records are skipped over. The
74 normal returned value is 0. A negative value indicates an error.
75
76 Finally, tstate allows the user to determine the logical state of the
77 tape I/O channel and to see the tape drive control status register.
78 The values of fileno and recno will be returned and indicate the cur‐
79 rent file and record number. The logical values errf, eoff, and eotf
80 indicate an error has occurred, the current file is at EOF, or the tape
81 has reached logical end-of-tape. End-of-tape (EOT) is indicated by an
82 empty file, often referred to as a double EOF mark. It is not allowed
83 to read past EOT although it is allowed to write. The value of tcsr
84 will reflect the tape drive control status register. See ht(4) for
85 details.
86
88 /usr/lib/libU77.a
89
91 ht(4), perror(3F), rewind(1)
92
93
94
954.2 Berkeley Distribution May 15, 1985 TOPEN(3F)