*DECK NVFASPC
USETEXT TEXTNVF
USETEXT TEXTSS
USETEXT TXTANVF
USETEXT TXTAPSS
USETEXT TXSMNVF
USETEXT TXTSUSS
PROC NVFASPC;
# TITLE - NVFASPC - SWITCH A-A PENDING CONNECTION #
BEGIN # NVFASPC #
#
** NVFASPC - SWITCH A-A PENDING CONNECTION.
*
* C. BRION 83/04/27.
*
* THIS PROCEDURE IS RESPONSIBLE FOR EITHER SWITCHING OR TERMINATING
* PENDING A-A CONNECTIONS THAT HAVE BEEN AWAITING THE NETON OF THE
* REQUESTED APPLICATION.
*
* PROC NVFASPC
*
* ENTRY
*
* THE NETON NORMAL OR ABNORMAL RESPONSE SM RESIDES IN MSGBUF AND
* ABHBUF.
*
* EXIT
*
* A-A CONNECTIONS PENDING CONNECTION TO THE "STARTED" APPLICATION
* ARE EITHER SWITCHED TO THE APPLICATION OR ENDED VIA THE ISSUE
* OF THE CR/RAP/A SM.
*
* APPLICATION DEPARTURE PROCESSING MAY BE PERFORMED IN THE CASE OF
* OF ABNORMAL NETON RESPONSE.
*
*
* AN ACCOUNT MESSAGE MAY BE ISSUED IN THE ABNORMAL NETON CASE.
*
* THE PAAC ENTRY AND ASSIGNED VCB ORDINAL WILL BE RELEASED IN
* THE ABNORMAL NETON CASE FOR EACH PENDING A-A CONNECTION VIA
* A CALL TO NVFACTC.
*
#
CONTROL EJECT;
#
**** NVFASPC XREF LIST
#
XREF
BEGIN
PROC NVFUMQE; # MAKE QUEUE ENTRY #
PROC NVFAIAM; # ISSUE ACCOUNT MESSAGE #
PROC NVFUFVO; # FREE VCB ORDINAL #
PROC SSTRTS; # SS- RELEASE TABLE SPACE #
PROC ABORT; # MACREL ABORT PROGRAM #
PROC NVFUCRS; # CHECK REQUEST START APPL #
PROC SSCATR; # SS- ACCEPT TIMER REQUEST #
PROC SSCCTR; # CANCEL TIMER REQUEST #
PROC NVFSCAD; # COMPLETE APPL DEPARTURE #
PROC NVFACTC; # CLEANUP TERMINATED CONN #
PROC MESSAGE; # SEND DAYFILE MESSAGE #
FUNC XCOD U; # CONVERT OCTAL TO DISPLAY COD#
END
#
****
#
CONTROL EJECT;
#
* ITEM DEFINITIONS
#
ITEM PA I; # PAAC ENTRY ORDINAL #
ITEM SAS I; # SEC AST ENTRY ORDINAL #
ITEM PAS I; # PRI AST ENTRY ORDINAL #
ITEM PAENTRY I; # NUMBER PAAC ENTRIES #
ITEM ASENTRY I; # NUMBER AST ENTRIES #
ITEM MTYP I; # ACCOUNT MESSAGE TYPE #
ITEM WORK I; # SPARE WORK VARIABLE #
ITEM SECAST B; # SEC AST ENTRY INDICATOR #
ITEM MATCH B; # UNDO LOOP INDICATOR #
ITEM RSTAT I; # RETURN STATUS #
ITEM CONNREF B; # CONNECTION REFUSED FLAG #
ITEM SUCCESS B; # SET IF TIMER REQUEST IS O.K.#
ITEM VCBREL B; # RELEASE VCB FLAG #
#
** TMBBUF - TIMER REQUEST BUFFER.
*
* BUFFER FOR GENERATION OF TIMER REQUEST.
#
ARRAY TMBBUF [00:00] S(TMBSIZ$);
BEGIN
ITEM TMB$SMID S:CTQSTAT(00,00,12) = [S"SINA"];
ITEM TMB$WC U(00,48,12) = [TMBSIZ$];
ITEM TMB$ABT U(01,00,06) = [APPCMD];
ITEM TMB$CNUM U(01,18,18);
ITEM TMB$PFCSFC U(02,00,16) = [FCINA];
ITEM TMB$ACN U(02,24,12);
ITEM TMB$DELAY U(03,24,18) = [NETPTIME$];
ITEM TMB$QNUM U(03,42,18);
END
#
* THE FOLLOWING ARRAY IS USED FOR DAYFILE-ING WHEN THE REQUEST
* TO CANCEL A TIMER REQUEST FAILS.
#
ARRAY EMSG [0:0] S(7);
BEGIN
ITEM MSG$MSG1 C(00,00,30) = ["NVFASPC: CANCEL TIMER REQUEST "];
ITEM MSG$MSG2 C(03,00,20) = ["FAILED (CNUM/PA) -- "];
ITEM MSG$CNUM U(05,00,30);
ITEM MSG$SLSH C(05,30,01) = ["/"];
ITEM MSG$PA U(05,36,24);
ITEM MSG$ZBYT I(06,00,60) = [0];
END
$BEGIN
#
** ASTMSG - MISSING AST ENTRY ERROR MESSAGE.
#
ARRAY ASTMSG [00:00] S(4);
BEGIN
ITEM AMSG$MSG C(00,00,30) =
["NVFASPC: CANNOT FIND AST ENTRY"];
ITEM AMSG$ZERO U(03,00,60) = [0];
END
$END
CONTROL EJECT;
#
* DETERMINE NUMBER OF AST ENTRIES
#
ASENTRY = (ASTLNGTH/ASTSIZ$);
#
* DETERMINE NUMBER OF PAAC ENTRIES
#
PAENTRY = (PACLNGTH/PAACSIZ$);
#
* DETERMINE INDEX ORDINAL OF APPLICATION NAMED IN THE NETON
* RESPONSE (EITHER NORMAL OR ABNORMAL)
#
FOR SAS = 0 STEP 1 WHILE
((SAS LS ASENTRY) AND
(NETAN[0] NQ AST$AN[SAS]) AND
(NETANAM[0] NQ AST$PANAM[SAS]))
DO
BEGIN
END
$BEGIN
#
* IF AST ENTRY NOT FOUND, SERIOUS PROBLEM SOMEWHERE. ABORT NVF.
#
IF SAS EQ ASENTRY
THEN
BEGIN
MESSAGE(ASTMSG,0);
ABORT;
END
$END
#
* LOCATE IF NEEDED THE PRIMARY APPLICATION AST ENTRY ORDINAL.
#
SECAST = FALSE;
IF AST$PANAM[SAS] EQ AST$SANAM[SAS]
THEN
BEGIN
PAS = SAS;
END
ELSE
BEGIN
SECAST = TRUE;
MATCH = FALSE;
FOR WORK = 0 STEP 1 WHILE
((WORK LS ASENTRY) AND
(NOT MATCH))
DO
BEGIN
IF ((AST$PANAM[WORK] EQ AST$SANAM[SAS]) AND
(AST$PANAM[WORK] EQ AST$SANAM[WORK]))
THEN
BEGIN
MATCH = TRUE;
PAS = WORK;
END
END
$BEGIN
IF WORK EQ ASENTRY
THEN
BEGIN
MESSAGE(ASTMSG,0);
ABORT;
END
$END
END
#
* PERFORM OUTER FOR LOOP FOR EACH PAAC ENTRY.
#
CONNREF = FALSE;
FOR PA = 0 STEP 1 WHILE
PA LS PAENTRY
DO
BEGIN
#
* LOCATE PAAC ENTRIES THAT ARE "PENDING NETON" TO THE APPLICATION
* OF THE NETON RESPONSE.
#
IF ((PA$STATE[PA] EQ PAACST"PANETP") AND
(PA$SWAP[PA] EQ AST$SANAM[SAS]))
THEN
BEGIN
#
* CHECK IF NORMAL OR ABNORMAL NETON RESPONSE.
#
IF PFCSFC[0] EQ NETONA
THEN
BEGIN
#
* NETON ABNORMAL RESPONSE.
* CALL REFCONN TO REFUSE THE CONNECTION.
#
REFCONN;
END
ELSE # NETON NORMAL RESPONSE #
BEGIN
#
* NETON NORMAL RESPONSE RECEIVED.
* CALL NVFUCRS TO DETERMINE IF CONNECTION OK, STILL PENDING NETON
* OR UNABLE TO COMPLETE CONNECTION.
#
RSTAT = CONNOK$;
WORK = AACON$;
NVFUCRS(PAS,SAS,RSTAT,WORK);
IF RSTAT EQ CONNOK$
THEN
BEGIN
#
* OK TO MAKE CONNECTION TO APPL AT SAS.
* INCREMENT NUMBER ACTIVE AA CONNECTIONS FOR AST ENTRY.
* ISSUE ACCOUNTING MESSAGE.
* SET PAAC STATE.
* SET UP CR/RAP/N SM AND SEND.
#
AST$AACN[SAS] = AST$AACN[SAS] + 1;
IF PA$ICMCN[PA]
THEN
BEGIN
AST$ICCN[SAS] = AST$ICCN[SAS] + 1;
END
IF SAS NQ PAS
THEN
BEGIN
AST$AACN[PAS] = AST$AACN[PAS] + 1;
IF PA$ICMCN[PA]
THEN
BEGIN
AST$ICCN[PAS] = AST$ICCN[PAS] + 1;
END
END
PA$CNTIME[PA] = CTM$PDT[0];
WORK = ABAC$;
NVFAIAM(PA,WORK);
PA$STATE[PA] = PAACST"PARAP";
PA$SWAP[PA] = AST$PANAM[SAS];
PA$SWAPAN[PA] = AST$AN[SAS];
SPMSG0[1] = PA$RAPSM0[PA];
SPMSG1[1] = PA$RAPSM1[PA];
SPMSG2[1] = PA$RAPSM2[PA];
CRICT[1] = CT60TRANS;
RB[1] = TRUE;
CRVCB[1] = PA$VCB[PA];
NVFUMQE(P<CTQ>,APSM[1],APPPR$,0,LCRRAPN);
#
* SET UP AND ISSUE THE CR/SWH/R SM (SWITCH REQUEST).
#
FOR WORK = 0 STEP 1 UNTIL (MSBFNVL - 1)
DO
BEGIN
MSG$WORD[WORK] = 0;
END
PFCSFC[0] = CRSWH;
CRNACN[0] = PA$NACN[PA];
CRABL[0] = PA$ABL[PA];
CRDT[0] = PA$DT[PA];
CRSNAME[0] = " ";
CRSWHID[0] = PA$URHID[PA];
CRSWSL[0] = AASECLEV$;
CRSWDBZ[0] = PA$DBZ[PA];
CRSWUBZ[0] = PA$UBZ[PA];
CRSWAN[0] = PA$SWAPAN[PA];
NVFUMQE(P<CTQ>,APSM[0],APPPR$,0,LCRSWH);
PA$STATE[PA] = PAACST"PARAP";
#
* CANCEL TIMER REQUEST.
* CLEAR THE ACN NUMBER AND THE TIMER CANCELLATION NUMBER OF
* THE PAAC ENTRY.
#
SSCCTR(PA$CNUM[PA],SUCCESS);
$BEGIN
IF NOT SUCCESS
THEN
BEGIN
MSG$CNUM[0] = XCOD(PA$CNUM[PA]);
MSG$PA[0] = XCOD(PA);
MESSAGE(EMSG,0);
END
$END
PA$CNUM[PA] = 0;
END
ELSE IF RSTAT EQ NOCONN$ OR
RSTAT EQ MCLIMIT$
THEN
BEGIN
#
* CONNECTION NOT ALLOWED.
* CALL REFCONN TO REFUSE CONNECTION.
#
REFCONN;
END
ELSE
#
* CONNECTION MUST STILL BE PENDING NETON OF NEW SPINOFF COPY.
* SET STATE OF PAAC ENTRY TO PENDING NETON.
* SET UP AND ISSUE TIMER REQUEST FOR CONNECTION.
* SET TIMER CANCELLATION NUMBER OF PAAC ENTRY.
#
BEGIN
PA$STATE[PA] = PAACST"PANETP";
TMB$ACN[0] = PA$NACN[PA];
TMB$QNUM[0] = LOC(P<AAINPQ>);
SSCATR(TMBBUF[0]);
PA$CNUM[PA] = TMB$CNUM[0];
PA$SWAP[PA] = AST$PANAM[PAS];
END
END
END
END
#
* IF A NETON ABNORMAL RESPONSE, MUST CALL NVFSCAD TO PERFORM
* APPLICATION DEPARTURE PROCESSING.
#
IF PFCSFC[0] EQ NETONA
THEN
BEGIN
NVFSCAD(SAS);
IF PAS NQ SAS
THEN
NVFSCAD(PAS);
END
#
* CHECK IF ANY CONNECTION WAS REFUSED IN WHICH CASE THE PAAC
* ENTRY SPACE MUST BE RELEASED.
#
IF CONNREF
THEN
BEGIN
PAENTRY = PAENTRY - 1;
VCBREL = TRUE;
FOR PA = PAENTRY STEP -1 WHILE
PA GQ 0
DO
BEGIN
IF ((PA$STATE[PA] EQ PAACST"PAERR") AND
(PA$SWAP[PA] EQ AST$SANAM[SAS]))
THEN
NVFACTC(PA,VCBREL);
END
END
RETURN;
CONTROL EJECT;
PROC REFCONN;
# TITLE - REFCONN - REFUSE PENDING CONNECTION #
BEGIN # REFCONN #
#
** REFCONN - REFUSE PENDING CONNECTION.
*
* C. BRION 83/04/19.
*
* THE PURPOSE OF THIS INTERNAL PROCEDURE IS TO PERFORM THE
* PROCESSING OF A REFUSED PENDING A-A CONNECTION.
*
* REFCONN
*
* ENTRY:
*
* PA - ENTRY ORDINAL OF PAAC ENTRY.
* SECAST - FLAG INDICATING SECONDARY AST ENTRY.
* SAS - SECONDARY AST ENTRY ORDINAL.
* PAS - PRIMARY AST ENTRY ORDINAL.
* CONNREF - GLOBAL CONNECTION REFUSED FLAG.
#
CONTROL EJECT;
#
* SET UP AND ISSUE A CR/RAP/A SM FOR THE CONNECTION SINCE A
* NETON ABNORMAL RESPONSE ISSUED.
#
CONNREF = TRUE;
SPMSG0[1] = PA$RAPSM[PA];
EB[1] = TRUE;
CRRRAP[1] = RCRA"ANA";
NVFUMQE(P<CTQ>,APSM[1],APPPR$,0,LCRRAPA);
#
* SET UP AND ISSUE ACCOUNTING MESSAGE FOR REFUSED A-A CONNECTION.
#
WORK = ABAR$;
NVFAIAM(PA,WORK);
#
* SET PAAC STATE TO ERROR.
#
PA$STATE[PA] = PAACST"PAERR";
END # REFCONN #
END # NVFASPC #
TERM