gtpc2mh8C/C++ Language Support User's Guide

TO2_getDirectoryForRRN-Get the Current Directory for the Specified RRN

This function is used to locate and return the directory for the specified relative record number (RRN) for the target persistent identifier (PID).

Format

#include <c$to2.h>
long  TO2_getDirectoryForRRN (TO2_PID_PTR  pid_ptr,
                              TO2_ENV_PTR  env_ptr,
                              long         rrn,
                              void        *directoryPtr);  

pid_ptr
The pointer to the PID of the collection that will be interrogated.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

rrn
The relative record number value.

directoryPtr
The pointer to the 24-byte output area for the directory.

Normal Return

The normal return is a positive value.

Error Return

An error return is indicated by a zero. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error codes are common for this function:

TO2_ERROR_ENV

TO2_ERROR_PID

TO2_ERROR_UNASSIGNED_RRN

Programming Considerations

None.

Examples

This example shows how the TO2_getDirectoryForRRN function retrieves the directory for an RRN that is passed as input.

#include <c$to2.h>               /* Needed for TO2 API functions   */
#include <stdio.h>               /* APIs for standard I/O functions*/
TO2_ENV_PTR  env_ptr;            /* environment pointer            */
TO2_PID      collect;            /* PID of the target collection   */
long         rrn;                /* variable to hold input RRN     */
char         directory[25];      /* field for TPFCS to return      */
                                 /* directory contents.            */
 
 /* Invoke TPFCS to obtain the directory entry of the relative     */
 /* record number specified.                                       */
 
if (TO2_getDirectoryForRRN(&collect,
                           env_ptr,
                           rrn,
                           directory) == TO2_ERROR)
{
   printf("TO2_getDirectoryForRRN failed!\n");
   process_error(env_ptr);
}
else
{
   printf("TO2_getDirectoryForRRN successful!\n");
}
 

Related Information

None.