ViewPoint Manual

Sample Custom Status Server
ViewPoint Manual426801-001
D-10
Custom Server Code
RETURN ( Z^All^Ok^Code );
END; ! Sample^Disk^Usage
?PAGE "SAMPLE^DISK^LARGEST^FREE"
INT PROC Sample^Disk^Largest^Free ( Request, Reply );
INT .EXT Request ( Zvpt^Sample^Item^Request^Def ); ! Input
INT .EXT Reply ( Zvpt^Sample^Item^Reply^Def ); ! Output
BEGIN
-----------------------------------------------------------------------------
--
-- Compute the disk largest free extent available for usage
--
-----------------------------------------------------------------------------
STRUCT .Item^Name ( Zvpt^Item^Name^Def );
INT .Disk^Name [ 0:Fname^Wsz - 1 ];
INT DevType;
INT DevRecSize;
INT(32) Capacity;
INT(32) Free;
INT(32) Numfrag;
INT(32) Biggest;
Zerow ( Reply );
Return^Error := 0;
Return^Error^Detail := 0;
Item^Name ':=' Request.Z^Item^Name FOR Len^Wsz ( Item^Name ) WORDS;
Disk^Name ':=' " " & Disk^Name FOR 11 WORDS;
Disk^Name ':=' Item^Name.Z^Object^Name FOR 24 BYTES;
CALL DEVICEINFO ( Disk^Name, DevType, DevRecSize );
IF DevType.<4:9> <> 3 THEN RETURN ( Zerr^Stat^No^Such^Object );
Return^Error^Detail := DISKINFO ( Disk^Name, Capacity,
Free, Numfrag, Biggest );
IF Return^Error^Detail <> 0 THEN
BEGIN
RETURN ( Zerr^Stat^Object^Unavailable );
END;
Reply.Z^Maximum^Value := $DFIX ( Capacity * 2048D , 0 );
Reply.Z^Status^Value := $DFIX ( Biggest * 2048D, 0 );
Reply.Z^Timestamp := Juliantimestamp;
RETURN ( Z^All^Ok^Code );
END; ! Sample^Disk^Largest^Free
?PAGE "SAMPLE^DISK^FRAGMENTATION"
INT PROC Sample^Disk^Fragmentation ( Request, Reply );
INT .EXT Request ( Zvpt^Sample^Item^Request^Def ); ! Input
INT .EXT Reply ( Zvpt^Sample^Item^Reply^Def ); ! Output
BEGIN
-------------------------------------------------------------------------------
--
-- Compute the number of fragments on this disk.
--
-------------------------------------------------------------------------------
STRUCT .Item^Name ( Zvpt^Item^Name^Def );
INT .Disk^Name [ 0:Fname^Wsz - 1 ];
INT DevType;
INT DevRecSize;
INT(32) Capacity;
INT(32) Free;
INT(32) Numfragment;
INT(32) Biggest;
Zerow ( Reply );
Return^Error := 0;
Return^Error^Detail := 0;
Item^Name ':=' Request.Z^Item^Name FOR Len^Wsz ( Item^Name ) WORDS;
Disk^Name ':=' " " & Disk^Name FOR 11 WORDS;
Disk^Name ':=' Item^Name.Z^Object^Name FOR 24 BYTES;
CALL DEVICEINFO ( Disk^Name, DevType, DevRecSize );
IF DevType.<4:9> <> 3 THEN RETURN ( Zerr^Stat^No^Such^Object );
Return^Error^Detail := DISKINFO ( Disk^Name, Capacity,
Free, Numfragment, Biggest );
IF Return^Error^Detail <> 0 THEN
BEGIN
RETURN ( Zerr^Stat^Object^Unavailable );
END;
Reply.Z^Maximum^Value := $DFIX ( Capacity * 2048D , 0 );
Reply.Z^Status^Value := $DFIX ( Numfragment, 0 );
Reply.Z^Timestamp := Juliantimestamp;