gtpc2m7c | C/C++ Language Support User's Guide |
This function reads a record from a general tape.
Format
#include <tpftape.h>
void *tape_read(const char *name, enum t_lvl level,
enum t_blktype size);
- name
- This argument is a pointer to type char, which must be a
three-character string identifying the tape to be read from. This
function can only be called for a general tape.
- level
- One of 16 possible values representing a valid data level from the
enumeration type t_lvl, expressed as Dx, where x represents the
hexadecimal number of the level (0-F). This argument identifies the
CBRW on which the working storage block containing the tape record image will
be placed.
- size
- One of 4 possible values (L0, L1, L2, L4) from the enumeration type
t_blktype, representing the working storage block size of the
record on tape:
- L0
- 127 bytes
- L1
- 381 bytes
- L2
- 1055 bytes
- L4
- 4095 bytes.
Normal Return
Pointer to the working storage block containing the tape record
image.
Error Return
NULL.
Programming Considerations
- The specified tape must have been opened using tape_open, and
must NOT be currently assigned to the issuing ECB. On completion of
this function, the tape is left in the reserved state, meaning it
is available for use by any ECB.
- This function calls the equivalent of waitc. As a
result, all pending I/O occurs before control is returned to the calling
program.
- The CBRW level specified must be unoccupied when the function is
called.
- On return from the function, the specified tape has been placed in the
reserved state for use by other ECBs.
- If the tape is mounted in blocked mode, the application should not assume
that the execution of this function causes either any physical I/O to be
initiated or the application timeout value to be reset.
Examples
The following example opens, reads a record from, and closes a VPH tape
mounted for input.
#include <tpftape.h>
struct vp0vp *vp;
·
·
·
tape_open("VPH",INPUT);
if((vp = (struct vp0vp *) tape_read("VPH",D6,L2)) == NULL)
exit(0x56789); /* Dump & exit if read failed */
tape_close("VPH"); /* Close it. */
Related Information