beautypg.com

HP NonStop G-Series User Manual

Page 100

background image

Defining Custom Counters

Measure User’s Guide 520560-003

5 -4

Sample TAL Program

?SOURCE $SYSTEM.SYSTEM.EXTDECS (MYTERM, OPEN, DEBUG, WRITE,
? NUMOUT, DELAY, CLOSE, MEASCOUNTERBUMP,
? MEASCOUNTERBUMPINIT)
?LIST
?PAGE "MAIN PROCEDURE -- BILLING"
PROC billing MAIN;

BEGIN

! counter names and offsets
int .transactions[0:7] := ["TRANSACTIONS "];
int .timeper[0:7] := ["TIMEPER "];
int .waiting[0:7] := ["WAITING "];
int transactions^offset;
int timeper^offset;
int waiting^offset;

subproc printmsg;
! displays a message on the terminal
begin
CALL WRITE (term^number, msg, 80);
IF <> THEN CALL DEBUG;
smsg ':=' 80*[" "];
end; !subproc

subproc checkiniterr;
! checks for errors returned by MEASCOUNTERBUMPINIT
! note, this sample program assumes an active measurement
begin
IF error AND (error <> ERR^UDCNOTPRESENT) THEN
BEGIN
CALL NUMOUT (array, error, 10, 5);
smsg ':=' "MEASCOUNTERBUMPINIT error: " &
sarray FOR 6 bytes;
call printmsg;
END;
end; !subproc

subproc checkerr;
! checks for errors returned by MEASCOUNTERBUMP
! note, this sample program assumes an active measurement
begin
IF error AND (error <> ERR^UDCNOTPRESENT) THEN
BEGIN
CALL NUMOUT (array, error, 10, 5);
smsg ':=' "MEASCOUNTERBUMP error: " &
sarray FOR 6 bytes;
call printmsg;
END;
end; !subproc

! ********************
! begin main procedure
! ********************

Example 5-1. TAL Application Containing User-Defined Counters (page 2 of 3)