Product Documentation

c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

New GETFIL() Modes to Retrieve First and Last Active Partition Members

When working with partitioned files, it is useful to quickly locate the first (the "oldest" when partitioning by date) and last ("newest") partition members for administrative purposes. Two modes have been added to the GetCtFileInfo() function to support this ability.

  • FRSACTPRT - returns the first active partition number for the file
  • LSTACTPRT - returns the last active partition number for the file

If GETFIL() returns -1, check the value of uerr_cod. If uerr_cod is zero, the file has no active partitions. If uerr_cod is non-zero, an error occurred. For example, if the specified file number does not correspond to a partition host file, GETFIL() returns -1 and sets uerr_cod to PHST_ERR.

Example

COUNT datno;

NINT rc;

LONG partno;

if ((partno = GETFIL(datno, FRSACTPRT)) == -1L) {

if ((rc = uerr_cod))

printf(

"Error: Failed to get first active partition number: %d\n",

rc);

else

printf("The file has no active partitions.\n");

} else

printf("first active partition: %d\n", partno);

if ((partno = GETFIL(datno, LSTACTPRT)) == -1L) {

if ((rc = uerr_cod))

printf(

"Error: Failed to get last active partition number: %d\n",

rc);

else

printf("The file has no active partitions.\n");

} else

printf("last active partition: %d\n", partno);

TOCIndex