*DECK NVFATAC
USETEXT TEXTNVF;
USETEXT TEXTSS;
USETEXT TXSMNVF;
USETEXT TXTANVF;
USETEXT TXTAPSS;
USETEXT TXTSUSS;
PROC NVFATAC;
# TITLE NVFATAC - TERMINATE A-A CONNECTION #
BEGIN # NVFATAC #
#
** NVFATAC - TERMINATE A-A CONNECTION.
*
* C. BRION 82/06/03, 83/12/12.
*
* THIS PROCEDURE PROCESSES THE CR/CB/U, CR/RCN/R AND FC/INACT
* (TIMEOUT) SMS.
*
* PROC NVFATAC
* ENTRY:
* THE INPUT SM RESIDES IN MSGBUF.
*
* EXIT:
* THERE ARE THREE POSSIBLE EXIT CONDITIONS:
* 1) WHEN A CR/CB FOR A NON-NVF CONNECTION OR A CR/RCN IS
* RECEIVED, A VCB READ REQUEST IS MADE AND THE PAAC ENTRY
* CREATED.
*
* 2) WHEN A CR/CB FOR A NVF CONNECTION IS RECEIVED, A CR/TRM
* SM IS ISSUED, THE NUMBER OF A-A CONNECTIONS FOR THE AP-
* PLICATION IS DECREMENTED, APPLICATION DEPARTURE PROCESSING
* IS PERFORMED, A CALL TO PROCEDURE NVFACTC IS MADE
* IN ORDER TO RELEASE THE ACTIVE PID TABLE (IF NEEDED),
* RELEASE THE PAAC ENTRY AND RELEASE THE VCB ORDINAL.
*
* 3) WHEN A TIMEOUT IS RECEIVED, A CR/RAP/A SM IS ISSUED FOR THE
* CONNECTION ONLY IF THE CANCELLATION NUMBER AND ACN OF THE
* TIMEOUT SM AND A PAAC ENTRY MATCH.
* THE NUMBER OF PENDING A-A CONNECTIONS OF THE PAAC ENTRY IS
* DECREMENTED AND APPLICATION DEPARTURE PROCESSING IS PERFORMED.
* A CALL IS THEN MADE TO NVFACTC AS STATED ABOVE.
#
CONTROL EJECT;
#
**** PROC NVFATAC XREF LIST
#
XREF
BEGIN
PROC ABORT; # MACREL - ABORT TASK #
PROC MESSAGE; # ISSUE MESSAGE TO DAYFILE #
PROC SSTRTS; # SS-REMOVE TABLE SPACE #
PROC SSTATS; # SS - ALLOCATE TABLE SPACE #
PROC NVFAPVD; # PREPARE VCB REQUEST #
PROC NVFSCAD; # COMPLETE APPL DEPARTURE #
PROC NVFUMQE; # MAKE QUEUE ENTRY #
PROC NVFUFVO; # FREE UP VCB ORDINAL #
PROC NVFACTC; # CLEANUP TERMINATING CONN #
END
#
****
#
#
* ITEM DEFINITIONS.
#
ITEM PAC I; # PAAC ENTRY ORDINAL #
ITEM NENTRY I; # NUMBER TABLE ENTRY VAR #
ITEM VCBIN I; # VCB ORDINAL #
ITEM ANIN I; # APPL NUMBER #
ITEM AORD I; # APPL AST ORDINAL #
ITEM ASENTRY I; # NUMBER AST ENTRIES #
ITEM PORD I; # PRIMARY APPL AST ORDINAL #
ITEM VCBREL B; # VCB RELEASE FLAG #
$BEGIN
#
* NOAST - NO AST ENTRY WAS FOUND.
#
ARRAY NOAST [00:00] S(4);
BEGIN
ITEM NO$MSG C(00,00,31) =
[" NVFATAC - AST ENTRY NOT FOUND."];
ITEM NO$ZERO U(03,06,54) = [0];
END
$END
CONTROL EJECT;
#
*
* MAIN NVFATAC PROCEDURE START
*
#
ASENTRY = ASTLNGTH/ASTSIZ$;
VCBREL = TRUE;
#
* CHECK IF TIMEOUT. IF SO, PROCEED TO LOCATE PAAC ENTRY.
#
IF WCB$SMID[0] EQ CTQSTAT"SINA"
THEN
BEGIN
NENTRY = PACLNGTH/PAACSIZ$;
FOR PAC = 0 STEP 1 WHILE
NOT (PA$NACN[PAC] EQ FCACN[0] AND PA$CNUM[PAC] EQ ABHABN[0])
AND (PAC LS NENTRY)
DO
BEGIN
END
IF PAC NQ NENTRY
THEN
BEGIN
#
* PAAC ENTRY FOUND, TIMEOUT IS GOOD. ATTEMPT TO FIND AST
* ENTRY OF THE PAAC ENTRY.
#
FOR AORD = 0 STEP 1 WHILE
((PA$SWAP[PAC] NQ AST$PANAM[AORD]) AND
(AORD NQ ASENTRY))
DO
BEGIN
END
IF AORD NQ ASENTRY
THEN
#
* AST ENTRY FOUND.
* PERFORM DEPARTURE PROCESSING FOR APPLICATION.
#
NVFSCAD(AORD);
#
* SEND CR/RAP/A SM.
* RELEASE PAC ENTRY, ACPID TABLE SPACE AND VCB ORDINAL VIA
* CALL TO NVFACTC.
#
SPMSG0[1] = 0;
PFCSFC[1] = CRRAPA;
CRNACN[1] = PA$NACN[PAC];
CRRRAP[1] = RCRA"ANA";
NVFUMQE(P<CTQ>,APSM[1],APPPR$,0,LCRRAPA);
NVFACTC(PAC,VCBREL);
GOTO ENDEXIT;
END
GOTO ENDEXIT;
END
#
* NOT A TIMEOUT, CONTINUE FOR CB OR RECONNECT.
* GET VCB ORDINAL AND APPL NUMBER FROM SM.
#
VCBIN = CRVCB[0];
ANIN = CRAN[0];
#
* IF THE APPLICATION NUMBER IS 1, THAT IS NVF. DO NOT LOOK FOR AN
* AST ENTRY BECAUSE NVF DOESN'T HAVE ONE. SET UP THE AST ORDINAL
* TO BYPASS FURTHER AST CHECKS.
#
IF ANIN EQ 1
THEN
BEGIN
AORD = ASENTRY;
PORD = AORD;
END
ELSE
#
* DETERMINE THE AST ORDINAL OF THE APPLICATION. CHECK IF A
* SECONDARY TYPE OF APPLICATION AND THEN DETERMINE THE PRIMARY
* AST ORDINAL.
#
BEGIN
FOR AORD = 0 STEP 1 WHILE
((AORD LS ASENTRY) AND
(AST$AN[AORD] NQ ANIN))
DO
BEGIN
END
IF AORD NQ ASENTRY
THEN
BEGIN
PORD = AORD;
IF AST$PANAM[AORD] NQ AST$SANAM[AORD]
THEN
BEGIN
FOR PORD = 0 STEP 1 WHILE
((PORD LS ASENTRY) AND
(AST$SANAM[AORD] NQ AST$PANAM[PORD]))
DO
BEGIN
END
IF PORD EQ ASENTRY
THEN
PORD = AORD;
END
END
END
#
* CHECK THE SFC OF THE INCOMING SM. IF CB (CONNECTION BROKEN),
* CHECK IF NVFS CONNECTION OR NOT.
#
IF SFC[0] EQ CB
THEN
BEGIN
IF (CRNACN[0] EQ 0 AND NOT CRLIMBO[0])
THEN
#
* NON-NVF CONNECTION HAS RECEIVED A CR/CB. ISSUE READ VCB REQUEST.
* A PAAC ENTRY CREATED AND SET THE STATE.
#
BEGIN
#
* IF NO AST ENTRY WAS FOUND, SOMETHING IS WRONG -- ABORT.
#
$BEGIN
IF (AORD EQ ASENTRY) AND
(ANIN NQ 1)
THEN
BEGIN
MESSAGE(NOAST[0],0);
ABORT;
END
$END
NVFAPVD(VCBIN,ANIN,PAC);
PA$STATE[PAC] = PAACST"PACB";
PA$IAPRC[PAC] = CRRCB[0];
PA$VCB[PAC] = VCBIN;
END
ELSE # MEMORY RESIDENT PAAC - NO CR/ACC SEEN #
#
* NVF CONNECTION NEVER REACHED THE SWITCHED STATE. A PAAC EXISTS.
* LOCATE PAAC ENTRY, THEN THE APPLICATION TABLE ENTRY BASED ON THE
* SWITCHED APPLICATION NUMBER IN THE PAAC ENTRY.
#
BEGIN
NENTRY = PACLNGTH / PAACSIZ$;
FOR PAC = 0 STEP 1 WHILE
((PAC LS NENTRY) AND (PA$VCB[PAC] NQ CRVCB[0]))
DO
BEGIN
END
#
* A PAAC ENTRY MAY NOT BE FOUND SINCE IT MAY HAVE BEEN DELETED BY
* FAIL/APPL PROCESSING. IF THIS IS THE CASE, JUST IGNORE THE CR/CB.
#
IF PAC EQ NENTRY
THEN
GOTO ENDEXIT;
#
* CHECK IF CONNECTION AWAITING VCB DATA ON RECONNECT. IF NOT,
* THEN PROCEED. OTHERWISE, THE RECONNECT VCB PROCESSING WILL
* FINISH CONNECTION PROCESSING AND ISSUE A CR/TRM/R SM.
#
IF PA$STATE[PAC] NQ PAACST"PARCN"
THEN
BEGIN
#
* IF THE APPL NUMBER IS 1 (FOR NVF), GET THE SWITCHED APPL NAME
* FROM THE PAAC ENTRY INSTEAD OF THE SM.
#
IF ANIN EQ 1
THEN
BEGIN
FOR AORD = 0 STEP 1 WHILE
(AORD LS ASENTRY) AND
(AST$PANAM[AORD] NQ PA$SWAP[PAC])
DO
BEGIN
END
IF AORD NQ ASENTRY
THEN
BEGIN
PORD = AORD;
IF AST$PANAM[AORD] NQ AST$SANAM[AORD]
THEN
BEGIN
FOR PORD = 0 STEP 1 WHILE
((PORD LS ASENTRY) AND
(AST$SANAM[AORD] NQ AST$PANAM[PORD]))
DO
BEGIN
END
IF PORD EQ ASENTRY
THEN
PORD = AORD;
END
END
END
#
* DECREMENT NUMBER OF A-A CONNECTIONS FOR THE SECONDARY
* AST ENTRY AND THE PRIMARY AST ENTRY IF NOT THE SAME ENTRY.
#
IF AORD NQ ASENTRY
THEN
BEGIN
AST$AACN[AORD] = AST$AACN[AORD] - 1;
IF AORD NQ PORD
THEN
AST$AACN[PORD] = AST$AACN[PORD] - 1;
END
#
* ISSUE A CT/TRM/R SM ONLY FOR NVF CONNECTION.
#
IF NOT CRLIMBO[0]
THEN
BEGIN
SPMSG0[1] = 0;
PFCSFC[1] = CRTRM;
RC[1] = CRRCB[0];
CRNACN[1] = CRNACN[0];
NVFUMQE(P<CTQ>,APSM[1],APPPR$,0,LCRTRM);
END
#
* CALL NVFACTC TO RELEASE ACPID TABLE SPACE, THE PAAC ENTRY AND
* THE ASSIGNED VCB ORDINAL. PROCEED TO COMPLETE APPLICATION DE-
* PARTURE FOR SECONDARY AST ENTRY AND THE PRIMARY AST ENTRY IF
* NOT THE SAME ENTRY.
#
NVFACTC(PAC,VCBREL);
IF AORD NQ ASENTRY
THEN
BEGIN
NVFSCAD(AORD);
IF AORD NQ PORD
THEN
NVFSCAD(PORD);
END
END
END
END
ELSE # CR/RCN/R SM RECEIVED #
BEGIN
#
* CR/RCN RECEIVED. CHECK IF LIMBO STATE MEANING THAT
* THE SWITCH NEVER ACTUALLY TOOK PLACE.
#
IF NOT CRLIMBO[0]
THEN
BEGIN
#
* IF NO AST ENTRY WAS FOUND, SOMETHING IS WRONG -- ABORT.
#
$BEGIN
IF (AORD EQ ASENTRY) AND
(ANIN NQ 1)
THEN
BEGIN
MESSAGE(NOAST[0],0);
ABORT;
END
$END
#
* RECONNECT FOR NON-NVF CONNECTION. MUST GET PAAC ENTRY BUILT,
* THEN ISSUE A VCB READ REQUEST FOR THE VCB DATA.
#
NVFAPVD(VCBIN,ANIN,PAC);
PA$STATE[PAC] = PAACST"PARCN";
PA$VCB[PAC] = VCBIN;
PA$IAPRC[PAC] = CRRRCN[0];
PA$NACN[PAC] = CRNACN[0];
END
#
* CHECK IF LIMBO STATE. IF SO, THEN THE CONNECTION NEVER WAS
* SUCCESSFULLY SWITCHED. A CR/ACC SM NEVER RECEIVED THEREFORE
* THE PAAC ENTRY IS STILL RESIDENT RATHER THAN ON VCB DISK FILE.
* LOCATE THE PAAC ENTRY, DECREMENT THE NUMBER OF AA CONNECTIONS
* FOR THE SWITCHED APPLICATION, ISSUE A CR/TRM SM, CALL NVFACTC
* IN ORDER TO RELEASE ACPID TABLE ENTRY FOR PAAC ENTRY, THE PAAC
* ENTRY ITSELF AND THE ASSIGNED VCB ORDINAL. COMPLETE APPLICATION
* DEPARTURE VIA CALL TO NVFSCAD.
#
IF CRLIMBO[0]
THEN
BEGIN
NENTRY = PACLNGTH / PAACSIZ$;
FOR PAC = 0 STEP 1 WHILE
((PAC LS NENTRY) AND (PA$VCB[PAC] NQ CRVCB[0]))
DO
BEGIN
END
IF PAC EQ NENTRY
THEN
GOTO ENDEXIT;
#
* DECREMENT NUMBER A-A CONNECTIONS FOR SECONDARY AST ENTRY AND
* THE PRIMARY AST ENTRY IF NOT THE SAME ENTRY.
#
IF AORD NQ ASENTRY
THEN
BEGIN
AST$AACN[AORD] = AST$AACN[AORD] - 1;
IF AORD NQ PORD
THEN
AST$AACN[PORD] = AST$AACN[PORD] - 1;
END
#
* ISSUE THE CT/TRM/R SM.
#
SPMSG0[1] = 0;
PFCSFC[1] = CRTRM;
RC[1] = CRRRCN[0];
CRNACN[1] = CRNACN[0];
CRTRAN[1] = 1;
NVFUMQE(P<CTQ>,APSM[1],APPPR$,0,LCRTRM);
#
* CALL NVFACTC AND NVFSCAD TO CLEAN THINGS UP.
#
NVFACTC(PAC,VCBREL);
IF AORD NQ ASENTRY
THEN
BEGIN
NVFSCAD(AORD);
IF AORD NQ PORD
THEN
NVFSCAD(PORD);
END
END
END
ENDEXIT:
END # NVFATAC #
TERM