*DECK RELACNB USETEXT NIPDEF USETEXT ACB USETEXT ACNB USETEXT ACNT USETEXT AT USETEXT DRHDR USETEXT KDIS USETEXT KHDRX USETEXT NCNB PROC RELACNB(ACNBADR,SWFLAG,LNFLAG); # RELEASE ACNB # STARTIMS; # *1DC RELACNB * * 1. PROC NAME AUTHOR DATE * RELACNB C. BITTNER 81/04/07 * * 2. FUNCTIONAL DESCRIPTION * RELEASE THE APPLICATION CONNECTION BLOCK (ACNB) * * 3. METHOD USED * CHECK IF ACNT CAN BE SHRUNK. IF NOT, UPDATE ACNT * HEADER INFORMATION. RELEASE DATA RING AND ACNB. * DECREMENT TOTAL NUMBER OF CONNECTIONS IN THE ACB. * * 4. ENTRY PARAMETERS * ACNBADR ADDRESS OF ACNB TO RELEASE * SWFLAG FLAG TO INDICATE IF SWITCHING CONNECTION * LNFLAG FLAG TO INDICATE IF LOANING CONNECTION * * 5. EXIT PARAMETERS * NONE * * 6. COMDECKS CALLED AND SYMPL TEXTS USED * NIPDEF ACNT * ACB DRHDR * ACNB * NCNB AT * KDIS * * 7. ROUTINES AND OVERLAYS CALLED * REDUCE - REDUCE MEMORY BUFFER * HUPDDAW - UPDATE DATA AVAILABLE WORD * OMSG - ISSUE DAYFILE MESSAGE * XTRACE - RECORD PROCEDURE CALLS * DELCDR - DELETE ACNB FROM CONNECTION DATA RING * KPUT - UPDATE STATUS DISPLAY * MRELS - RELEASE BUFFER * * 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION * "NIP/RELACNB - BAD CN" * * THIS PROCEDURE IS LOADED AND CALLED BY PRIMARY OVERLAY * STRTSW AND SECONDARY OVERLAY HSWACNB VIA HCSTTP. * * W A R N I N G - THE SIZE OF THIS PROCEDURE ALONG WITH * SECONDARY OVERLAY HSWACNB PLUS PROCEDURE * HALLOCN CANNOT EXCEED THE SIZE OF THE * SECONDARY OVERLAY BUFFER SIZE MINUS 5 * (473B WORDS). THE SIZE OF THIS PROCEDURE * ALONG WITH PRIMARY OVERLAY STRTSW PLUS * PROCEDURES HCONREQ, HCRSWHN, AND MREDUCE * CANNOT EXCEED THE SIZE OF THE PRIMARY * OVERLAY BUFFER SIZE MINUS 5 (673B WORDS). * # STOPIMS; # EXTERNAL VARIABLES # XREF BEGIN PROC DELCDR; # DELINK ACNB FROM CONNECTION DATA RING # PROC HUPDDAW; # UPDATE DATA AVAILABLE WORD # PROC MREDUCE; # REDUCE MEMORY BUFFER # PROC KPUT ; PROC OMSG; # ISSUE DAYFILE MESSAGE # PROC MRELS; # RELEASE BUFFER SPACE # PROC XTRACE; # RECORD PROCEDURE CALLS # PROC ABORT ; # # END # INPUT PARAMETERS # ITEM ACNBADR; # ADDRESS OF ACNB TO RELEASE # ITEM SWFLAG B; # TRUE = SWITCHING CONNECTION # ITEM LNFLAG B; # TRUE = LOANING CONNECTION # # INTERNAL VARIABLES # ITEM ACNTINDX; # INDEX INTO ACNT # ITEM AN; # APPLICATION NUMBER # ITEM NEWSIZE; # SIZE TO REDUCE BUFFER TO # ITEM CURR; # INDUCTION LOOP VARIABLE # ITEM FOUND B; # HIGHEST CN IN USE FOUND-FLAG # ITEM INDX; # INDUCTION LOOP VARIABLE # ITEM NEXT; # NEXT ENTRY IN DATA RING # ITEM TMPINDX I; # ACB KDISPLAY ABSOLUTE INDEX # # SET TO -1 IF NOT IN VIEW # # DAYFILE MESSAGE TO ISSUE IF BAD CONNECTION NUMBER # CONTROL IFEQ DEBUG,1; ARRAY ERRMSG P(3); BEGIN ITEM BADMSG C(00,00,20) = ["NIP/RELACNB - BAD CN"]; ITEM ENDMSG U(02,00,60) = [0]; END CONTROL FI; #**********************************************************************# BEGIN CONTROL IFEQ DEBUG,1; XTRACE("RACNB") ; CONTROL FI; FOUND = FALSE; # INITIALIZE HIGHEST CN FOUND FLAG # P = ACNBADR; # ADDRESS OF ACNB TO RELEASE # CONTROL IFEQ DEBUG,1; IF P EQ 0 THEN BEGIN OMSG(ERRMSG,0); # ISSUE ERROR DAYFILE MESSAGE # ABORT(0,0) ; END CONTROL FI; AN = ACNBAN[0]; # APPLICATION NUMBER # P = ATACBA[AN]; # BASE APPL CONTROL BLOCK # P = ACBACNT[0]; # BASE APPL CONNECTION TABLE # ACNTINDX = ACNBACN[0] + ACNTHSIZE - ACNTMINACN[0]; ACNTWD[ACNTINDX] = 0; # DELETE ACNT ENTRY # IF NOT LNFLAG # NOT LOANING CONNECTION # THEN BEGIN # FREE THIS ENTRY, NOT FOR LOAN-CON # ACNTNFE[0] = ACNTNFE[0] + 1 ; # UPDATE NUMBER OF FREE ENTRY # IF ACNBACN[0] LS ACNTFFCN[0] THEN ACNTFFCN[0] = ACNBACN[0] ; # UPDATE FIRST FREE ACN # IF ACNBACN[0] EQ ACNTHCN[0] THEN # UPDATE HIGHEST CN IN USE # BEGIN # SEARCH FOR HIGHEST CN IN USE # FOR INDX = ACNTINDX - 1 STEP -1 WHILE INDX GQ ACNTHSIZE AND NOT FOUND DO BEGIN IF ACNTWD[INDX] NQ 0 THEN # HIGHEST CN FOUND # BEGIN ACNTHCN[0] = INDX + ACNTMINACN[0] - ACNTHSIZE; FOUND = TRUE; # SET HIGHEST CN IN USE FOUND FLAG # END END IF NOT FOUND THEN # THERE ARE NO ENTRIES IN ACNT # ACNTHCN[0] = 0; END END # FREE THIS ENTRY, NOT FOR LOAN-CON # # CHECK IF ACNT CAN BE SHRUNK# IF (ACNTNFE[0] GQ MINACNTFE) AND (ACNTBS[0] - (ACNTHCN[0] - ACNTMINACN[0]) - ACNTHSIZE - 1) GQ ACNTESIZE THEN # SHRINK ACNT # BEGIN NEWSIZE = ACNTBS[0] - ACNTESIZE; # SIZE TO REDUCE ACNT TO # MREDUCE(P,NEWSIZE); # SHRINK ACNT # ACBACNT[0] = P; # UPDATE ACNT ADDRESS # ACNTNFE[0] = ACNTNFE - ACNTESIZE; # UPDATE NO. FREE ENTRIES # END ACBNCN[0] = ACBNCN[0] - 1; # DECREMENT NO. OF CONN IN ACB # IF KDIS$RT AND ACBKNDX[0] NQ 0 AND ACBKNDX[0] GQ KDAPPST[0] AND ACBKNDX[0] LQ KDAPPND[0] THEN BEGIN TMPINDX=ACBKNDX[0]-KDAPPST[0]; KPUT(KHDRNP[0],TMPINDX,KPAPNCN,ACBNCN[0]) ; END ELSE TMPINDX=-1; IF NOT SWFLAG AND P NQ 0 THEN # NOT A CONNECTION SWITCH # BEGIN # RELEASE DATA RING # P = 0; CURR = ACNBDRFP[0]; # FIRST ENTRY IN DATA RING # FOR CURR = CURR WHILE CURR NQ LOC(ACNBDRFP[0]) AND CURR NQ 0 DO BEGIN NEXT = NEXTPTR[CURR]; # NEXT ENTRY IN DATA RING # MRELS(CURR); # RELEASE DATA RING ENTRY # CURR = NEXT; END IF ACNBBLKSQ[0] NQ 0 THEN # DATA QUEUED TO ACNB # BEGIN HUPDDAW(P,P,-ACNBBLKSQ[0],-ACNBBLKSQ[0]); DELCDR(P); # DELETE ACNB FROM CONNECTION DATA RING # END IF ACNBNCNB[0] NQ 0 THEN # NCNB EXISTS # BEGIN P = ACNBNCNB[0]; NCNBACNB[0] = 0; # CLEAR ACNB POINTER # END IF TMPINDX GQ 0 THEN KPUT(KHDRNP[0],TMPINDX,KPAPNDM,ACBBLKSQ[0]) ; MRELS(P); END RETURN ; # RETURN TO CALLING PROGRAM # END TERM