*DECK NVFAFAI
USETEXT TEXTNVF
USETEXT TEXTSS
USETEXT TXSMNVF
USETEXT TXTANVF
USETEXT TXTAPSS
USETEXT TXTSUSS
PROC NVFAFAI;
# TITLE NVFAFAI - ADDITIONAL FAIL/APPL PROCESSING #
BEGIN # NVFAFAI #
#
** NVFAFAI - ADDITIONAL FAIL/APPL PROCESSING.
*
* P. A. MURRAY 84/08/01
*
* THIS PROCEDURE BREAKS ALL A-A CONNECTIONS HELD BY NVF FOR THE
* APPLICATION THAT FAILED OR NETTED OFF.
*
* PROC NVFAFAI
*
* ENTRY:
* THE FAI/APP/N SM IS IN MSGBUF, AND THE WORD COUNT AND BLOCK
* HEADER WORDS ARE IN WCBUF AND ABHBUF RESPECTIVELY.
*
* EXIT:
* ALL *PAAC* ENTRIES ASSOCIATED WITH THE FAILED OR NETTED OFF
* APPLICATION HAVE BEEN RELEASED. A CR/TRM/R SM HAS BEEN SENT TO
* THE *OTQ* (OR *WBQ*) FOR EACH RELEASED *PAAC* ENTRY.
*
* METHOD:
* LOCATE THE *AST* ENTRY OF THE FAILED OR NETTED OFF APPLICATION.
* SEARCH THE *PAAC* TABLE FOR A MATCH ON APPLICATION NUMBER. FOR
* EACH *PAAC* ENTRY THAT MATCHES THE FAILED APPL, AND THAT IS
* STILL CONNECTED TO NVF, AND THAT IS NOT AWAITING VCB DATA ON A
* RECONNECT, CALL NVFCTRM TO SEND THE CR/TRM TO THE *OTQ* OR
* *WBQ*. IF THE CR/TRM WAS SENT TO ONE OF THE ABOVE MENTIONED
* QUEUES, RELEASE THE *PAAC* ENTRY AND OTHER RELATED TABLES.
#
#
**** PROC NVFAFAI - XREF LIST
#
$BEGIN
XREF
BEGIN
PROC ABORT; # ABORT JOB #
PROC MESSAGE; # SEND MESSAGE TO DAYFILE #
END
$END
XREF
BEGIN
PROC NVFACTC; # CLEAN UP TERMINATING CONN TBLS#
PROC NVFCTRM; # PROCESS CR/TRM SM #
PROC NVFSCAD; # COMPLETE APPLICATION DEPARTURE#
PROC NVFUMQE; # TRANSFER SM TO QUEUE #
END
$BEGIN
#
* NOPRIMSG - NO PRIMARY AST ENTRY WAS FOUND.
#
ARRAY NOPRIMSG [00:00] S(4);
BEGIN
ITEM NO$MSG C(00,00,32) =
[" NVFAFAI - NO PRIMARY AST ENTRY."];
ITEM NO$ZERO U(03,12,48) = [0];
END
$END
DEF RCAPF$ #24#; # REASON CODE FOR APPL FAILED #
ITEM AORD I; # AST ENTRY ORDINAL #
ITEM NENTRY I; # NUMBER OF ENTRIES IN TABLE #
ITEM NORMTRM B; # FALSE, CR/TRM FROM INNER LAYER#
ITEM PAC I; # PAAC ENTRY ORDINAL #
ITEM PORD I; # PRIMARY AST ENTRY ORDINAL #
ITEM SECFLAG B; # TRUE IF SEC. AST ENTRY #
ITEM SENT B; # TRUE IF CR/TRM SENT TO QUEUE #
ITEM VCBREL B; # SET TRUE TO RELEASE VCB #
CONTROL EJECT;
#
* CALCULATE NUMBER OF AST ENTRIES.
#
NENTRY = ASTLNGTH / ASTSIZ$;
#
* LOCATE AST ENTRY OF FAILED OR NETTED OFF APPL.
#
FOR AORD = 0 STEP 1 WHILE
((AST$AN[AORD] NQ FAILAN[0]) AND
(AORD LS NENTRY))
DO
BEGIN
END
#
* IF THE AST ENTRY IS NOT FOUND, THE NET/OFF/N OR FAI/APP/N HAS
* ALREADY BEEN SENT. IGNORE THIS SM AND RETURN.
#
IF AORD EQ NENTRY
THEN
BEGIN
GOTO ENDEXIT;
END
#
* CHECK IF THIS IS A SECONDARY APPLICATION. IF SO, DETERMINE THE
* PRIMARY APPLICATION ORDINAL.
#
SECFLAG = FALSE;
IF AST$SANAM[AORD] NQ AST$PANAM[AORD]
THEN
BEGIN
FOR PORD = 0 STEP 1 WHILE
(PORD LS NENTRY) AND
(AST$PANAM[PORD] NQ AST$SANAM[AORD])
DO
BEGIN
END
$BEGIN
IF PORD EQ NENTRY # IF NO PRI APPL FOUND, ABORT #
THEN
BEGIN
MESSAGE(NOPRIMSG,0);
ABORT;
END
$END
IF PORD LS NENTRY
THEN
BEGIN
SECFLAG = TRUE;
END
END
#
* WHILE A-A CONNECTIONS EXIST FOR THIS APPLICATION, SEARCH THE PAAC
* TABLE FOR ALL ENTRIES TRYING TO ACCESS THE FAILED APPLICATION.
#
NORMTRM = FALSE;
VCBREL = TRUE;
NENTRY = PACLNGTH / PAACSIZ$;
FOR PAC = 0 STEP 1 WHILE
(PAC LS NENTRY) AND (AST$AACN[AORD] GR 0)
DO
BEGIN
#
* IF THIS PAAC ENTRY IS TRYING TO ACCESS THE FAILED APPLICATION,
* AND THE CR/SWH/N HAS NOT YET BEEN RECEIVED, AND THE PAAC IS NOT
* AWAITING VCB DATA ON A RECONNECT, THEN UPDATE THE AST ENTRY,
* SEND CR/TRM/R, AND RELEASE PAAC ENTRY.
#
IF (PA$SWAPAN[PAC] EQ AST$AN[AORD]) AND
(PA$NACN[PAC] NQ 0) AND
(PA$STATE[PAC] NQ PAACST"PARCN")
THEN
BEGIN
#
* SET UP THE CR/TRM/R SM.
#
WCB$SMID[0] = CRTRM;
WCB$WC[0] = LCRTRM + 2;
ABHABT[0] = APPCMD;
ABHADR[0] = 0;
ABHTLC[0] = LCRTRM;
ABHACT[0] = ACCR;
SPMSG0[0] = 0;
PFCSFC[0] = CRTRM;
RC[0] = RCAPF$;
CRNACN[0] = PA$NACN[PAC];
#
* SEND THE CR/TRM TO NIP (BY-PASSING THE *CTQ*).
#
NVFCTRM(NORMTRM, SENT);
#
* IF THE CR/TRM WAS SENT (A CR/SWH/N HAS NOT COME IN AND DELETED
* THE ACN ENTRY), CLEAN UP THE AST ENTRY AND PAAC TABLE.
#
IF SENT
THEN
BEGIN
#
* DECREMENT THE NUMBER OF A-A CONNECTIONS FOR THE SECONDARY
* AST ENTRY AND FOR THE PRIMARY AST ENTRY IF THEY ARE NOT THE
* SAME ENTRY. ALSO DECREMENT THE NUMBER OF THE INCOMING
* CONNECTIONS IF THIS IS AN INCOMING CONNECTION.
#
AST$AACN[AORD] = AST$AACN[AORD] - 1;
IF PA$ICMCN[PAC]
THEN
BEGIN
AST$ICCN[AORD] = AST$ICCN[AORD] - 1;
END
IF SECFLAG
THEN
BEGIN
AST$AACN[PORD] = AST$AACN[PORD] - 1;
IF PA$ICMCN[PAC]
THEN
BEGIN
AST$ICCN[PORD] = AST$ICCN[PORD] - 1;
END
END
#
* CALL NVFACTC TO RELEASE THE PAAC ENTRY AND OTHER RELATED
* TABLES.
#
NVFACTC(PAC,VCBREL);
#
* DECREMENT ENTRY COUNT AND INDEX TO TAKE INTO ACCOUNT THE
* DELETION OF THE PAAC ENTRY.
#
NENTRY = NENTRY - 1;
PAC = PAC - 1;
END
END
END
#
* COMPLETE APPLICATION DEPARTURE FOR THE FAILED APPLICATION. IF
* THIS IS A SECONDARY APPLICATION, THEN COMPLETE APPLICATION
* DEPARTURE FOR THE PRIMARY APPLICATION, ALSO.
#
NVFSCAD(AORD);
IF SECFLAG
THEN
BEGIN
NVFSCAD(PORD);
END
ENDEXIT:
END
TERM