*DECK NVFSCAD
USETEXT TEXTNVF
USETEXT TXINNVF
USETEXT TXSMNVF
USETEXT TXTAPSS
USETEXT TXTSUSS
PROC NVFSCAD( AS );
# TITLE NVFSCAD - COMPLETE APPLICATION DEPARTURE. #
BEGIN # NVFSCAD #
#
** NVFSCAD - COMPLETE APPLICATION DEPARTURE.
*
* S. H. FISCHER. 82/03/16.
* A. LIM. 82/07/15.
* A. LIM. 82/27/27.
* C. BRION 83/04/12,83/10/20.
*
* THIS PROC SENDS NET/OFF/N AND FAIL/APPL/N SM S.
* IF THE APPLICATION IS DOWN AND THE CONNECTION COUNTS ARE ZERO
* THEN THE APPROPRIATE SM CAN BE SENT.
* EACH PLACE THE CONNECTION COUNTS ARE DECREMENTED MUST CALL
* THIS ROUTINE.
*
* ENTRY:
* AS = AST INDEX FOR APPLICATION.
* FLAGS IN AST ENTRY AST$DNF, AST$NON, AST$AFN SET AS NEEDED.
*
* EXIT:
* NET/OFF/N OR FAIL/APPL/N SENT IF NEEDED.
*
#
#
**** PROC NVFSCAD XREF LIST.
#
XREF
BEGIN
PROC ABORT; # ABORT MACREL ROUTINE #
PROC NVFUMQE; # TRANSFER SM OR TEXT TO QUEUE #
PROC SSSAWR; # ACCEPT WORKLIST REQUEST #
PROC SSTRTS; # SS - RELEASE TABLE SPACE #
END
#
****
#
ITEM AS I; # AST INDEX #
ITEM FAILED$ B; # APPL FAILED INDICATOR #
ITEM I I; # LOOP INDUCTION VARIABLE #
ITEM MATCH B; # LOOP EXIT VARIABLE #
ITEM PORD I; # PRIMARY AST ORDINAL #
ITEM NETOFF$ B; # APPL NETOFF INDICATOR #
ITEM SECFLAG B; # SECONDARY AST FLAG #
CONTROL EJECT;
#
* INITIALIZE LOCAL FLAGS.
* CHECK IF CONNECTIONS EXIST TO APPLICATION.
#
NETOFF$ = FALSE;
FAILED$ = FALSE;
SECFLAG = FALSE;
#
* CHECK IF THERE ARE NO OUTSTANDING T-A, A-A, OR RESERVED
* CONNECTIONS FOR THE APPLICATION, OR, IF THE APPL HAS NETTED OFF
* OR FAILED, CHECK IF THERE ARE NO OUTSTANDING T-A OR A-A
* CONNECTIONS.
#
IF ((AST$TACN[AS] EQ 0) AND
(AST$AACN[AS] EQ 0) AND
(AST$RACN[AS] EQ 0))
OR
((AST$NON[AS] OR AST$AFN[AS]) AND
(AST$TACN[AS] EQ 0) AND
(AST$AACN[AS] EQ 0))
THEN
BEGIN
SPMSG0[1] = 0;
IF AST$NON[AS]
THEN
BEGIN
PFCSFC[1] = NETOFFN;
NETAN[1] = AST$AN[AS];
AST$DNF[AS] = FALSE;
NVFUMQE( P<OTQ>, APSM[1], APPCMD, 0, LNETOFF );
AST$JSN[AS] = " ";
NETOFF$ = TRUE;
AST$NON[AS] = FALSE;
END
IF AST$AFN[AS]
THEN
BEGIN
PFCSFC[1] = FAIAPPN;
FAILAN[1] = AST$AN[AS];
AST$DNF[AS] = FALSE;
NVFUMQE( P<OTQ>, APSM[1], APPCMD, 0, LAPPF );
AST$JSN[AS] = " ";
FAILED$ = TRUE;
AST$AFN[AS] = FALSE;
END
#
* CHECK IF SECONDARY APPLICATION. IF SO, CHECK IF ACTIVE AND IF SO,
* DECREMENT THE NUMBER ACTIVE COPIES FOR THE PRIMARY AST ENTRY.
* IF NOT ACTIVE, DECREMENT THE NUMBER PENDING COPIES OF THE PRIMARY
* AST ENTRY AND RESET THE SECONDARY NETON PENDING FLAG.
#
IF AST$SANAM[AS] NQ AST$PANAM[AS]
THEN
BEGIN
FOR PORD = 0 STEP 1 WHILE
(PORD LS (ASTLNGTH/ASTSIZ$) AND
(AST$PANAM[PORD] NQ AST$SANAM[AS]))
DO
BEGIN
END
$BEGIN
IF PORD EQ (ASTLNGTH/ASTSIZ$)
THEN
ABORT;
$END
SECFLAG = TRUE;
IF ((AST$AN[AS] NQ 0) AND
(NETOFF$ OR FAILED$))
THEN
BEGIN
AST$CUCOP[PORD] = AST$CUCOP[PORD] - 1;
END
ELSE IF AST$AN[AS] EQ 0
THEN
AST$SNPF[PORD] = FALSE;
IF NETOFF$ OR FAILED$
THEN
BEGIN
AST$AN[AS] = 0;
AST$RACN[AS] = 0;
END
#
* RELEASE THE SECONDARY AST TABLE ENTRY ONLY IF THE APPL
* HAS NETTED OFF, FAILED OR NEVER CAME ACTIVE.
#
IF AST$AN[AS] EQ 0
THEN
BEGIN
AS = AS * ASTSIZ$;
SSTRTS(P<AST>,AS,ASTSIZ$);
END
END # IF AST$SANAM #
#
* ZERO THE APPLICATION NUMBER IF NETON OR FAIL SM SENT AND
* NOT A SECONDARY APPLICATION ENTRY. ZERO THE NUMBER OF RESERVED
* CONNECTIONS, AS THIS FIELD MAY NOT BE ZERO.
#
IF (NETOFF$ OR FAILED$) AND NOT SECFLAG
THEN
BEGIN
AST$CUCOP[AS] = 0;
AST$AN[AS] = 0;
AST$RACN[AS] = 0;
END
#
* IF IDLE/DISABLE HOST HAS BEEN INITIATED AND ALL APPLICATIONS HAVE
* TERMINATED, COMPLETE NVF EXECUTION.
#
IF (NVFSTATE)
THEN # IDLE/DISABLE HOST INITIATED #
BEGIN
MATCH = FALSE;
FOR I = 0 STEP 1 WHILE (NOT MATCH)
AND (I LS ASTLNGTH/ASTSIZ$)
DO
BEGIN
IF (AST$AN[I] NQ 0)
THEN
BEGIN # STILL HAVE ACTIVE APPLICATION #
MATCH = TRUE;
END
END
IF (NOT MATCH)
THEN # ALL APPLICATIONS TERMINATED #
BEGIN
SSSAWR(WWDF"NICNE"); # COMPLETE NVF EXECUTION #
END
END
END
END # NVFSCAD #
TERM