*DECK NVFUAFV
USETEXT TXVCBNV
PROC NVFUAFV(VCBORD,ERROR);
# TITLE NVFUAFV - ASSIGNS A FREE VCB ORDINAL. #
BEGIN # NVFUAFV #
#
** NVFUAFV - ASSIGNS A FREE VCB ORDINAL.
*
* A. LIM 81/07/21
*
* THIS PROCEDURE ASSIGNS A FREE VCB IF ONE IS AVAILABLE.
*
* PROC NVFUAFV(VCBORD,ERROR)
*
* ENTRY NONE
*
* EXIT VCBORD = VCB ORDINAL ASSIGNED
* ERROR = FALSE/TRUE, ASSIGNED/NOT-AVAILABLE
*
* NOTES NONE
*
* METHOD SEARCH VCB-ORDINAL-TABLE(VOT) FOR A FREE VCB ORDINAL.
* IF FOUND, MARK IT BUSY, INCREMENT ACTIVE-VCB-COUNT
* (AVCBCNT), AND RETURN THE VALUE OF THE ORDINAL, ELSE
* EXIT WITH ERROR = TRUE.
*
#
#
**** PROC NVFUAFV XREF BEGIN.
#
XREF
BEGIN
PROC SSBFPB; # SS - FIND PRORITY BIT #
PROC SSBCBW; # SS - CLEAR BIT IN WORD #
END
#
****
#
# FORMAL PARAMETERS #
ITEM VCBORD I; # VCB ORDINAL #
ITEM ERROR B; # ERROR CODE #
# ACTUAL PARAMETERS #
ITEM WORD I; # WORD BIT IN #
ITEM BITN I; # BIT NUMBER WITHIN WORD #
FOR WORD = 0 STEP 1 UNTIL VTSIZE$ #SEARCH VOT FOR A FREE VCB #
DO
BEGIN
IF VOT$WORD[WORD] NQ 0 THEN
BEGIN # FOUND #
SSBFPB(VOT[WORD],BITN); # LOCATE THE FREE VCB #
VCBORD = 48 * WORD +BITN; # RETURN THE VCB ORDINAL #
ERROR = FALSE; # WITH NO ERROR #
SSBCBW(VOT[WORD],BITN); # MARK THE ORDINAL BUSY #
AVCBCNT = AVCBCNT + 1; # INCR COUNT OF ACTIVE VCB #
GOTO EXIT;
END
END
ERROR = TRUE;
EXIT:
RETURN;
END # NVFUAFV #
TERM