*DECK NP$DBG
*IF,DEF,DEBUG
USETEXT AIPDEF
USETEXT NP$DB
USETEXT NP$GETS
USETEXT NP$NWL
USETEXT NP$TAA
USETEXT NP$NWNC
USETEXT HEADER
*ENDIF
PROC NP$DBG;
*IF,DEF,IMS
#
*1DC NP$DBG
*
* 1. PROC NAME AUTHOR DATE
* NP$DBG S. KRULEVITCH 78/11/15
*
* 2. FUNCTIONAL DESCRIPTION
* CONVERTS SUPERVISORY OR DATA MESSAGES INTO DEBUG LOG FORMAT
* AND WRITES IT TO FILE ZZZZZDN IF THE PROPER DEBUG SWITCH IS
* TURNED ON.
*
* 3. METHOD USED
* WHEN ENTERED THE ABT FIELD IN THE MESSAGE HEADER AND THE DEBUG
* SWITCHES, DB$SM AND DB$DM ARE TESTED TO DETERMINE IF THE
* MESSAGE WILL BE LOGGED. IF NOT, CONTROL IS RETURNED TO THE
* CALLING ROUTINE.
* EACH ENTRY OF THE DEBUG LOG FILE GENERATED BY
* NP$DB HAS A THREE WORD HEADER.
* WORD 0
* 2
* 0 4
* I-------------------------I----------------I
* I I I
* I SECONDS SINCE DEADSTART I MILLISECONDS I
* I I I
* I-------------------------I----------------I
*
* WORD 1
* 2 4 5 5
* 0 6 4 2 3 9
* I-----I-----------I------------I--------I--------I
* I I I I I I
* I I DL$BS I DL$CALL I DL$ADR I DL$OPC I
* I I I I I I
* I-----I-----------I------------I--------I--------I
*
* DL$BS - SIZE OF MESSAGE BLOCK (INCLUDES WORD 1)
* DL$CALL - CALLING ADDRESS
* DL$ADR - THIS FIELD IS DEPENDENT ON DL$OPC[0].
* = APPLICATION CONNECTION NUMBER FOR NETGET (=ACLN)
* = APPLICATION CONNECTION NUMBER FOR NETGETF (=ACLN)
* = APPLICATION LIST NUMBER FOR NETGETL (=ACLN)
* = APPLICATION LIST NUMBER FOR NETGTFL (=ACLN)
* = 0 FOR NETPUT OR NETPUTF
* DL$OPC - OP$CODE OF CALLING ROUTINE
*1
*
* WORD 2
* 2 4 5
* 0 6 4 2 9
* I-----I-----------I------------I----------------I
* I I I I I
* I I DL$TL I DL$HA I DL$TA I
* I I I I I
* I-----I-----------I------------I----------------I
*
* DL$TL - THIS FIELD IS DEPENDENT ON DL$OPC[0].
* = MAXIMUM ALLOWABLE TEXT LENGTH FOR NETGET (=TLMX)
* = MAXIMUM ALLOWABLE TEXT LENGTH FOR NETGETL (=TLMX)
* = NUMBER OF FRAGMENTED BUFFERS FOR NETGETF (=LTAA)
* = NUMBER OF FRAGMENTED BUFFERS FOR NETGTFL (=LTAA)
* = NUMBER OF FRAGMENTED BUFFERS FOR NETPUTF (=LTAA)
* = 0 FOR NETPUT
* DL$HA - HEADER ADDRESS (=LOC$HA)
* DL$TA - THIS FIELD IS DEPENDENT ON DB$OPC[0]
* = TEXT AREA FOR NETGET,NETGETL, AND NETPUT (=LOC$TA)
* = TEXT AREA ARRAY ADDRESS FOR NETGETF, NETGTFL, AND
* NETPUTF (=LOC$TA)
*
* WORD 3 (NORMAL FORMAT)
* 5
* 0 9
* I----------------------------------------------I
* I I
* I DL$ABH I
* I I
* I----------------------------------------------I
*
* DL$ABH - APPLICATION BLOCK HEADER FOR NETGET,M
* NETGETL, NETGETFL, NETGETF, NETPUT, AND
* NETPUTF.
*
* WORD 3 (NETLOG ENTRY)
* 2 4 5
* 0 4 2 9
* I--------------------I-------------I-------------I
* I I I I
* I I DL$SIZE I DL$FORMAT I
* I I I I
* I--------------------I-------------I-------------I
*
* DL$SIZE - SIZE OF THE TEXT
* DL$FORMAT - FORMAT FLAG FOR NETLOG ENTRIES
* 0 FOR UNFORMATTED DATA
* 1 FOR FORMATTED DATA
*
* FOR NON-SUPERVISORY MESSAGES DB$TRUNC WILL GIVE THE NUMBER OF
* MESSAGE TEXT TO BE PRINTED OUT. DEFAULT IS THE COMPLETE MESSAGE
* UP TO 410 WORDS.
*
* EVERY 500 MESSAGES,AN END-OF-RECORD IS WRITTEN TO ZZZZZDN.
* THIS ALLOWS THE USER TO PRINT A PORTION OF THE FILE. DOING A
* CATALOG ON A SAVED ZZZZZDN FILE WILL SHOW THE TIME OF DAY
* AT THE START OF EACH 500 LINE RECORD. THUS THE USER MAY COPYBR
* TO OUTPUT THE SPECIFIC TIME PERIOD THAT WARRANTS EXAMINATION.
*
* 4. ENTRY CONDITIONS
* ALL ENTRY CONDITIONS ARE ESTABLISHED IN COMMON BLOCK NETDB.
*
* DB$SM - LOG SUPERVISORY MESSAGES, EXCEPT FC/ACK, IF TRUE
* DB$DM - LOG DATA MESSAGES, PLUS FC/ACK SUPERVISORY MESSAGES,
* IF TRUE
* DB$ERCT - UP TO 500 BEFORE EOR WRITTEN TO ZZZZZDN
* DB$FET - FET FOR FILE ZZZZZDN
* DB$OP - OPERATION CODE OF NAM PROCEDURE CALL
* DB$PAR - PARAMETERS FROM NAM PROCEDURE CALL
*
* 5. EXIT CONDITIONS
* NONE
*
* 6. COMDECKS CALLED AND SYMPLTEXTS USED.
* AIPDEF HEADER
* NP$CRT NP$DB NP$DLA NP$GETS
* NP$NWNC NP$NWL NP$TAA
*
* 7. PROCEDURES/FUNCTIONS CALLED
* NP$CLK - CLOCK TIME IN DISPLAY CODE. USES MACREL INTERFACE
* NP$PIOE - PROCESS I/O ERROR AFTER WRITE OPERATION ON FILE
* NP$RTIM - REAL TIME SINCE DEADSTART IN SECONDS AND
* MILLISECONDS
* NP$WRTR - NOS MACRO TO WRITE EOR TO FILE. CALLED WITH MACREL
* INTERFACE.
* NP$WRTO - WRITES ONE WORD TO CIO BUFFER
* NP$WRTW - NOS DATA TRANSFER MACRO TO TRANSFER DATA FROM A
* WORKING BUFFER TO THE INPUT/OUTPUT BUFFER. CALLED
* WITH MACREL INTERFACE
*
* 8. DAYFILE/DIAGNOSTIC MESSAGES
* NONE
*
#
*ENDIF
BEGIN
*CALL NP$CRT
*IF DEF,DEBUG
# EXTERNAL PROCEDURES/FUNCTIONS #
XREF
BEGIN
PROC NP$CLK; # CLOCK TIME IN DISPLAY CODE #
PROC NP$PIOE; # PROCESS I/O ERROR ON FILE #
PROC NP$RTIM; # REAL TIME #
PROC NP$WRTO; # WRITES ONE WORD #
PROC NP$WRTR; # WRITES EOR #
PROC NP$WRTW; # WRITES WORDS #
END
# ITEM DEFINITIONS #
ITEM CHARWD C(10); # WORD TO STORE CLOCK TIME #
ITEM K; # TEMPORARY INDEX VARIABLE #
ITEM L; # TEMPORARY INDEX VARIABLE #
ITEM NA; # NUMBER OF TEXT ARRAY FRAGMENTS #
ITEM NUMF; # NUMBER OF FRAGMENTS USED BY TEXT #
ITEM TAALEN; # LENGTH OF FRAGMENTED MESSAGE VECTOR #
ITEM TIMEWD U; # TEMPORARY STORE FOR TIME #
ITEM TRUNC; # NUMBER OF WORDS OF MESSAGE TEXT (MAX) #
ITEM WR; # WORDS REMAINING IN TEXT #
# ARRAY DEFINITIONS #
ARRAY DATLINE P(4);
*CALL NP$DLA
#**********************************************************************#
# #
# NP$DBG EXECUTION BEGINS HERE #
# #
# DETERMINE IF MESSAGE WILL BE LOGGED #
P<HEADER> = LOC$HA; # HEADER ADDRESS #
P<SUPMSG> = LOC$TA ;
P<TAA> = LOC$TA;
IF DB$OP EQ OP$LOG
THEN
BEGIN
TRUNC = DB$SIZE; # TEXT LENGTH IN CM WORDS #
IF TRUNC GR DB$TRUNC
THEN
TRUNC = DB$TRUNC;# TRUNCATE LENGTH OF TEXT #
END
ELSE
BEGIN # NOT NETLOG ENTRIES #
IF DB$OP NQ OP$PUT AND# INPUT NULL BLOCK #
DB$OP NQ OP$PUTF AND# BREAK FLAG NOT SET #
ABHABT[0] EQ 0 AND
ABHBRK[0] EQ 0
THEN
IF ABHDBC[0] EQ 0
THEN
RETURN ; # ********************** #
IF DB$OP EQ OP$PUTF
THEN
NP$NA = ACLN; # NUMBERS OF FRAGMENTS FROM ACLN #
IF DB$OP GQ OP$GETF
THEN
P<SUPMSG> = TAADDR[1]; # FRAGMENT CALL AND TA FROM TAA #
IF ABHABT[0] EQ 3 OR
ABHABT[0] EQ 4
THEN
BEGIN # SUPERVISORY MESSAGES #
IF PFCSFC[0] EQ FCACK
THEN
BEGIN # FC/ACK SUPERVISORY MESSAGE #
IF NOT DB$DM
THEN # DATA MESSAGE LOGGING NOT ON #
RETURN; # ***** RETURN ***** #
END
ELSE
IF NOT DB$SM
THEN # SUPERVISORY MESSAGE LOGGING NOT ON #
RETURN; # ***** RETURN ***** #
END
ELSE
IF NOT DB$DM
THEN # DATA MESSAGE LOGGING NOT ON #
RETURN; # ***** RETURN ***** #
# DETERMINE NUMBER OF TEXT WORDS TO OUTPUT #
IF ABHACT[0] EQ 0
THEN
K = 1 ; # PRETEND TO HAVE ACT = 1 #
ELSE
K = ABHACT[0] ;
IF ABHABT[0] EQ 0
THEN
TRUNC = 0 ;
ELSE
TRUNC = ( ABHTLC[0] * 2 + NW$ROUND[K] ) / NW$FACT[K] ;
IF TRUNC GR DB$TRUNC
THEN
TRUNC = DB$TRUNC;# MAXIMUM WORDS OF DATA TEXT OUTPUT #
END
# FORMAT MESSAGE AND OUTPUT TO FILE #
NP$RTIM(TIMEWD); # CURRENT TIME #
DL$TIME[0] = TIMEWD;
DL$CALL[0] = DB$CALL;
WR = TRUNC; # CALCULATE THE NUMBER OF FRAGMENTS USED #
NUMF = 0;
IF DB$OP GQ OP$GETF AND DB$OP LQ OP$GTFL
THEN # FRAGMENTED MESSAGE BLOCK #
BEGIN
FOR K = 1 STEP 1 WHILE K LQ NP$NA AND WR GR 0
DO
BEGIN
L = TAASIZE[K]; # ADDRESS OF KTH FRAGMENT #
WR = WR - L;
NUMF = K; # NUMBER OF FRAGMENTS USED BY TEXT #
END # FRAGMENTED CASE #
IF WR GR 0
THEN # WR WAS LARGER THAN TOTAL FRAG BUF SIZE #
TRUNC = TRUNC-WR; # TOTAL FRAGMENTED BUFFER SIZE #
END
IF DB$OP NQ OP$LOG
THEN
BEGIN # NOT NETLOG ENTRIES #
IF ABHABT[0] EQ 0 # NULL BLOCK #
OR ( ABHIBU[0] EQ 1 # INPUT UNDELIVERABLE #
AND NOT( DB$OP EQ OP$PUT # NET PUT #
OR DB$OP EQ OP$PUTF ) ) # NET PUT F #
THEN # SET BS TO 3, ONLY THE HEADER #
DL$BS[0] = 3;
ELSE
DL$BS[0] = TRUNC + NUMF + 3;# NORMAL BLOCK SIZE #
END
ELSE
BEGIN # NETLOG ENTRY #
DL$BS[0] = TRUNC + NUMF + 3;# NORMAL BLOCK SIZE #
DL$SIZE[0] = DB$SIZE;
DL$FORMAT[0] = DB$FORMAT;
END
DL$OPC[0] = DB$OP;
DL$HA[0] = LOC$HA;
DL$TA[0] = LOC$TA;
DL$ADR[0] = ACLN;
IF DB$OP EQ OP$PUTF
THEN
DL$ADR[0] = 0;
IF DB$OP EQ OP$GET OR DB$OP EQ OP$GETL
THEN
DL$TL[0] = TLMX; # BLOCK SIZE TO RECEIVE DATA #
ELSE
BEGIN
DL$TL[0] = NP$NA; # NUMBER OF FRAGMENTED BUFFERS #
IF DB$OP EQ OP$PUT
THEN
BEGIN
DL$TL[0] = 0;
DL$ADR[0] = 0;
END
END # FRAGMENTS AND OP$PUT #
IF DB$OP NQ OP$LOG
THEN # SET HEADER WORD IN DEBUG LOG FILE #
DL$ABH[0] = ABHWORD[0];
NP$WRTW(DB$FET,DATLINE,4); # WRITE HEADER TO ZZZZZDN #
#
NSUPWRD BASED ARRAY POINTER TO THE USER COMMUNICATION WORD
WAS SET BY NETON. THE ARRAY IS LOCATED IN NP$NWL COMDECK.
UPDATE MSGCNT IN THE COMMUNICATION WORD.
#
MSGCNT[0] = MSGCNT[0] + 1;
# #
IF DB$OP GQ OP$GETF AND
DB$OP LQ OP$GTFL
THEN
BEGIN # FRAGMENTED GETS AND GETLS #
IF ABHIBU[0] NQ 1
THEN # INPUT UNDELIVERABLE #
BEGIN
WR = TRUNC; # WORDS TO BE TRANSFERRED TO ZZZZZDN #
FOR K = 1 STEP 1 WHILE K LQ NUMF AND
WR GR 0
DO
BEGIN
NP$WRTW(DB$FET,TAAWORD[K],1); # COPY TAA WORD TO ZZZZZDN #
P<SUPMSG> = TAADDR[K] ; # KTH FRAGMENT 'S ADDRESS #
L = TAASIZE[K]; # KTH FRAGMENT SIZE,DB$OP=TEMP #
IF L GR WR
THEN
L = WR;
NP$WRTW(DB$FET,SUPMSG,L); # COPY TEXT TO ZZZZZDN #
WR = WR - L; # WORDS REMAINING IN TEXT #
END # FRAGMENTED MESSAGE + TAA #
# COPIED TO ZZZZZDN #
END
END
ELSE
BEGIN
IF DB$OP EQ OP$LOG OR
NOT ( ABHIBU[0] EQ 1 AND ( DB$OP EQ OP$GET
OR DB$OP EQ OP$GETL
OR DB$OP EQ OP$GSM ) )
THEN
NP$WRTW(DB$FET,SUPMSG,TRUNC);# COPY TO ZZZZZDN #
END
IF MSGCNT[0] GQ DB$ERCT
THEN # END OF RECORD TO BE WRITTEN #
BEGIN
NP$WRTR (DB$FET,1); # WRITE END OF RECORD TO ZZZZZDN #
NP$CLK(CHARWD); # GET CLOCK TIME IN DISPLAY CODE #
NP$WRTO(DB$FET,CHARWD);
DB$ERCT = DB$ERCT + 500;
END
#
CHECK FOR I/O ERROR IN DEBUG LOG FILE
#
IF FET$AT[0] NQ 0
THEN # I/O ERROR HAS OCCURRED ON FILE#
BEGIN
NP$PIOE(DB$FET); # PROCESS I/O ERROR #
END
*ENDIF
RETURN;
END # NP$DBG #
TERM # NP$DBG #