#include "tapeio.h"
FUNCTION c_tpansi (unit, mode, dens, inout, message, tapeid)
long *unit; /* (I/O) pointer to tape descriptor */ long *mode; /* (I) error mode */ char *dens; /* (I) tape density */ long *inout; /* (I) tape access (TWRITE,TUPDATE,TREAD) */ char *message; /* (I/O) message to the operator */ char *tapeid; /* (I/O) tape ID */
Unit number pointing to the tape descriptor (returned by tpopen or tpreopen). If the wrong tape is mounted, tpansi dismounts the current tape and re-issues a tape mount.
A value of HANDLE (1) specifies that when an error occurs the routine is to return an error to the calling program and display a message to the terminal.
Tape density. The dens parameter is only used if the wrong tape is mounted, in which case a re-mount is issued.
A value of TREAD (0) for reading. TWRITE (1) for writing. TUPDATE (2) for update.
Mount message. The message parameter is only used if the wrong tape is mounted, in which case a re-mount is issued.
The tapeid returned by tpopen.
The c_tpansi() call is used to process the ANSI label file. The algorithm depends on the value of inout.
If inout=TWRITE, a new ANSI label file is written to tape. The ANSI label file consists of a single 80 byte record defining the tape ID and user name as the owner of the tape. If the tape ID is "CCT" (a canister tape), no label file is written.
If inout=TREAD, c_tpansi will determine if the ANSI label file exists. If the ANSI label file does not exist, the tape is rewound to BOT and TAPE_SUCC is returned. If the ANSI label exists, the Tape ID and user name are verified and the tape is positioned at the start of the first data file (ie. logical BOT). If the Tape ID does not match, the current tape is dismounted, a new mount request is generated, and the ANSI label is reverified. After three retries, a TAPE_FAIL status is returned. If the user name does not match, a nonfatal error message is printed and TAPE_SUCC is returned.
If inout=TUPDATE, c_tpansi verifies the ANSI Label as if the mode were TREAD. If the ANSI label file does not exist, the returned status code is TAPE_FAIL and the tape is positioned at BOT. If the ANSI label files exists, the returned status code is TAPE_SUCC and the tape is positioned at EOD.
c_tpansi() returns
TAPE_SUCC (0) --> successful completion TAPE_FAIL --> error encountered