*DECK NETSTC
*IF,DEF,STAT
USETEXT NP$STAT
*ENDIF
PROC NETSTC((OPTION),STSTAT);
*IF DEF,IMS
#
*1DC NETSTC
* 1. PROC NAME AUTHOR DATE
* NETSTC S. KRULEVITCH 77/07/11
*
* 2. FUNCTIONAL DESCRIPTION
* PROCESSES THE NETSTC CALL FROM AN APPLICATION. STATISTICS
* LOGGING IS STARTED OR TERMINATED ACCORDING TO OPTION = 0
* OR 1, WHEN AIP IS COMPILED WITH *DEFINE STAT. OTHERWISE
* STATUS = 1 IS RETURNED INDICATING THE STATISTICS LOGGING
* OPTION IS NOT ON.
*
* 3. METHOD USED
* MOST OF THE LOGIC IN THIS PROCEDURE IS CONDITIONALLY COMPILED.
* WHEN *DEFINE,STAT IS NOT USED, STSTAT IS SET EQUAL TO 1 AND
* CONTROL IS RETURNED TO CALLER. WHEN *DEFINE, STAT IS USED,
* STATISTICS LOGGING IS TURNED ON IF OPTION = 0 OR OFF IF
* OPTION = 1, AND STSTAT IS SET EQUAL TO ZERO. THE CALL TO NETSTC
* IS LOGGED ON FILE ZZZZZSN.
*
* 4. ENTRY CONDITIONS
* OPTION=0 TURN STATISTICS LOGGING ON
* NOT 0 TURN STATISTICS LOGGING OFF
*
* 5. EXIT CONDITIONS
* STSTAT = 0 STATISTICS LOGGING AVAILABLE
* NOT 0 STATISTICS LOGGING NOT AVAILABLE.
* STATON IS SET TRUE OR FALSE AS REQUESTED BY OPTION EQUAL TO
* 0 OR 1.
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* NP$CRT NP$STAT
*
* 7. PROCEDURES/FUNCTIONS CALLED
* NP$CLK
* NP$DATE
* NP$PIOE - PROCESS I/O ERROR ON FILE
* NP$SPRT
* NP$TIM
* NP$WRTW
*
* 8. DAYFILE/DIAGNOSTIC MESSAGES
* NONE
*
*
#
CONTROL EJECT;
*ENDIF
BEGIN
*CALL NP$CRT
# #
# FORMAL PARAMETERS #
# #
ITEM
OPTION I, #0 TO TURN ON LOGGING,ELSE 1 #
STSTAT I; #0 IF STAT IS DEFINED,ELSE 1 #
*IF DEF,STAT
# #
# EXTERNAL ROUTINES #
# #
XREF
BEGIN
PROC NP$CLK;
PROC NP$DATE;
PROC NP$PIOE; # PROCESS I/O ERROR #
PROC NP$SPRT; #DUMPS STATISTICS TO ZZZZZSN #
PROC NP$TIM; #GETS ACCUMULATED CPU TIME #
PROC NP$WRTW;
END
# #
# LOCAL DECLARATIONS #
# #
ITEM CHARWD C(10);
ARRAY STMSG P(5);
ITEM
ST$CC C(0,0,10)=["0 "], #DOUBLE SPACE #
ST$MSG1 C(1,0,35)=["NAM STATISTICS GATHERING "],
ST$MSG2 C(3,30,10);
ARRAY STMSGA P(6);
ITEM
ST$CCA C(0,0,10)=[" "], #SINGLE SPACE #
ST$MSG3 C(1,0,13)=["NETSTC DATE "],
ST$DATE C(2,18,10),
ST$MSG4 C(3,18,7)=[" TIME"],
ST$TIME C(4,0,10),
ST$EOLA I(5,0,60)=[0];
*ENDIF
# #
# NETSTC EXECUTION BEGINS HERE #
# #
ENTRY PROC QTSTC((OPTION),STSTAT); # QTRM ENTRY POINT FOR PROC #
STSTAT = 1;
*IF DEF,STAT
IF OPTION EQ 0
THEN
BEGIN
ST$MSG2 = "STARTED ";
STATON = TRUE; #TURN ON STATISTICS GATHERING #
NP$TIM(ST$CLK[0]); #CPU STARTING TIME #
END
ELSE
BEGIN
ST$MSG2 = "TERMINATED";
STATON = FALSE;
END
NP$DATE(CHARWD); #PUT CURRENT DATE IN OUTPUT LINE #
ST$DATE = CHARWD;
NP$CLK(CHARWD); #GET TIME IN DISPLAY CODE #
ST$TIME = CHARWD; #PUT DISPLAY CODE TIME IN CHARACTER ARRAY #
NP$WRTW(SN$FET,STMSG,5);
NP$WRTW (SN$FET,STMSGA,6);
#
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
IF NOT STATON
THEN
NP$SPRT; #WHEN STATISTIC GATHERING IS TERMINATED THEN DUMP #
#STATISTICS TO ZZZZZSN. #
STSTAT = 0;
*ENDIF
RETURN;
END #NETSTC#
TERM