gtpc2m78 | C/C++ Language Support User's Guide |
This function is used to permit an entry control block (ECB) to gain
control of a tape without first checking to see if the tape is already
open. It also allows the ECB to specify a timeout value if the tape is
not immediately available.
Format
#include <tpftape.h>
long tape_access (const char *name,
int io,
int buffmode,
char *message,
int timeout);
- name
- A pointer to type char, which must be a 3-character string
identifying the tape that will be opened. This function can only be
called for a general tape.
- io
- Code one of the following two terms as defined in the
tpftape.h header file.
- INPUT
- To read the tape.
- OUTPUT
- To write to the tape.
- buffmode
- Indicates if the buffered mode of operation will be used. This
argument is ignored for input tapes.
- NOBUFF
- A defined term used to specify no buffering (write immediate mode).
- BUFFERED
- A defined term used to specify buffered write mode (preferred).
- message
- A pointer to a message string that will be sent to the console if the
function is canceled because of a timeout condition. If a NULL pointer
is passed, no message will be sent.
- timeout
- The number of seconds that will lapse before the tape_access
attempt is canceled. If no value is specified, the function will never
time out.
Normal Return
The normal return is a positive value.
Error Return
An error return is indicated by a negative return code.
Programming Considerations
- When completed successfully, the tape will be assigned to the caller and
must either be closed or reserved before the ECB exits.
- The tape specified must be a general tape, not a real-time
tape. Real-time tapes have RT as the first 2 characters of their
name.
- If the tape is not physically ready or logically mounted, appropriate
messages are sent to the prime computer room agent set (CRAS) for operator
intervention. Control is not returned to the operational program until
the tape is ready to be processed or the timeout value has elapsed.
Examples
The following example uses tape_access to gain exclusive control
of a tape device.
#include <tpftape.h>
long example()
{
char *tape_name;
char *message;
long timeout;
long tape_return_code;
·
·
·
if ((tape_return_code = tape_access(tape_name,
INPUT,
BUFFERED,
message,
timeout)) != tape_OK )
{
if (tape_return_code == tape_openTimeOut)
{
printf("tape_access timed out\n");
}
else
{
if (tape_return_code == tape_wrongIOmode)
{
printf("tape_access failed due to mode conflict\n");
}
else
{
printf("tape_access failed\n");
}
}
}
else
{
printf("tape_access successful\n");
}
·
·
·
}
Related Information