*DECK NVFVWVF
USETEXT TEXTNVF
USETEXT TXVCBNV
PROC NVFVWVF(SWTESS);
# TITLE NVFVWVF - WRITE THE VCB FILE. #
BEGIN # NVFVWVF #
#
** NVFVWVF - WIRTES THE VCB DATA FROM VWBT BACK TO THE VCB FILE.
*
* A. LIM. 81/12/04.
*
* THIS PROCEDURE WRITES THE VCB DATA FROM *VWBT* BACK TO THE
* VCB FILE.
*
* PROC NVFVWVF(SWTESS)
*
* ENTRY *VWBT* (VCB WRITE BLOCK TABLE)IN TEXTNVF CONTAINS
* BLOCKS(PRUS) OF VCB DATA.
* *ICFLAG* IS A FLAG INDICATING IF THIS IS INITIAL CALL
* OF THIS PROC.
* *VWBTIDX* AND *MXVWBTIDX* IS THE CURRENT INDEX OF VWBT
* AND THE MAXIMUM INDEX OF VWBT RESPECTIVELY.
*
* EXIT FORMAL RETURN PARAMETER ARRAY SWTESS IS SET AS FOLLOWS:
* - IF ALL DATA IN *VWBT* HAVE BEEN WRITTEN TO VCB FILE,
* SWTESS IS SET SO THAT PROC *NVFVRVF* IS CALLED WHEN
* *VRQ* NOT EMPTY.
* - WHEN WAITING FOR CIO FUNCTION REWRITR TO COMPLETE,
* SWTESS IS SET SUCH THAT THIS ROUTINE WILL AGAIN BE
* CALLED WHEN THE FET COMPLETE BIT IS SET.
*
* METHOD THIS PROC PROCESSES ONE BLOCK OF DATA FROM *VWBT* AT A
* TIME. EACH TIME, IT WILL ISSUE A CIO REWRITR
* FUNCTION TO REWRITE DATA FROM *VWBT* BACK TO DISK
* FILE, THEN GOES TO SLEEP WAITING FOR THE CIO FUNCTION
* TO COMPLETE. IT KEEPS PROCESSING DATA IN THIS MANNER
* UNTIL *VWBT* IS EXHAUSTED.
#
#
**** PROC NVFVWVF - XREF LIST BGEGIN.
#
XREF
BEGIN
PROC ABORT; # MACREL - ABORT TASK #
PROC MESSAGE; # MACREL - ISSUE MESSAGE #
PROC NVFVRVF; # NVF - READ VCB FILE #
PROC REWRITR; # MACREL - REWRITE END OF RECORD #
PROC SSTATS; # SS-ALLOCATE TABLE SPACE (DECRS OR INCRS)#
PROC WRITEW; # MACREL - WRITE DATA FROM WORKING BUFFER #
END
#
****
#
# ITEM #
ITEM I I; # INDUCTION VARIABLE #
ITEM ICFLAG B=TRUE; # FLAG SET IF THIS IS INIT CALL OF PROC #
ITEM VWBTIDX I; # CURRENT INDEX OF VWBT #
ITEM MXVWBTIDX I; # MAX VALUE OF THE ABOVE INDEX #
$BEGIN
#
* DAYFILE MESSAGE ARRAY: "VWBT EMPTY - FALSE INVOKE OF NVFVWVF".
#
ARRAY VWMSG[00:00] S(4);
BEGIN
ITEM VW$MSG C(00,00,36)
= ["VWBT EMPTY - FALSE INVOKE OF NVFVWVF"];
ITEM VW$ZERO U(03,18,42) = [0]; # ZERO BYTE TERMINATOR #
END
$END
*CALL SWTESS
CONTROL EJECT;
IF VWBLNGTH NQ 0
THEN
BEGIN # LOOKING GOOD. VWBT NOT EMPTY #
IF ICFLAG
THEN
BEGIN # INITIAL CALL OF THIS PROC #
VWBTIDX = 0;# INIT VWBT INDEX TO 0 #
MXVWBTIDX = VWBLNGTH/VBRECDN$; # CALC MAX VALUE OF VWBT INDX#
ICFLAG = FALSE; # CLEAR INITIAL CALL FLAG #
END
IF VWBTIDX LS MXVWBTIDX
THEN
BEGIN # MORE DATA TO PROCESS #
WRITEW(VCBFET,VWBT[VWBTIDX],VBRECDN$); # TRFR DATA TO C-BUF #
VB$W[0] = TRUE; # SET W IN VCB FET #
VB$RR[0] = VWB$RPA[VWBTIDX] + 1; # SET RR IN VCB FET #
REWRITR(VCBFET,VBLNEOR$); # REWRITE DATA BACK TO VCB FILE #
VWBTIDX = VWBTIDX + 1; # BUMP VWBT INDEX #
# WAKE THIS PROC UP AGAIN WHEN CIO REWRITR COMPLETES. #
STE$ADDR1[0] = LOC(VCBFET);
STE$ADDR2[0] = 0;
STE$RTN[0] = LOC(NVFVWVF);
STE$INIT1[0] = VB$WORD[0];
STE$CBIT1[0] = FALSE;
STE$INIT2[0] = 0;
RETURN; # EXIT #
END
ELSE
BEGIN # DONE PROCESSING VWBT #
SSTATS(P<VWBT>, -VWBLNGTH); # CLEAR VWBT #
END
END
ELSE
BEGIN
$BEGIN # VWBT EMPTY #
MESSAGE(VWMSG[0],DFILE$);
ABORT;
$END
END
#
* SET-UP TO INVOKE NVFVRVF.
#
ICFLAG = TRUE; # RESET FLAG FOR NEXT FRESH START-UP #
STE$ADDR1[0] = LOC(INVVRVF); # WATCH INTERRUPT CELL FOR VRQ #
STE$ADDR2[0] = 0; # AND WATCH ONLY ONE CELL #
STE$RTN[0] = LOC(NVFVRVF); # WAKE NVFVRVF UP WHEN VRQ NQ 0 #
STE$INIT1[0] = 0;
STE$INIT2[0] = 0;
END # NVFVRVF #
TERM