*DECK NVFSNOF
USETEXT TEXTNVF
USETEXT TEXTSS
USETEXT TXSMNVF
USETEXT TXTANVF
USETEXT TXTAPSS
USETEXT TXTSUSS
PROC NVFSNOF;
# TITLE NVFSNOF - APPL NETOFF/FAIL REQUEST (NET/OFF OR FAIL/APPL SM) #
BEGIN # NVFSNOF #
#
** NVFSNOF - APPL NETOFF/FAIL REQUEST (NET/OFF OR FAIL/APPL SM).
*
* E. THAVIKULWAT 81/12/31
*
* THIS PROCEDURE PROCESSES THE NET/OFF OR FAIL/APPL REQUEST. IT IS
* CALLED INTO EXECUTION BY PROCEDURE *NVFSDQE*.
*
* PROC NVFSNOF
*
* ENTRY:
* NET/ON OR FAIL/APPL SM IN *MSGBUF*
*
* EXIT:
* TERMINATING APPLICATION'S AST ENTRY SET TO INITIAL CONDITION.
*
* METHOD:
* SEARCH *AST* TABLE FOR A MATCH ON APPLICATION NUMBER. SEND
* APPROPRIATE UNSOLICITED STATUS MESSAGE TO *USQ* QUEUE. CLEAN
* UP APPLICATION'S *AST* ENTRY. SEND FAI/APP/N TO <AAINPQ> SO
* THAT THE PAAC ENTRIES CAN BE CLEANED UP. IF IDLE/DISABLE HOST
* HAS BEEN INITIATED AND ALL APPLICATIONS HAVE TERMINATED, ISSUE
* NETOFF TO TERMINATE NVF.
#
#
**** PROC NVFSNOF - XREF LIST.
#
$BEGIN
XREF
BEGIN
PROC ABORT; # ABORT JOB #
END
$END
XREF
BEGIN
PROC NETOFF; # TERMINATE NVF #
PROC NVFSIAM; # ISSUE APPL. STATUS ACCOUNTING MESSAGE #
PROC SSBSBF;
PROC SSTAQE; # ALLOCATE QUEUE ENTRY #
PROC NVFUMQE; # TRANSFER SM OR TEXT TO QUEUE #
END
#
****
#
*CALL SMSGNVF
ITEM ANUM I; # APPLICATION NUMBER #
ITEM AS I; # SUBSCRIPT FOR ARRAY AST #
ITEM CNST1 I; # CONSTANT ---> 1 #
ITEM CNST2 I; # CONSTANT ---> 2 #
ITEM CNST3 I; # CONSTANT ---> 3 #
ITEM I I; # LOOP VARIABLE #
ITEM MATCH B; # EXIT LOOP VARIABLE #
ITEM MTYP I; # MESSAGE TYPE #
ITEM NENTRY I; # NUMBER OF ENTRIES IN TABLE #
$BEGIN
#
* THE FOLLOWING ARRAY CONTAINS MESSAGE ISSUED TO NIP'S DAYFILE
* UPON NOT FINDING THE TERMINATING APPLICATION IN THE *AST* TABLE.
#
ARRAY UNAMSG[00:00] S(6);
BEGIN
ITEM UNA$PFCSFC U(00,0,16) = [HOPLG];
ITEM UNA$MSG1 C(01,00,20) = ["UNKNOWN APPLICATION "];
ITEM UNA$MSG2 C(03,00,22) = ["ATTEMPTING TERMINATION"];
END
$END
#
* DETERMINE NET/OFF OR FAIL/APPL AND GET THE APPLICATION NUMBER.
#
ANUM = NETAN[0]; # PRESET TO NET/OFF APPL NUMBER #
IF (PFCSFC[0] EQ FAIAPP)
THEN # FAIL/APPL SM #
BEGIN
ANUM = FAILAN[0]; # FAIL/APPL APPLICATION NUMBER #
END
#
* SEARCH *AST* TABLE FOR ENTRY THAT MATCHES THE APPLICATION NUMBER.
#
MATCH = FALSE;
NENTRY = ASTLNGTH / ASTSIZ$; # CALCULATE NUMBER OF ENTRIES #
FOR I = 0 STEP 1 WHILE (NOT MATCH AND I LS NENTRY)
DO
BEGIN
IF (AST$AN[I] EQ ANUM)
THEN
BEGIN
#
* APPLICATION FOUND IN *AST* TABLE. DETERMINE IF NET/OFF OR
* FAIL/APPL AND SEND APPROPRIATE UNSOLICITED STATUS MESSAGE
* TO *USQ* QUEUE.
#
AS = I; # SAVE SUBSCRIPT TO AST TABLE #
MTYP = APMSG; # PRESET TO NO HOP ALERT #
CNST1 = 1;
CNST2 = 12;
CNST3 = 60;
SSBSBF(ASMBUF,CNST1,CNST2,CNST3,"NETTED OFF");
IF (PFCSFC[0] EQ FAIAPP)
THEN
BEGIN
#
* FAIL/APPL REQUEST. IF FAILED APPLICATION IS EITHER *CS*
* OR *NS*, HOP ALERT FLAG MUST BE SET FOR THE MESSAGE.
#
CNST1 = 1;
CNST2 = 12;
CNST3 = 60;
SSBSBF(ASMBUF,CNST1,CNST2,CNST3,"FAILED ");
IF (AST$ANAM[AS] EQ "CS") OR (AST$ANAM[AS] EQ "NS")
THEN
BEGIN
MTYP = 6; # SET HOP ALERT FLAG FOR MSG #
END
END
CNST1 = 2;
CNST2 = 30;
CNST3 = 42;
SSBSBF(ASMBUF,CNST1,CNST2,CNST3,B<0,42>AST$ANAM[AS]);
NVFUMQE(P<USQ>,ASMBUF[0],MTYP,0,LMSH40$); # MSG TO QUEUE #
MATCH = TRUE;
END
END
#
* IF APPLICATION NOT FOUND IN THE *AST* TABLE
* IGNORE SM AND PROCEED TO DETERMINE IF NVF SHOULD BE TERMINATED.
#
IF (NOT MATCH)
THEN
BEGIN # APPLICATION NOT FOUND #
$BEGIN # ABORT IN DEBUG MODE #
NVFUMQE(P<OTQ>,UNAMSG[0],APPCMD,0,6); # SM TO QUEUE #
$END
END
ELSE
BEGIN # APPLICATION FOUND #
#
* CLEAR APPROPRIATE FIELDS OF APPLICATION'S *AST* ENTRY. MARK
* APPL DOWN UNTIL NET/OFF/N OR FAIL/APPL/N CAN BE SENT.
#
AST$AAL[AS] = 0;
AST$MCN[AS] = 0;
AST$DNF[AS] = TRUE;
#
* ISSUE THE APPROPRIATE APPLICATION STATUS ACCOUNTING MESSAGE
* (EITHER SANW OR SENW). SEND NET/OFF/N OR FAIL/APPL/N.
#
IF (PFCSFC[0] EQ FAIAPP)
THEN
BEGIN
NVFSIAM(AS,SANW$); # ISSUE SANW ACCOUNTING MESSAGE #
AST$AFN[AS] = TRUE;
END
ELSE
BEGIN
NVFSIAM(AS,SENW$); # ISSUE SENW ACCOUNTING MESSAGE #
AST$NON[AS] = TRUE;
END
#
* SEND FAI/APP/N TO <AAINPQ> SO THAT THE PAAC ENTRIES ASSOCIATED
* WITH THIS APPL CAN BE DELETED. THIS IS JUST A *DUMMY*
* FAI/APP/N. THE REAL THING (NET/OFF/N OR FAI/APP/N) WILL BE
* SENT TO NIP IN NVFSCAD.
#
SPMSG0[0] = 0;
WCB$SMID[0] = CTQSTAT"SFAI";
WCB$WC[0] = LAPPF + 2;
ABHABT[0] = APPCMD;
PFCSFC[0] = FAIAPPN;
FAILAN[0] = AST$AN[AS];
SSTAQE(P<AAINPQ>,WCBUF[0],ABHBUF[0],APSM[0]);
END
END # END NVFSNOF #
TERM