*DECK NBADBSN
USETEXT NIPDEF
USETEXT AHEADER
USETEXT KDIS
USETEXT NCNB
USETEXT SUPMSG
USETEXT PARAMS
PRGM NBADBSN; # PROCESS BAD BSN ON AN UPLINE BACK #
STARTIMS;
#
*1DC NBADBSN
*
* 1. PROC NAME AUTHOR DATE
* NBADBSN L. T. NGUYEN 81/10/26
*
* 2. FUNCTIONAL DESCRIPTION
* LOCATE ACKQ ENTRY THAT HAS BSN MATCHED.
*
* 3. METHOD USED
* LOCATE THE ENTRY WITH MATCHING BSN (1ST FOR LOOP)
* IF FOUND, FORM FC/NAK AND CALL HBSTTP TO SEND TO APPL.
* FROM THE HOST SIDE FOR ALL ENTRIES NOT IN SEQUENCE.
* THEN RETURN TO CALLER WITH THE GOOD ENTRY ADDRESS.
* IF NOT FOUND, SET PARAMS3 TO ZERO.
*
* 4. ENTRY PARAMETERS
* PARAMS1 - NCNB ADDRESS
* PARAMS2 - BSN FROM CCP
*
* 5. EXIT PARAMETERS
* PARAMS3 - 0 IF NO ACKQ ENTRY FOUND.
* - OR ADDRESS OF ACKQ ENTRY HAS MATCHING BSN.
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED
* NIPDEF PARAMS AHEADER SUPMSG
* ACNB NCNB ACKHEAD OSSIZE
* KDIS
*
* 7. ROUTINES AND OVERLAYS CALLED
* MGETS - ALLOCATE BUFFER
* XTRACE - TRACE PROCEDURE CALL
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* THIS IS A SECONDARY OVERLAY CALLED BY NPBACK.
* W A R N I N G - THIS PROGRAM CANNOT EXCEED THE SECONDARY
*CALL OSSIZE
INPUT PARAMETERS - PARAMS1 = NCNB ADDRESS
PARAMS2 = BSN OF THE UPLINE BLOCK
#
STOPIMS;
#
EXTERNAL REFERENCES
#
XREF
BEGIN
PROC ABORT; # ABORT NIP ON BAD BSN #
PROC MGETS; # GET BUFFER #
PROC XTRACE; # TRACE CALL #
LABEL RJMAIN;
END
#
LOCAL VARIABLES
#
ITEM ACKHDR; # ACKQ HEADER ADDRESS #
ITEM BUFADDR; # BUFFER ADDRESS FOR PSEUDO ACK/NAK(S) #
ITEM BUFSIZE; # BUFFER SIZE #
ITEM BSN; # BLOCK SEQUENCE NUMBER #
ITEM MATCH B; # MATCH INDICATOR #
ITEM I; # INDUCTION VARIABLE #
ITEM J; # INDUCTION VARIABLE #
ITEM OUTPTR; # ACKQ OUT POINTER #
ARRAY MSG$BADBSN [0:0] S(3);
BEGIN
ITEM MSG$TEXT C(00,00,28) = # MESSAGE TEXT #
["NIP RECEIVED BAD BSN."];
ITEM MSG$END U(02,48,12) = [0];
END
CONTROL EJECT;
BEGIN # NBADBSN #
CONTROL IFEQ DEBUG,1;
XTRACE("NBBSN"); # TRACE CALL #
CONTROL FI; # END OF DEBUG CODE #
IF KNAMDB[0]
THEN # ABORT NAM ON BAD BSNS FROM NETWORK #
BEGIN
ABORT(MSG$BADBSN,0); # ABORT NAM #
END
P<NCNB> = PARAMS1; # NCNB ADDRESS #
BSN = PARAMS2; # UPLINE BSN #
OUTPTR = NCNBAKOU[0]; # ACKQ OUT POINTER #
ACKHDR = OUTPTR+ACKHSIZE; # FIRST ACKQ ENTRY #
MATCH = FALSE; # PRESET TO NO MATCH #
FOR I=0 STEP 1 WHILE NOT MATCH
AND OUTPTR NQ NCNBAKIN[0] # MORE ACKQ ENTRY #
DO # SCAN FOR MATCHING BSN IN ACKQ #
BEGIN
P<AHEADER> = ACKHDR+OUTPTR; # CURRENT ACKQ ENTRY #
IF BSN EQ ABHADR[0]
THEN # BSN MATCH FOUND #
MATCH = TRUE; # TERMINATE ACKQ SEARCH #
ELSE # NOT MATCH FOUND #
BEGIN
IF (OUTPTR+1) LS NCNBDBL[0]
THEN
OUTPTR = OUTPTR+1;
ELSE
OUTPTR = 0; # RESET ACKQ OUT POINTER #
END
END # I CONTAINS NUMBER OF ACKQ ENTRY(S) PROCESSED #
IF MATCH
THEN # BSN MATCH, SEND FC/NAK(S) AND FC/ACK TO APPLICATION #
BEGIN
MGETS(I+BLKHSIZE,BUFADDR,TRUE); # GET BUFFER FOR ACK/NAK #
FOR J=BLKHSIZE STEP 1 WHILE J LQ I
DO # FORMAT PSEUDO ACK/NAK ENTRY(S) #
BEGIN
P<SUPMSG> = BUFADDR+J; # PSEUDO ENTRY #
P<AHEADER> = ACKHDR+NCNBAKOU[0];
IF BSN EQ ABHADR[0]
THEN # BSN MATCH, SEND FC/ACK #
PFCSFC[0] = FCACK;
ELSE # BSN MISMATCH, SEND FC/NAK #
BEGIN
PFCSFC[0] = FCNAK;
FCRNAK[0] = 1; # REASON CODE FOR NAK #
END
FCABN[0] = ABHABN[0]; # SET ABN #
IF (NCNBAKOU[0]+1) GQ NCNBDBL[0]
THEN
NCNBAKOU[0] = 0;
ELSE
NCNBAKOU[0] = NCNBAKOU[0]+1;
NCNBNBO[0] = NCNBNBO[0]-1; # DECREMENT NBO COUNT #
END
PARAMS3 = BUFADDR; # RETURN PSEUDO ENTRY ADDRESS #
END
ELSE # NO MATCHING BSN FOUND IN ACKQ, IGNORE BACK #
PARAMS3 = 0; # NO PSEUDO ENTRY TO PROCESS FOR HBSTTP #
GOTO RJMAIN;
END # NBADBSN #
TERM