*DECK HSWACNB
USETEXT ACB
USETEXT ACNB
USETEXT ACNT
USETEXT AT
USETEXT KDIS
USETEXT KHDRX
USETEXT NIPDEF
USETEXT OVERLAY
USETEXT PARAMP
USETEXT PARAMS
USETEXT SYSTIME
PRGM HSWACNB; # SWITCH ACNB FROM ONE APP TO ANOTHER #
STARTIMS;
#
*1DC HSWACNB
* 1. PROC NAME AUTHOR DATE
* HSWACNB C. BITTNER 81/12/01
*
* 2. FUNCTIONAL DESCRIPTION
* SWITCH ACNB FROM OLD APPLICATION TO NEW APPLICATION
*
* 3. METHOD
* CALL HALLOCN TO ALLOCATE A NEW CONNECTION NUMBER
* PICK UP ACNT ENTRY OF OLD CONNECTION FOR NEW ACNT ENTRY
* ASSIGN ACNB OF OLD CONNECTION AS ADDRESS OF NEW CONNECTION (ACNB)
* IF DATA QUEUED TO ACNB,
* CALL DELCDR TO DELETE ACNB FROM CONNECTION DATA RING.
* CALL RELACNB TO DELETE OLD ACN
* UPDATE FIELDS IN ACNB
* IF DATA QUEUED TO ACNB,
* CALL INSCDR TO INSERT ACNB IN CONNECTION DATA RING.
*
* 4. ENTRY PARAMETERS
* PARAMS1 ADDRESS OF OLD ACB
* PARAMS2 OLD CONNECTION NUMBER
* PARAMS3 ADDRESS OF NEW ACB
* PARAMS4 CONNECTION NO IF RETURNING LOANED CON
* PARAMS8 FLAG TO INDICATE IF CONNECTION BEING LOANED
* = FALSE IF NOT BEING LOANED.
* = TRUE IF BEING LOANED.
*
* 5. EXIT PARAMETERS
* PARAMS1 ADDRESS OF NEW ACNB
* = 0 IF NO NEW ACNB WAS ASSIGNED.
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED
* ACB
* ACNB
* ACNT
* AT
* NIPDEF
* OVERLAY
* PARAMS
* SYSTIME
*
* 7. ROUTINES AND OVERLAYS CALLED
* DELCDR DELINK ACNB FROM CONNECTION DATA TABLE
* HALLOCN - ALLOCATE NEW CONNECTION NUMBER
* HUPDDAW UPDATE DATA AVAILABLE WORD
* INSCDR INSERT ACNB IN CONNECTION DATA RING
* RELACNB RELEASE OLD ACNB
* STRTSW OVL TRIGGER ROUTINE RELACNB
* XTRACE - RECORD PROCEDURE CALL
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* THIS PROGRAM IS A SECONDARY OVERLAY CALLED BY HCSTTP.
*
* W A R N I N G - THIS PROGRAM PLUS PROCEDURE RELACNB CANNOT
* EXCEED THE SECONDARY OVERLAY BUFFER SIZE MINUS
* 5 (473B WORDS).
*
#
STOPIMS;
#
EXTERNAL VARIABLES
#
XREF
BEGIN
PROC ABORT ;
PROC DELCDR; # DELINK ACNB FROM CONNECTION DATA RING #
PROC HUPDDAW; # UPDATE DATA AVAILABLE WORD #
PROC INSCDR; # INSERT ACNB IN CONNECTION DATA RING #
PROC OVLCALL; # LOAD AND EXECUTE OVERLAY #
PROC HALLOCN ;
PROC KPUT ;
PROC RELACNB; # RELEASE OLD ACNB #
PROC XTRACE; # RECORD PROCEDURE CALL #
LABEL RJMAIN; # ADDRESS IN OVLCALL TO RETURN TO #
END
#
INTERNAL VARIABLES
#
ITEM ACN; # APPLICATION CONNECTION NUMBER #
ITEM ACNTINDX; # INDEX INTO ACNT #
ITEM INCR B; # TRUE = INCREASE NO OF DELIVERABLES#
ITEM NUMBLKS; # NUMBER OF DATA BLOCKS QUEUED TO ACNB #
ITEM OACNTINDX; # INDEX INTO OLD ACNT #
ITEM OLDACNB; # OLD ACNB #
ITEM OLDACNT; # OLD ACNT #
ITEM OLDCN; # OLD CONNECTION NUMBER #
ITEM TEMPACNT; # ACNT ENTRY OF CONNECTION #
ITEM PRIMINFO ; # PRIMARY APPLICATION INFO #
ARRAY HSWERR S(4) ;
BEGIN
ITEM HSWERR1 C(0,0,31) = [" NIP CANNOT RETURN LOANED CONN."] ;
ITEM HSWERR2 U(3,6,54) = [0] ;
END
#**********************************************************************#
BEGIN
CONTROL IFEQ DEBUG,1;
XTRACE("HSWAC") ;
CONTROL FI;
P<ACB> = PARAMS1; # ADDRESS OF OLD ACB #
OLDCN = PARAMS2; # OLD CONNECTION NUMBER #
ACN = PARAMS4; # NEW CONNECTION NUMBER IF LOANED CN#
P<ACNT> = ACBACNT[0];
OLDACNT = P<ACNT>;
OACNTINDX = OLDCN - ACNTMINACN[0] + ACNTHSIZE;
OLDACNB = ACNTACNB[OACNTINDX];
P<ACNB> = OLDACNB;
TEMPACNT = ACNTWD[OACNTINDX]; # SAVE STATES FOR CONNECTION #
IF ACN EQ 0
THEN
BEGIN # ALLOCATE THE ACN #
HALLOCN(PARAMS3,ACN); # ALLOCATE NEW CONNECTION NUMBER #
END
IF ACN NQ 0
THEN
BEGIN
PRIMINFO = ACNBPRID[0] ; # SAVE THE PRIM APPL. INFO #
NUMBLKS = ACNBBLKSQ[0];
IF NUMBLKS NQ 0
THEN # DATA QUEUED TO ACNB #
BEGIN
DELCDR(OLDACNB); # DELETE ACNB FROM CONNECTION DATA RING #
HUPDDAW(P<ACB>,P<ACNB>,-NUMBLKS,-NUMBLKS);
END
IF KDIS$RT
AND ACBKNDX[0] NQ 0
AND ACBKNDX[0] GQ KDAPPST[0]
AND ACBKNDX[0] LQ KDAPPND[0]
THEN
KPUT(KHDRNP[0],ACBKNDX[0]-KDAPPST[0],KPAPNDM,ACBBLKSQ[0]) ;
INCR = FALSE; # DECREMENT NO OF DELIVERABLE BLKS #
P<ACB> = PARAMS3; # ADDRESS OF NEW ACB #
P<ACNT> = ACBACNT[0];
ACNTINDX = ACN + ACNTHSIZE - ACNTMINACN[0];
CONTROL IFEQ DEBUG,1;
IF ACNTACNB[ACNTINDX] NQ 0
AND ACNBPRID[0] NQ 0
THEN
ABORT(HSWERR,0) ; # ACTIVE CONNECTION IN LOANED ENTRY #
CONTROL FI;
ACNTWD[ACNTINDX] = TEMPACNT; # ACNT ENTRY OF CONNECTION #
ACNTABO[ACNTINDX] = 0 ; # CLEAR THE ABO COUNT #
ACNTACNB[ACNTINDX] = OLDACNB; # SWITCH ACNB FROM NVF TO APP
OR FROM OLD APP TO NEW APP #
ACNBLO[0] = FALSE; # CLEAR LIST OFF FLAG #
RELACNB(OLDACNB,TRUE,PARAMS8); # CLEAN UP OLD ACNB INFOMATION #
# SET FIELDS IN ACNB #
P<ACNB> = OLDACNB;
ACNBAN[0] = ACBAN[0]; # APPLICATION NUMBER #
ACNBACN[0] = ACN; # APPLICATION CONNECTION NUMBER #
ACNBTLO[0] = ATDIS[ACNBAN[0]]; # UPDATE TEMP LIST OFF FLAG #
IF NUMBLKS NQ 0
THEN # DATA QUEUED TO ACNB #
BEGIN
HUPDDAW(P<ACB>,P<ACNB>,NUMBLKS,NUMBLKS);
INSCDR(P<ACNB>); # INSERT ACNB INTO CONNECTION DATA RING #
END
ACBNCN[0] = ACBNCN[0] + 1 ; # UPDATE NUMBER OF CONN TO APP#
IF KDIS$RT
AND ACBKNDX[0] NQ 0
AND ACBKNDX[0] GQ KDAPPST[0]
AND ACBKNDX[0] LQ KDAPPND[0]
THEN
KPUT(KHDRNP[0],ACBKNDX[0]-KDAPPST[0],KPAPNCN,ACBNCN[0]);
ACNBFLAGS[0] = FALSE ;
ACNBBCHK[0] = FALSE; # CLEAR BLOCK SEQUENCE CHECK FLAGS #
ACNBD[0] = ATT[ACNBAN[0]]; # DATA TRUNCATION FLAG #
ACNBH[0] = ATH[ACNBAN[0]]; # HALF DUPLEX FLAG #
ACNBINACT[0] = RTSECS[0] + INACTVAL;
ACNBPRID[0] = PRIMINFO ; # RESTORE THE PRIM APPL. INFO #
PARAMS1 = P<ACNB>; # ADDRESS OF NEW ACNB #
INCR = TRUE; # DECREMENT NO OF DELIVERABLE BLKS #
END
ELSE
BEGIN
PARAMS1 = 0; # NO NEW ACNB WAS ASSIGNED #
END
GOTO RJMAIN; # RETURN TO CALLING PROGRAM #
END
TERM