*DECK NVFTCB USETEXT TEXTNVF USETEXT TXSMNVF USETEXT TXTANVF PROC NVFTCB; # TITLE NVFTCB - CONNECTION BROKEN REQUEST (CR/CB SM) # BEGIN # NVFTCB # # ** NVFTCB - CONNECTION BROKEN REQUEST (CR/CB SM). * * E. THAVIKULWAT 81/11/10 * C. BRION 83/04/11. 83/05/10. * * THIS PROCEDURE'S MAIN FUNCTION IS TO RETRIEVE THE BROKEN * CONNECTION'S TABLES AND PREPARE FOR TERMINATION. IT IS CALLED * INTO EXECUTION BY PROCEDURE *NVFTDQE*. * * PROC NVFTCB * * ENTRY: * CR/CB SM IN *MSGBUF* * * EXIT: * CONNECTION TERMINATED. * * NOTES: * 1) A CR/CB REQUEST FOR A NON-NVF CONNECTION COULD OCCUR BEFORE * OR AFTER A CR/ACC WAS RECEIVED IN RESPONSE TO THE CR/SWH * REQUEST. IF IT OCCURRED BEFORE A CR/ACC WAS RECEIVED, THEN * A *PTAC* ENTRY FOR THE CONNECTION STILL EXIST. IF IT * OCCURRED AFTER A CR/ACC WAS RECEIVED, A *PTAC* ENTRY FOR THE * CONNECTION NO LONGER EXIST, BUT A VCB ENTRY FOR THE * CONNECTION EXIST OUT ON THE VCB FILE. * 2) A CR/CB REQUEST FOR AN NVF CONNECTION COULD OCCUR BEFORE OR * AFTER A CR/SWH REQUEST WAS SENT BY *NVF*. NORMAL SITUATION * WOULD BE BEFORE A CR/SWH REQUEST WAS SENT. CR/CB REQUEST * FOR AN NVF CONNECTION AFTER A CR/SWH REQUEST WAS SENT * IMPLIES THAT NVF SENT OUT THE CR/SWH REQUEST BEFORE * REALIZING THAT THE CONNECTION WAS ALREADY BROKEN. IN BOTH * CASES A *PTAC* ENTRY STILL EXIST FOR THE CONNECTION. * * METHOD: * IF AN NVF CONNECTION IS BROKEN, GET ITS *PTAC* ENTRY. IF * STATE OF THE *PTAC* IS AWAITING VALIDATION OR VCB DATA, THEN * CONNECTION CANNOT BE TERMINATED AT THIS TIME. CHANGE STATE TO * CONNECTION BROKEN SO THE PROCESSES THAT RECEIVES THE VALIDATION * OR VCB DATA COULD PROCEED TO TERMINATE THE CONNECTION AS SOON * AS THE CIO FUNCTION COMPLETES. OTHERWISE, PROCEED TO TERMINATE * THE CONNECTION. * * IF A NON-NVF CONNECTION IS BROKEN BEFORE A CR/ACC WAS RECEIVED, * GET ITS *PTAC* ENTRY, UPDATE WITH NEW ACN, DECREMENT T-A * CONNECTION COUNT, AND TERMINATE THE CONNECTION. * * IF A NON-NVF CONNECTION IS BROKEN AFTER A CR/ACC WAS RECEIVED, * ALLOCATE SPACE FOR A NEW *PTAC* ENTRY, MAKE VCB READ REQUEST, * DECREMENT T-A CONNECTION COUNT, UPDATE *PTAC* WITH INFORMATION * RECEIVED IN THE CR/CB SM, SET STATE OF THE *PTAC* TO * AWAIT-VCB-CB, AND EXIT. # # **** PROC NVFTCB - XREF LIST. # XREF BEGIN PROC NVFSCAD; # COMPLETE APPLICATION DEPARTURE # PROC NVFTETC; # END TERMINAL CONNECTION # PROC NVFTPVD; # PREPARE TO RECEIVE VALIDATION DATA # PROC NVFTURT; # UPDATE *RAU* TABLE # END # **** # ITEM AS I; # SUBSCRIPT FOR ARRAY AST # ITEM ASENTRY I; # NUMBER AST ENTRIES # ITEM MATCH B; # EXIT LOOP VARIABLE # ITEM NENTRY I; # NUMBER OF ENTRIES IN TABLE # ITEM PRIAPP B; # PRIMARY APPLICATION INDICATOR # ITEM PT I; # SUBSCRIPT FOR ARRAY PTAC # ITEM PORD I; # PRIMARY AST ENTRY ORDIANL # CONTROL EJECT; # * DETERMINE NUMBER OF AST ENTRIES. # ASENTRY = ASTLNGTH/ASTSIZ$; # * DETERMINE WHETHER OR NOT BROKEN CONNECTION BELONGS TO NVF. # IF CRNACN[0] NQ 0 THEN # NVF CONNECTION BROKEN # BEGIN # * NVF'S CONNECTION HAS BEEN BROKEN. SEARCH *PTAC* TABLE FOR * ENTRY THAT MATCHES ON ACN. NO MATCH IMPLIES NVF SENT OUT THE * CR/SWH REQUEST BEFORE REALIZING THAT THE CONNECTION WAS BROKEN. # MATCH = FALSE; NENTRY = PTALNGTH / PTACSIZ$; # CALCULATE NUMBER OF ENTRIES # FOR PT = 0 STEP 1 WHILE (NOT MATCH AND PT LS NENTRY) DO BEGIN IF PTA$ACN[PT] EQ CRNACN[0] THEN # PTAC ENTRY FOUND # BEGIN # * IF *PTAC* STATE IS AWAITING VALIDATION (CPM56B) OR VCB * DATA, THEN CONNECTION CANNOT BE TERMINATED AT THIS TIME. * OTHERWISE, PROCEED TO END TERMINAL CONNECTION. # PTA$RC[PT] = CRRRCN[0]; # SAVE REASON CODE # IF (PTA$STATE[PT] EQ PTACST"AWTVAL") OR (PTA$STATE[PT] EQ PTACST"AWTVCBR") OR (PTA$STATE[PT] EQ PTACST"AWTVCBL") THEN # AWAITING DATA, CAN'T TERMNATE # BEGIN IF PTA$STATE[PT] EQ PTACST"AWTVAL" THEN BEGIN PTA$STATE[PT] = PTACST"CONBROK"; # CONN BROKEN STATE # END ELSE BEGIN PTA$STATE[PT] = PTACST"AWTVCBC"; # AWAIT-VCB-CB STATE # END # * IF THE CONNECTION WAS IN THE PROCESS OF BEING LOANED FROM * THE PRIMARY TO THE SECONDARY APPLICATION, CLEAR THE LOAN * STATUS FROM THE PTAC AND TREAT THIS AS A NORMAL CONNECTION * SWITCH. THIS IS TO PREVENT THE CONNECTION COUNT OF THE * PRIMARY APPLICATION FROM BEING DECREMENTED TWICE (IN * *NVFTRVD*). # IF (PTA$LRC[PT] EQ RCRC"LSA") AND (PTA$STATE[PT] EQ PTACST"AWTVCBC") THEN BEGIN PTA$LRC[PT] = 0; PTA$LCF[PT] = FALSE; END END ELSE # PROCEED TO TERMINATE CONN # BEGIN # * IF THIS IS AN INITIAL LOAN CONNECTION, DELETE THE T-A * CONNECTION COUNT FOR THE PRIMARY APPLICATION. UPDATE THE * *RAU* TABLE, IF NECESSARY. # IF PTA$LRC[PT] EQ RCRC"LSA" THEN BEGIN PRIAPP = TRUE; NVFTURT(VCB$VCB[0],PT,PRIAPP); FOR AS = 0 STEP 1 WHILE ((AS LS ASENTRY) AND (AST$AN[AS] NQ PTA$PRIAN[PT])) DO BEGIN END IF AS LS ASENTRY THEN BEGIN AST$RACN[AS] = AST$RACN[AS] - 1; NVFSCAD(AS); END END # * IF THIS IS A RETURN OF A LOANED CONNECTION FROM THE * SECONDARY TO THE PRIMARY APPL, UPDATE THE *RAU* TABLE OF * THE PRIMARY (SWITCHED) APPL, IF NECESSARY. THERE IS NO * NEED TO DECREMENT THE NUMBER OF RESERVED CONNECTIONS, AS * THIS SHOULD ALREADY HAVE BEEN DONE IN NVFTDSP. # IF PTA$LRC[PT] GR RCRC"LSA" THEN BEGIN PRIAPP = FALSE; NVFTURT(VCB$VCB[0],PT,PRIAPP); END NVFTETC(PT); # END TERMINAL CONNECTION # END MATCH = TRUE; # EXIT LOOP # END END IF NOT MATCH THEN # CR/SWH REQUEST ALREADY SENT # BEGIN # * CR/SWH ALREADY SENT. CALL *NVFTURT* TO GET *PTAC* ENTRY THAT * MATCHES ON VCB, UPDATE *RAU* TABLE IT NEEDED, SAVE ACN, * DECREMENT T-A CONNECTION COUNT, AND TERMINATE CONNECTION. * BEFORE ALL THIS CAN BE DONE, WE MUST FIRST SEARCH THE *PTAC* * TABLE FOR THE VCB ORDINAL IN THE CR/CB. IF NO MATCHING * *PTAC* ENTRY CAN BE FOUND, IT MEANS NVF HAS ALREADY INITIATED * CONNECTION TERMINATION AND THIS HAS COLLIDED WITH THE CR/CB. * IN THIS CASE THE CR/CB SHOULD BE IGNORED. THIS SEARCH IS * REDUNDANT WITH THAT PERFORMED BY *NVFTURT*, BUT IS NECESSARY * TO KEEP *NVFTURT* FROM ABORTING INAPPROPRIATELY. # FOR PT=0 STEP 1 WHILE PTA$VCB[PT] NQ CRVCB[0] AND PT LS NENTRY DO # FIND *PTAC* ENTRY # BEGIN END IF PT EQ NENTRY THEN # MUST IGNORE CR/CB/SM # RETURN; PTA$ACN[PT] = CRACN[0]; # SAVE ACN # PTA$RC[PT] = CRRRCN[0]; # SAVE REASON CODE # # * LOCATE THE AST ENTRY FOR THE PTAC ENTRY. # FOR AS = 0 STEP 1 WHILE (AS LS ASENTRY AND AST$PANAM[AS] NQ PTA$SWTAPP[PT]) DO BEGIN END # * UPDATE THE RAU TABLE, IF NEEDED. DECREMENT THE NUMBER OF T-A * CONNECTIONS FOR THE SELECTED APPLICATION. # PRIAPP = FALSE; NVFTURT(CRVCB[0],PT,PRIAPP); # UPDATE *RAU* TABLE # AST$TACN[AS] = AST$TACN[AS] - 1; # DECREMENT NUMBER OF CONN # AST$ICCN[AS] = AST$ICCN[AS] - 1; #DECREMENT NO OF INCMG CONN# NVFSCAD(AS); # COMPLETE APPLICATION DEPARTURE # # * IF THIS IS AN INITIAL LOAN, LOCATE THE AST ENTRY FOR THE PRIMARY * APPLICATION. UPDATE THE *RAU* TABLE AND DECREMENT THE NUMBER OF * RESERVED CONNECTIONS. # IF PTA$LRC[PT] EQ RCRC"LSA" THEN BEGIN PRIAPP = TRUE; NVFTURT(CRVCB[0],PT,PRIAPP); FOR AS = 0 STEP 1 WHILE (AS LS ASENTRY AND AST$AN[AS] NQ PTA$PRIAN[PT]) DO BEGIN END IF AS LS ASENTRY THEN BEGIN AST$RACN[AS] = AST$RACN[AS] - 1; NVFSCAD(AS); END END NVFTETC(PT); # END TERMINAL CONNECTION # END END ELSE # NON-NVF CONNECTION BROKEN # BEGIN # * A NON-NVF CONNECTION HAS BEEN BROKEN. NO CR/TRM SM WILL BE * SENT. DETERMINE IF CR/CB OCCURRED BEFORE ACKNOWLEDGEMENT OF * THE CR/SWH REQUEST (I.E., CR/ACC HAS NOT YET BEEN RECEIVED). # IF CRLIMBO[0] THEN # CR/CB OCCURRED BEFORE CR/ACC RECEIVED # BEGIN # * CR/CB OCCURRED BEFORE CR/ACC WAS RECEIVED SO A *PTAC* ENTRY * STILL EXIST. CALL *NVFTURT* TO FIND THE *PTAC* ENTRY AND * UPDATE *RAU* TABLE IF NEEDED. DECREMENT T-A CONNECTION * COUNT AND END TERMINAL CONNECTION. # PRIAPP = FALSE; NVFTURT(CRVCB[0],PT,PRIAPP); # UPDATE *RAU* TABLE IF NEEDED # # * LOCATE AST ENTRY FOR PTAC ENTRY THEN DECREMENT NUMBER TA * CONNECTIONS. # FOR AS = 0 STEP 1 WHILE (AS LS ASENTRY AND AST$PANAM[AS] NQ PTA$SWTAPP[PT]) DO BEGIN END AST$TACN[AS] = AST$TACN[AS] - 1; # DECREMENT NUMBER OF CONN # AST$ICCN[AS] = AST$ICCN[AS] - 1; #DECREMENT NO OF INCMG CONN# NVFSCAD(AS); # COMPLETE APPLICATION DEPARTURE # # * IF THIS WAS AN INITIAL LOAN OF A CONNECTION FROM PRIMARY TO * SECONDARY APPLICATION, LOCATE THE AST ENTRY FOR THE PRIMARY APPL * AND DECREMENT THE NUMBER OF T-A CONNECTIONS FOR THE PRIMARY APPL. * CALL *NVFTURT* TO UPDATE THE *RAU* TABLE FOR THE PRIMARY APPL, IF * NEEDED. # IF PTA$LRC[PT] EQ RCRC"LSA" THEN BEGIN PRIAPP = TRUE; NVFTURT(CRVCB[0],PT,PRIAPP); # UPDATE *RAU* TABLE # FOR AS = 0 STEP 1 WHILE (AS LS ASENTRY AND AST$AN[AS] NQ PTA$PRIAN[PT]) DO BEGIN END AST$RACN[AS] = AST$RACN[AS] - 1; # DECREMENT NO. OF CONN. # NVFSCAD(AS); END NVFTETC(PT); # END TERMINAL CONNECTION # END ELSE # CR/CB OCCURRED AFTER CR/ACC RECEIVED # BEGIN # * CR/CB OCCURRED AFTER A SUCCESSFUL SWITCH SO A *PTAC* ENTRY NO * LONGER EXIST FOR THIS CONNECTION. CALL *NVFTPVD* TO ALLOCATE * SPACE FOR A NEW *PTAC* ENTRY AND MAKE VCB READ REQUEST ENTRY * IN *VRQ* QUEUE. UPDATE *PTAC* WITH INFORMATION RECEIVED IN * THE CR/CB SM. # NVFTPVD(CRVCB[0],CRAN[0],PT); PTA$VCB[PT] = CRVCB[0]; PTA$DT[PT] = CRDT[0]; PTA$TC[PT] = CRCBTC[0]; # SAVE TERMINAL CLASS # # * SET *PTAC* STATE TO AWAIT-VCB-CB TO DIFFERENTIATE FROM * AWAITING VCB READ BECAUSE OF A RECONNECT REQUEST. # PTA$STATE[PT] = PTACST"AWTVCBC"; END END END # END NVFTCB # TERM