This function retrieves all units defined on the Server. index should be set to zero for the first call to the function and subsequent calls should increment index, up to number-1 to retrieve remaining unit names.

C format

int32 piba_getunit(

char PIPTR * unit,

int32 len,

int32 index,

int32 PIPTR * number );



System error



No units defined


Index out of range


API access to batch not supported by the version of PI on the Server


No batch subsystem present on Server.


unit (returned)

Unit name

len (passed)

Size of passed unit buffer

index (passed)

Index into list of units. For example, if 5 units are defined, indexes 0 through 4 are valid.

number (returned)

Total number of units defined

Usage Notes



char unit[81]; 

int32 number, index, result; 

if ( result ) 


for ( index = 1; index < number; index++ ) 

result = piba_getunit   ( unit, sizeof(unit), index,  

&number ); 

printf { "\n%s", unit ); 

Enabling Operational Intelligence