*DECK XSACB
USETEXT NIPDEF
USETEXT APPSTAT
USETEXT AWLNTRY
USETEXT FREETAB
USETEXT MSGIDX
USETEXT NWLHEAD
USETEXT OVERLAY
USETEXT PARAMS
USETEXT ACB
USETEXT KDIS
USETEXT KHDRX
USETEXT PT
USETEXT AT
USETEXT NBT
USETEXT PWL
USETEXT SWAPIN
USETEXT SYSTIME
PROC XSACB; # CHECK ACB STATE CHANGES #
STARTIMS;
#
*1DC XSACB
*
* 1. PROC NAME AUTHOR DATE
* XSACB E. GEE 77/07/27
*
* 2. FUNCTIONAL DESCRIPTION.
* COMPLETE PROCESSING OF NETWORK WORKLIST WHICH COULD NOT BE
* FINISHED EARLIER BECAUSE
* 1) APP SWAPPED OUT WAITING FOR NETON RESPONSE FROM CS
* 2) APP SWAPPED OUT BY OPERATING SYSTEM
* 3) APP EXECUTED A NETWAIT
*
* 3. METHOD USED.
* SCAN THROUGH APP TABLE LOOKING FOR APPLICATION CTL BLKS
* DETERMINE STATE OF EACH APPLICATION
* EVERY ACB WILL BE IN ONE OF THESE EIGHT STATES.
* 1. APP EXECUTED NETWAIT BUT WAS NOT SWAPPED OUT
* 2. APP IN NORMAL STATE
* 3. APP SWAPPED OUT BY NETWAIT
* 5. APP SWAPPED OUT BY NETWAIT - SWAPIN ISSUED
* 6. APP SWAPPED OUT BY NETON - SWAPIN ISSUED
* 7. APP SWAPPED OUT BY OPERATING SYSTEM - SWAPIN ISSUED
* 8. APP SWAPPED OUT BY OPERATING SYSTEM, BUT
* THERE IS UPLINE BLOCKS FOR IT - SWAPIN ISSUED
* CONTINUE PROCESSING DEPENDING ON STATE OF APPLICATION
* 0. RESUME APP WORKLIST PROCESSING.
* 1. CHECK IF NETWAIT TIME IS UP. IF SO, RESTART WORKLIST
* PROCESSING
* 2. DO NOTHING FOR THIS APPLICATION
* 3. CHECK IF NETWAIT TIME IS UP. IF SO, SWAPIN APPLICATION
* 4. RESTART WORKLIST PROCESSING
* FOR STATES 5-7, NIP MUST CHECK IF SWAPIN HAS BEEN COMPLETED
* AND IF SO, PROCESS SCP SWAPIN FUNCTION RETURN CODE
* IF THERE IS A NEED TO MODIFY DATA AVAILABLE
* WORD IN AIP, CALL HWRAVAL TO DO IT
* IF HWRAVAL MODIFIES DATA AVAILABLE WORD OK,
* CONTINUE PROCESSING FOR INDIVIDUAL STATE,
* 5. RESTART WORKLIST PROCESSING
* 6. COMPLETE NETON PROCESSING
* 7. RESTART WORKLIST PROCESSING
* 8. CONTINUE
* CHECK IF APPLICATION NEEDS TO BE ABORTED AND PROCESS
* ACCORDINGLY
* CHECK IF APPLICATION HAS FAILED AND PROCESS ACCORDINGLY
* CHECK IF SWAPINS WERE ISSUED FOR (NO ACB) APPLICATIONS AND
* PROCESS ACCORDINGLY
*
* 4. ENTRY PARAMETERS. NONE
*
* 5. EXIT PARAMETERS. NONE
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* APPSTAT DUMPFLG
* MSGIDX NIPDEF PWL
* OVERLAY PARAMS ACB
* SWAPIN SYSTIME AT PT
*
* 7. ROUTINES CALLED.
* HAPFAIL OVL PROCESS APPLICATION FAILURE
* HPFL OVL REISSUE SCP FUNCTION LIST
* HPNONSA OVL FINISH PROCESSING NETON OF APPLICATION
* HWLP PROCESS NWL
* HWRAVAL MODIFY DATA AVAILABLE WORD
* MRELS RELEASE BUFFER
* OSCHAPP SCHEDULE APPLICATION
* OVLCALL LOAD AND EXECUTE OVERLAY
* RDUMP DUMP NIP-S FL
* XABTAPP OVL ABORT APPLICATION
* XERRMSG OVL ISSUE DAYFILE MESSAGE
* XSAPP OVL PROCESS SWAPIN OF (NO ACB) APPLICATION
* XTRACE TRACES CALLS
* NPPWL OVL PROCESS PRU WORKLIST
*
* 8. DAYFILE MESSAGES. NONE
* * NIP/SCP ERROR RC = XXB,JOBID=XXXX*
* THIS PROCEDURE IS CALLED BY XEXEC.
*
#
STOPIMS;
#
EXTERNAL VARIABLES
#
XREF BEGIN
PROC HWLP; # PROCESS WORKLIST #
PROC NPPWL;
PROC HWRAVAL; # MODIFY DATA AVAILABLE WORD #
PROC KPUT; # UPDATE NAM STATUS DISPLAY #
PROC MRELS; # RELEASE BUFFER #
PROC OSCHAPP; # SCHEDULE AN APPLICATION #
PROC OVLCALL; # LOAD AND EXECUTE OVERLAY #
PROC ABORT ;
PROC XTRACE; # TRACE CALL #
PROC HPWAITR; # CHECK MSG AVL ON ACB OR ACNBS #
END
#
INTERNAL VARIABLES
#
ITEM INDEX; # INDEX #
ITEM APPSTATE; # STATE OF THIS APPLICATION #
ITEM CURRPWL;
ITEM NEXTPWL;
ITEM RETCODE;
ITEM SWPCHK=120;
SWITCH STATE ,STATE1,STATE2,STATE3,STATE4,STATE5,
STATE6, STATE7, STATE8;
#**********************************************************************#
BEGIN
CONTROL IFEQ DEBUG,1 ;
XTRACE("XSACB") ;
CONTROL FI;
#
LOOP TO EXAMINE ALL ACBS
#
FOR INDEX = 1 STEP 1 UNTIL ATHAN[0]
DO
BEGIN
P<ACB> = ATACBA[INDEX] ;
#
CHECK FOR MASTER REQUEST SLAVE TO ABORT FLAG IN ACB.
CHECK FOR CONDITIONAL ABORT FROM SAC/NCL SM.
#
IF P<ACB> NQ 0
THEN
BEGIN
IF ABTAPPF EQ 0
THEN
BEGIN
IF ACBMREQABT[0]
THEN
BEGIN # MASTER ALREADY REQUEST #
ABTAPPF = XMSTSLV ; # THIS APPL TO ABORT #
ACBMREQABT[0] = FALSE ;
END
ELSE
BEGIN # CHECK FOR ABT CONDITIONS #
IF ACBABTCB[0]
THEN
ABTAPPF = XCONCB ;
ELSE
BEGIN
IF ACBABTSH[0]
THEN
ABTAPPF = XSHUTDN ;
ELSE
BEGIN
IF ACBABTFC[0]
THEN
ABTAPPF = XFCINACT ;
END
END
ACBFNTABTF[0] = 0 ;
END # CHECK FOR ABT CONDITIONS #
IF ABTAPPF NQ 0
THEN
BEGIN
ABTADDR = P<ACB> ;
OVLNAME = XABTAPPP;
OVLCALL;
IF FAILADR NQ 0
THEN
BEGIN
OVLNAME = HAPFAILP;
OVLCALL;
END
TEST INDEX; # TERMINATE FROM LOOP #
END
END
END
#
STEP 0 CHECK IF XSACB SHOULD LOOK AT SPECIAL APPLICATIONS ONLY
#
IF MSG$AN GR 0 # THIS IS A CALL TO XSACB #
THEN # THAT CHECKS ONLY SOME #
BEGIN # APPLICATIONS #
IF NOT ATAMSG[INDEX] # NO MSG FOR THIS APPLICATION #
THEN
BEGIN
TEST INDEX; # SKIP THE CHECK #
END
ELSE
BEGIN
ATAMSG[INDEX] = FALSE; # CLEAR THE FLAG #
END
END
#
STEP 1 CHECK IF APPLICATION ACB
#
IF P<ACB> NQ 0
AND ATNVFF[INDEX] # APPLICATION HAS FAILED #
AND ATNVFA[INDEX] # NET/ON/A REJECTED BY NVF #
THEN
BEGIN # RELAESE THIS APPLICATION #
PARAMS1 = INDEX ;
OVLNAME = RELACBP ;
OVLCALL ;
TEST INDEX ;
END # RELEASE THIS APPLICATION #
IF P<ACB> NQ 0 # ACB EXISTS #
AND HRL NQ 0 # NAM NOT IN MAX FL CONDITION #
THEN
BEGIN
IF KDIS$RT
AND ACBKNDX[0] NQ 0
AND ACBKNDX[0] GQ KDAPPST[0]
AND ACBKNDX[0] LQ KDAPPND[0]
THEN # UPDATE APPLICATION STATUS IN STATUS DISPLAY #
KPUT(KHDRNP[0],ACBKNDX[0]-KDAPPST[0],KPAPSTWD,ATASBV[INDEX]);
#
STEP 2 DETERMINE STATE OF APPLICATION
#
ACBADDR = P<ACB>;
IF ATASBW[INDEX]
THEN # APP IS IN NETWAIT STATE BUT NOT SWPD OUT#
APPSTATE = 1;
ELSE
IF ATASBI[INDEX]
THEN # NIP WAITING FOR APP TO BE SWAPPED IN #
BEGIN
IF ATASBR[INDEX]
THEN # APP SWPD OUT BY NETWAIT - SWAPIN ISSUED #
APPSTATE = 5;
ELSE
IF ATASBS[INDEX]
OR ATPSO[INDEX]
THEN # APP SWAPPED OUT BY OPERATING SYSTEM #
APPSTATE = 7;
ELSE # APP SWAPPED OUT BY NETON #
IF ATASBO[INDEX]
THEN
APPSTATE = 6; # APP SWAPPED OUT BY NETON #
ELSE
APPSTATE = 8; # APP SWAPPED OUT, INACT, DATA AVA #
END
ELSE
IF ATASBR[INDEX]
THEN # APP SWAPPED OUT BY NETWAIT #
APPSTATE = 3;
ELSE
IF ATHRL0[INDEX]
THEN # RESUME NWL PROCESSING AFTER MAX FL IS RELIEVED #
APPSTATE = 4;
ELSE # NORMAL STATE, WAIT FOR NWL TO PROCESS #
APPSTATE = 2;
#
STEP 3 PROCESS PCB DEPENDING ON APPLICATION STATE
#
IF APPSTATE LS 5
THEN # DO NOT HAVE TO PROCESS SCP RETURN CODE #
BEGIN
#
********** BEGINNING OF CASE STATEMENT *********
#
GOTO STATE[APPSTATE];
STATE1: # CHECK IF NETWAIT TIME IS UP #
IF RTSECS GQ ACBNTL[0]
THEN # TIME IS UP - RESUME-PROCESSING #
BEGIN
ATASBW[INDEX] = FALSE;
ATASBF[INDEX] = FALSE;# CLEAR FORCE NETWAIT FLAG #
HWLP;
END
GOTO ENDPROC1;
STATE2: # DO NOTHING #
GOTO ENDPROC1;
STATE3: # CHECK IF NETWAIT TIME IS UP #
IF RTSECS GQ ACBNTL[0]
THEN # TIME IS UP - SCHEDULE APPLICATION #
BEGIN
ATASBF[INDEX] = FALSE; # CLEAR FORCE-NETWAIT FLAG #
OSCHAPP(ACBADDR);
END
GOTO ENDPROC1;
STATE4: # RESUME NWL PROCESSING AFTER MAX FL #
ATHRL0[0] = FALSE; # CLEAR MAX FL SUSPEND NWL FLAG #
HWLP; # RESUME WORKLIST PROCESSING #
GOTO ENDPROC1;
ENDPROC1:
IF ATU[INDEX]
THEN # NEED TO UPDATE DATA AVAIL WORD IN AIP #
BEGIN
ATU[INDEX] = FALSE; # CLEAR UPDATE-DATA-AVAIL FLAG #
HWRAVAL(P<ACB>,TRUE); # WRITE DATA AVAIL WORD TO AIP #
IF NOT ATU[INDEX]
THEN # DATA-AVAIL WORD HAS BEEN UPDATED #
BEGIN
HWLP; # COMPLETE PROCESSING NWL WORKLIST #
END
ELSE # APP STILL SWAPPED OUT #
BEGIN
IF NOT ATASBR[INDEX] AND NOT ATASBW[INDEX]
THEN # APP NOT SWAPPED OUT DUE TO NETWAIT #
BEGIN
ATASBS[INDEX] = TRUE; # SET SWAPPED OUT BY OS FLAG #
END
END
END
#
********** END OF CASE STATEMENT **********
#
END
ELSE # MUST PROCESS RETURN CODE OF SWAPIN CALL #
BEGIN
IF ACBSCPCB[0] EQ 1
THEN # SWAPIN CALL COMPLETED #
BEGIN
ATASBI[INDEX] = FALSE;
IF ACBSCPRC[0] NQ 0
THEN # PROCESS NONZERO RETURN CODE #
BEGIN
IF ACBSCPRC[0] EQ RCSWAPPEDOUT # UCP STILL SWAPPED OUT#
OR ACBSCPRC[0] EQ RCSWAPDELAY # UCP NOT SWAPPED IN #
THEN # APP WAS SWAPPED OUT AGAIN #
OSCHAPP(ACBADDR); # SCHEDULE APPLICATION #
ELSE
BEGIN
IF ACBSCPRC[0] EQ RCUCPGONE
OR ACBSCPRC[0] EQ RCSTCBAD
THEN # UCP NO LONGER IN SYSTEM #
FAILADR = ACBADDR;
ELSE # NIP GOT BAD RETURN CODE #
BEGIN
PARAMS1 = DFMSG07;
PARAMS2 = ACBSCPRC[0];
PARAMS3 = ACBJOBSQN[0];
OVLNAME = XERRMSGP;
OVLCALL;
ABORT(0,0) ;
END
END
END
ELSE
BEGIN
ACBID[0] = ACBIDVALUE;# ACB MOVEABLE AGAIN #
#
********** BEGINNING OF CASE STATEMENT **********
#
IF ATU[INDEX]
THEN
BEGIN # NEED TO MODIFY DATA AVAILABLE #
ATU[INDEX] = FALSE;
HWRAVAL(P<ACB>, FALSE);
END
IF NOT ATASBI[INDEX]
THEN
BEGIN # NO MORE SWAP IN IN PROGRESS #
GOTO STATE[APPSTATE];
STATE5: # APP SWAPPED OUT BY NETWAIT, RESUME OP #
ATASBR[INDEX] = FALSE;
HWLP;
GOTO ENDPROC2;
STATE6: # APP SWAPPED OUT BY NETON, RESUME #
ATASBO[INDEX] = FALSE;
OVLNAME = HPNONSAP;
OVLCALL;
IF INDEX GR ATHAN[0]
THEN # HAVE SHRUNK AT TABLE TO BELOW INDEX #
BEGIN
IF ABTAPPF NQ 0
THEN # ABORT APPLICATION #
BEGIN
OVLNAME = XABTAPPP; # NAME OF OVERLAY TO LOAD #
OVLCALL; # LOAD AND EXECUTE OVERLAY #
END
IF FAILADR NQ 0
THEN # PROCESS FAILED APPLICATION #
BEGIN
OVLNAME = HAPFAILP; # NAME OF OVERLAY TO LOAD #
OVLCALL; # LOAD AND EXECUTE OVERLAY #
END
TEST INDEX; # TERMINATE FROM LOOP #
END
GOTO ENDPROC2;
STATE7: # APP SWAPPED OUT BY OS, ACTIVE WL OR PWL #
IF ATASBS[INDEX]
THEN # APP SWAPPED OUT IN HOST WORKLIST PROC #
BEGIN
ATASBS[INDEX] = FALSE;
IF ACBFLIST[0] EQ 0
THEN
HWLP; # RESUME WL PROCESSING #
ELSE
BEGIN # FL EXIST #
OVLNAME = HPFLP;
OVLCALL;
END
END
GOTO ENDPROC2;
STATE8: # APP SWAPPED OUT BY OS, INACT, DATA AV #
HWLP; # RESUME WORKLIST PROCESSING, IF ANY #
END
ENDPROC2:
#
********** END OF CASE STATEMENT **********
#
END
END
END
#
PROCESS ACB PWL RING IF APP IS SWAPPED IN
#
IF NOT ATASBI[INDEX]
THEN # APP IS STILL SWAPPED OUT #
BEGIN
IF ATPSO[INDEX]
THEN # APP SWAPPED OUT IN PRU WORKLIST PROCESS #
BEGIN
ATPSO[INDEX] = FALSE; # CLEAR APP SWAPPED OUT FLAG #
END
#
PROCESS PWL RING FOR SWAPPED OUT APPLICATIONS
#
FOR INDEX = INDEX WHILE (ACBPWLFP[0] NQ 0) AND
(NOT ATPSO[INDEX])
DO
BEGIN
CURRPWL = ACBPWLFP[0]; # CURRENT PWL IN RING #
P<PWLHDR> = CURRPWL;
NEXTPWL = PWLNPWLFP[0]; # NEXT PWL IN RING #
#
PROCESS PWL - HOLDS A SUPERVISORY MESSAGE FOR A PRU APP
#
NPPWL(CURRPWL,RETCODE); # PROCESS PWL FROM PIP #
IF NOT ATPSO[INDEX]
THEN # APP NOT SWAPPED OUT #
BEGIN # DELINK CURRENT PWL FROM RING #
IF (PWLID[0] NQ DRIDVALUE) AND # PWL QUEUED FOR APP #
(PWLID[0] NQ POBIDVALUE) AND # PWL QUEUED DOWNLINE #
(PWLID[0] NQ PWLRIDVALUE) # PWL REQUEUED TO ACB #
THEN # OKAY TO RELEASE PWL #
BEGIN
MRELS(CURRPWL); # RELEASED PROCESSED PWL #
END
IF ACBPWLFP[0] EQ ACBPWLBP[0]
THEN # ALL PWL-S IN RING PROCESSED #
BEGIN
ACBPWLFP[0] = 0; # CLEAR PWL RING FORWARD POINTER #
ACBPWLBP[0] = 0; # CLEAR PWL RING BACKWARD POINTER #
END
ELSE # UPDATE PWL RING POINTERS #
BEGIN
ACBPWLFP[0] = NEXTPWL; # NEW FIRST ENTRY IN PWL RING #
P<PWLHDR> = NEXTPWL;
PWLNPWLBP[0] = LOC(ACBPWLBP[0]); # UPDATE BACKWARD PTR#
END
END
END
END
#
STEP 4 CHECK IF APPLICATION FAILED OR NEEDS TO BE ABORTED
#
IF ABTAPPF NQ 0
THEN # ABORT APPLICATION #
BEGIN
OVLNAME = XABTAPPP; # NAME OF OVERLAY TO LOAD #
OVLCALL; # LOAD AND EXECUTE OVERLAY #
END
IF FAILADR NQ 0
THEN # PROCESS FAILED APPLICATION #
BEGIN
OVLNAME = HAPFAILP; # NAME OF OVERLAY TO LOAD #
OVLCALL; # LOAD AND EXECUTE OVERLAY #
END
END
END # END OF FOR LOOP #
#
STEP 5 CHECK IF ANY (NO ACB) APPLICATIONS SWAPPED IN
#
IF SWAPINFP NQ 0
THEN # SWAP-IN WAS ISSUED ON (NO ACB) APP #
BEGIN
OVLNAME = XSAPPP; # NAME OF OVERLAY TO LOAD #
OVLCALL; # LOAD AND EXECUTE OVERLAY #
END
EXIT: RETURN;
END
TERM