*DECK NP$SN
*IF,DEF,STAT
USETEXT NP$MODE
USETEXT NP$STAT
*ENDIF
PROC NP$SN((STNUM));
*IF DEF,IMS
#
*1DC NP$SN
*
* 1. PROC NAME AUTHOR DATE
* NP$SN S.KRULEVITCH 77/07/01
*
* 2. FUNCTIONAL DESCRIPTION
* WRITES STATISTICS COUNT TO THE NAM STATISTICS FILE ZZZZZSN.
*
* 3. METHOD USED
* EACH LINE OF THE LOG ENTRY IS FORMATTED AND WRITTEN TO FILE
* ZZZZZSN USING MACREL FUNCTION AND PROCEDURE CALLS.
*
* 4. ENTRY CONDITIONS
* STNUM - NUMBER TO IDENTIFY WHICH STATISTIC IS TO BE LOGGED
* ON THE ZZZZZSN FILE. THE NUMBER GIVES THE POSITION
* IN THE STATISTICS ARRAY.
* SN$FET - FET FOR FILE ZZZZZSN
* PRNT - TRUE IF STATISTICS COUNT IS TO BE WRITTEN TO ZZZZZSN.
* FALSE IF STATISTICS COUNTER IS BEING INCREMENTED.
*
* 5. EXIT CONDITIONS
* NONE
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* NP$CRT NP$MODE NP$STAT
*
* 7. PROCEDURES/FUNCTIONS CALLED
* NP$PIOE PROCESS I/O ERROR ON DISK FILE
* NP$WRTW
* NP$XCDD
*
* 8. DAYFILE MESSAGES
* NONE
*
#
*ENDIF
BEGIN
*CALL NP$CRT
# #
# FORMAL PARAMETER #
# #
ITEM
STNUM I; #IDENTIFIES STATISTIC TO BE #
#UPDATED OR PRINTED #
*IF DEF,STAT
# #
# ROUTINES CALLED #
# #
XREF
BEGIN
PROC NP$PIOE; # PROCESS I/O ERROR ON DISK FILE #
PROC NP$WRTW;
FUNC NP$XCDD C(10);
END
# #
# LOCAL VARIABLES #
# #
DEF OVERFLOW #1000000#; #STATISTICS FIELD OVERFLOW #
ITEM
I I; #TEMPORARY VARIABLE #
ARRAY TOOBIG P(4);
ITEM
TOOBIGCC C(0,0,10)=["0 "], #DOUBLE SPACE #
TOOBIGMSG C(1,0,24)=["****COUNTER OVERFLOW****"],
TOOBIGEOL I(4,0,60)=[0];
ARRAY STATISTIC[0:STATSIZE] P(2);
ITEM
STATNAME C(0,0,20)=
[" NETCHEK ",
" NETDMB ",
" NETFUNC ",
" NETGET ",
" NETGETF ",
" NETGETL ",
" NETGETQ ",
" NETGTFL ",
" NETGTLQ ",
" NETLGS ",
" NETLOG ",
" NETPUT ",
" NETPUTF ",
" NETSETP ",
" NETWAIT ",
" NETXFR ",
" NETXFRC ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" SUCCESSFUL ",
" UNSUCCESSFUL ",
" INPUT ABT=0 ",
" INPUT ABT=1 ",
" INPUT ABT=2 ",
" INPUT ABT=3 ",
" INPUT ABT=4 ",
,
" INPUT ABT=6 ", # INPUT QBLK BLOCK TYPE #
" INPUT ABT=7 ", # INPUT QMSG BLOCK TYPE #
" OUTPUT ABT=1 ",
" OUTPUT ABT=2 ",
" OUTPUT ABT=3 ",
" OUTPUT ABT=4 ",
,
" OUTPUT ABT=6 ", # OUTPUT QBLK BLOCK TYPE #
" OUTPUT ABT=7 ", # OUTPUT QMSG BLOCK TYPE #
" LOGICAL ERRORS ",
" NAK-S ",
" "];
ARRAY STLOG P(5);
ITEM
STLOG$CC C(0,0,10)=[" "],
STLOGA C(1,0,20),
STLOGB C(3,0,10),
STLOG$EOL I(4,0,60)=[0];
CONTROL EJECT;
# #
# NP$SN EXECUTION BEGINS HERE #
# #
# STEP 1: CHECK IF STATISTICS GATHERING IS ON. #
IF ACCEPTED
THEN
BEGIN
# STEP 2: INCREMENT COUNTER UNLESS NP$SN HAS BEEN CALLED FOR #
# PRINTOUT ONLY #
IF NOT PRNT AND STATON
THEN
STAT[STNUM] = STAT[STNUM] + 1;
# STEP 3: WRITE OVERFLOW MESSAGE IF COUNTER GETS TOO LARGE #
IF STAT[STNUM] GQ OVERFLOW
THEN
NP$WRTW(SN$FET,TOOBIG,4);
# STEP 4: WRITE STATISTIC TO FILE ZZZZZSN. #
IF (STAT[STNUM] GR 0 AND PRNT) OR STAT[STNUM] GQ OVERFLOW
THEN
BEGIN
STLOGA = STATNAME[STNUM];
STLOGB = NP$XCDD(STAT[STNUM]);
NP$WRTW(SN$FET,STLOG,5);
STAT[STNUM] = 0; #CLEAR COUNTER #
END
#
CHECK FOR I/O ERROR IN STATISTICS FILE
#
IF SN$AT[0] NQ 0
THEN # I/O ERROR HAS OCCURRED ON FILE#
BEGIN
NP$PIOE(SN$FET); # PROCESS I/O ERROR #
END
END #STATON#
*ENDIF
RETURN;
END #NP$SN#
TERM