gtpc2mioC/C++ Language Support User's Guide

TPFxd_getVOLSER-Retrieve Current VOLSER and Media Type

This function is called to copy the volume serial number (VOLSER) and device type from a position string into the specified location.

Format

#include <c$tpxd.h>
long TPFxd_getVolser (TPFxd_location  *positioningString,
                      char            *volser,
                      char            *devType,

positioningString
The location from which the VOLSER and device type will be derived.

volser
A pointer to where the VOLSER will be placed.

devType
A pointer to where the device type will be placed.

Normal Return

The normal return is a positive value.

Error Return

An error return is indicated by a negative return code. For a list of error codes applicable to this function, see Error Codes.

Programming Considerations

TPFxd_getVOLSER does not require the external device to be open. This function can be called using a TPFxd_location parameter, which was obtained from an earlier TPFxd_getPosition or TPFxd_getPrevPosition request.

Examples

The following example writes an object to an external device and then uses the TPFxd_getVOLSER function to retrieve the VOLSER that the object was just written to.

#include <c$tpxd.h>
long example()
{
TPFxd_extToken    *token;
TPFxd_locationMap wherefirst;
TPFxd_location    whereIwas;
enum              tpxd_mode mode;
enum              tpxd_opts access;
long              howbigitis;
long              howlongtowait;
char              *message;
long              returncode;
char              *stufftowrite;
char              currentVolser"6];
char              deviceType;
 
howlongtowait = 60;
howbigitis = 32000;
message = NULL;
token = NULL;
mode = WT;
access = IMMEDIATE;
TPFxd_archiveStart (&token, mode, access);
TPFxd_open (&token,
            &wherefirst,
            howbigitis,
            howlongtowait,
            message,
            mode );
stufftowrite = malloc(howbigitis);
TPFxd_write(token,stufftowrite,&howbigitis);
free(stufftowrite);
 
TPFxd_getPosition (token,
                   &whereIwas);
TPFxd_getVOLSER (&whereIwas,
                 (char *) currentVolser,
                 deviceType);
printf("VOLSER is %6.6s",currentVolser);

  ·
  ·
  ·
}

Related Information