#include "worgen.h" #include "tapeio.h" #include "vll.h"
FUNCTION c_tplsrd (unit, key, clen, dlen, cbuf, dbuf, dtype)
long *unit; char *key; long *clen; long *dlen; char *cbuf; unsigned char *dbuf; char *dtype;
Unit number of an opened tape. The unit number is set by c_tpopen() and should not be altered.
Key of the record to be read. Spaces may be embedded in the key; however, right-justified spaces are ignored. If the key is NULL or a blank, the current record within the file is read. If a value is specified for the key, the first record found with the same key is read. The key value of the record read is returned in this parameter.
The number of bytes in the character portion of the record. On input, clen should be set to the length of cbuf. The actual number of bytes in the character portion of the reord plus one for the null character is returned in this parameter.
The number of bytes in the data portion of the record. On input, dlen should be set to the length of dbuf. The actual number of bytes in the data portion of the reord is returned in this parameter.
Character buffer into which the character portion of the record is read.
Data buffer into which the data portion of the record is read.
Data type of the data portion of the record. Valid data types are:
= B: unsigned byte data = I2: signed two byte data = I4: signed four byte data = R4: four byte floating point data = R8: eight byte floating point data
The c_tplsrd() call is used to read one label services record from a file on tape. The label services function c_lswrit() is used to write a label services record to a file.
The c_tplsrd() function requires the tape to be opened with read access.
A key value of "DELETED" is invalid.
A return value of TAPE_SMAL (39) implies the data and/or character buffers are too small to read the data into. The tape is returned to the beginning of the record, and the actual buffer lengths are returned in parameters clen and dlen. The calling program may reallocate larger buffers and call c_tplsrd() again to read the specified record.
c_tplsrd() returns
TAPE_SUCC (0) --> Successful completion TAPE_FAIL (-1) --> Operation failed TAPE_EOV (-2) --> End of volume detected TAPE_EOT (-3) --> End of tape encountered TAPE_SMAL (-39) --> Operation failed, buffers too small TAPE_EOF (-99) --> End of file detected