*DECK CSIBXT
USETEXT TEXTCS
USETEXT TEXTSS
USETEXT TXTAPSS
USETEXT TXTCTCS
PROC CSIBXT;
# TITLE CSIBXT - BUILD NCF CROSS REFERENCE TABLE. #
BEGIN # CSIBXT #
#
** CSIBXT - BUILD NCF CROSS REFERENCE TABLES AND NPUCB TABLE.
*
* A. LIM 81/10/16
* C. BRION 82/06/04.
* C. BRION 82/03/15.
* C. BRION 82/04/23.
*
* THIS ROUTINE IS PART OF THE INITIALIZATION PROCESS FOR CS.
* ITS JOB IS TO BUILD CROSS REFERENCE TABLE(S) FOR NCF RECORDS.
* THE NPUCB MANAGED TABLE IS ALSO INITIAILIZED FROM THE NPU
* CROSS REFERENCE TABLE OF THE NCF.
*
* PROC CSIBXT
*
* ENTRY NONE
*
* EXIT TABLE(S) BUILT.
*
#
#
**** PROC CSIBXT XREF LIST
#
XREF
BEGIN
PROC CSIIAP; # INITIALIZATION ABORT PROCEDURE #
#
** MACREL ROUTINES
#
PROC MESSAGE; # SEND MESSAGE #
PROC READ; # READ FILE TO CIO BUFFER #
PROC READW; # READ DATA TO WORKING BUFF #
PROC RECALL; # RETURN CONTROL WHEN COMPLETE#
PROC REWIND; # REWIND A FILE #
PROC SKIPB; # SKIP RECORDS BACKWARD #
PROC SKIPEI; # SKIP TO EOI #
FUNC XCDD ; # CHAR CONVERSION #
#
** END MACREL ROUTINES
#
PROC SSTAQE; # ACCEPT A QUEUE ENTRY #
PROC SSTATS; # ALLOCATES TABLE SPACE #
PROC SSTRTS; # RELEASES TABLE SPACE #
END
#
****
#
*CALL NAMLEV
# DEFS #
DEF DF$ # 0 #; # MESSAGE OPTION - DAYFILE #
DEF KEYPR$ # 2 #; # NUMBER WORDS IN NCF KEY PR #
DEF PTSIZ$ # 15 #; # PREFIX TABLE SIZE #
DEF MXRECT$ # 6 #; # NUMBER RECORDS THAT #
# NEED INITIALIZATION #
DEF NCFRTYP$ # 7 #; # NUMBER NCF RECORDS - 1 #
DEF CSLEVL$ # 5 #; # LENGTH OF CS LEVEL MSG #
DEF NCFBDTL$ # 6 #; # LENGTH OF NCF DATE AND TIME MSG #
DEF NCFTITL$ # 9 #; # LENGTH OF NCF TITILE MSG #
#
* STATUS LIST RIDSTAT.
*
* RIDSTAT INDICATES THE TYPES OF NCF RECORDS THAT ARE CURRENTLY
* INITIALIZED INTO THE CS MANAGED TABLES AND CONTROL TABLES THAT
* MUST BE READ INTO MEMORY IN ORDER TO SET UP THE APPROPRIATE
* CONTROL STRUCTURES OF THE CS PROGRAM.
*
#
STATUS RIDSTAT
LIREC, # LINE RECORD INDEX #
LLXREC, # LOG LINK XREF #
PHXREC, # PHYSICAL LINK XREF #
NPXREC, # NPU XREF #
LIXREC, # LINE XREF #
DEXREC, # DEVICE XREF #
NOXREC; # DUMMY NO MATCH ENTRY #
# ITEMS #
ITEM DBVAR; # DEBUG VARIABLE #
ITEM ADDR U; # ADDRESS CELL FOR TABLE LOC #
ITEM M,K U; # LOOP VARS #
ITEM ADDR1 U; # ADDRESS VARIABLE #
ITEM INDXLEN U; # INDEX LENGTH VAR #
ITEM FOUND B; # EXIT LOOP FLAG #
ITEM I U; # INDUCTION VARIABLES #
ITEM N U;
ITEM J U;
ITEM STATS U; # READW RETURN STATUS #
ITEM TKEYPR U; # NUMBER OF NCF KEY PAIRS #
ITEM WC U; # WORD COUNT FOR TABLE ALLOC #
ITEM WCTH U; # WCTH TABLE WORD FOR LINE #
# INDEX TABLE INITIALIZATION #
ITEM SAVEADR I; # TEMP USED TO SAVE RANDOM ADR#
ITEM SIZE U; # WORKING VAR #
# END ITEMS #
#
* SWITCH BLDTAB - SWITCH FOR BUILDING TABLES LOGIC.
#
SWITCH BLDTAB:RIDSTAT # USING RIDSTAT STATUS LIST #
BLDLIR:LIREC, # BLD LINE RECORD INDEX #
BLDLLX:LLXREC, # BLD LOG LINK XREF TABLE #
BLDPHX:PHXREC, # BLD PHY LINK XREF TABLE #
BLDNPX:NPXREC, # BLD NPU XREF AND NPUCBS #
BLDLIX:LIXREC, # BLD LINE XREF TABLE #
BLDDEX:DEXREC; # BLD DEVICE XREF TABLE #
#
* DUMMY - DUMMY BASED ARRAY
*
* DUMMY IS A ARRAY USED TO STORE AN ADDRESS INTO THE PARAMETER LIST.
#
BASED ARRAY DUMMY[00:00] S(1);;
#
* NCFMSG - NCF MESSAGE ARRAY
*
* NVFMSG CONTAINS THE FOLLOWING MESSAGE TO BE SENT TO SYSTEM DAYFILE
* LOCAL DAYFILE, AND A AND B DISPLAY.
#
ARRAY NCFMSG[00:00] S(1);
BEGIN
ITEM N$MSG C(00,00,08) = ["BAD NCF."];
ITEM N$ZERO U(00,48,12) = [0];
END
#
* NCFINDX - NCF INDEX RECORD ARRAY.
*
* NCFINDX IS AN ARRAY THAT WILL CONTAIN THE NCF INDEX RECORD.
* THE INDEX RECORD CONTAINS A TWO WORD ENTRY PER RECORD THAT
* IS WRITTEN TO THE NCF.
#
BASED ARRAY NCFINDX [00:00] S(2);
BEGIN
ITEM NCF$WORD U(00,00,60); # FULL WORD REFERENCE #
ITEM NCF$RT C(00,00,02); # RECORD TYPE #
ITEM NCF$RL U(01,00,30); # LENGTH OF RECORD #
ITEM NCF$RADDR U(01,30,30); # RELETIVE PRU ADDR OF REC #
END
#
* NCFWBF - NCF WORKING BUFFER.
*
* NCFWBF IS A WORKING BUFFER FOR THE NCF. IT IS USED TO READ THE
* NCF PREFIX AND INDEX RECORDS INTO CS. REFER TO THE NDL ERS,
* APPENDIX F FOR DEFINITION.
#
ARRAY NCFWBF [00:00] S(PTSIZ$);
BEGIN
ITEM NC$FLAG B(01,47,01); # NCF GOOD/BAD FLAG #
ITEM NC$WC U(01,48,12); # WORD CNT FOR INDEX RECORD #
ITEM NC$RT C(00,00,02); # RECORD TYPE #
ITEM NC$RNAME C(00,00,07); # RECORD NAME #
ITEM NC$RL U(01,00,30); # RECORD LENGTH INCL NAME #
ITEM NC$RANINDX U(01,30,30); # RELETIVE PRU ADDR #
ITEM NC$VER C(02,00,20); # NCF DATE/TIME #
ITEM NC$DATE C(02,00,10); # NCF CREATION DATE #
ITEM NC$TIME C(03,00,10); # NCF CREATION TIME #
ITEM NC$LEV C(05,42,18); # NCF VERSION LEVEL #
ITEM NC$TITLE C(08,00,50); # TITLE- TRUNCATED TO 50 CHARS #
END
#
* RECARAY - RECORD TYPE ARRAY.
*
* RECARAY IS AN ARRAY THAT CONTAINS THE RECORD TYPE IDENTIFIERS TO
* BE USED FOR INITIALIZING THE CS CONTROL STRUCTURES. THE RECORD
* TYPES FOR THE LINE RECORD INDEX (LI), THE LOGICAL LINK XREF
* TABLE (LL), THE PHYSICAL LINK XREF TABLE (PH) AND THE NPU XREF
* TABLE (NX) ARE PHYSICALLY LOCATED IN THIS ARRAY FOR USE IN LO-
* CATING THE APPROPRIATE TABLES FROM THE NCF.
#
ARRAY RECARAY [00:MXRECT$] S(1);
BEGIN
ITEM REC$TYPE C(00,00,02) = ["LI","LL","PH","NX","LX","DX"];
ITEM REC$END B(00,59,01) =
[FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE];
END
#
* MISSMSG - NCF MISSING RECORD MESSAGE.
*
* MISSMSG CONTAINS A MESSAGE TO BE USED IF A RECORD TYPE AS DEFINED
* IN THE RECARAY IS NOT LOCATED. CS WILL BE ABORTED IN THIS CASE.
#
ARRAY MISSMSG [00:00] S(2);
BEGIN
ITEM MIS$MSG C(00,00,18) = ["MISSING NCF RECORD"];
ITEM MIS$ZERO U(00,48,12) = [0];
END
#
* BADREAD - NCF BAD READ MESSAGE.
*
* BADREAD CONTAINS A MESSAGE TO BE USED IF A BAD READ STATUS IS
* ENCOUNTERED DURING CSIBXT INITIALIZATION. CS WILL ABORT.
#
ARRAY BADREAD [00:00] S(2);
BEGIN
ITEM BAD$MSG C(00,00,12) = ["BAD NCF READ"];
ITEM BAD$ZERO U(01,12,48) = [0];
END
#
* BNAMLEV - BASED ARRAY FOR NAM LEVEL MESSAGE BUFFER.
#
BASED ARRAY BNAMLEV[00:00] S(2);
BEGIN
ITEM BNL$VER C(00,54,03);
ITEM BNL$LEV C(01,30,03);
END
#
* CSLEV - CS VERSION AND LEVEL BUFFER.
#
ARRAY CSLEV[00:00] S(CSLEVL$);
BEGIN
ITEM CLV$WORD0 U(00,00,60) = [0];
ITEM CLV$PSFC U(00,00,16) = [HOPLG];
ITEM CLV$MSG C(01,00,35) =
["CS/ HH.MM.SS. VER VER - LVL."];
ITEM CLV$TIM C(02,00,10);
ITEM CLV$VER C(03,30,03);
ITEM CLV$LVL C(04,06,03);
ITEM CLV$ZRO U(04,30,30) = [0];
END
#
* NCFBDT - NCF BUILD DATE AND TIME BUFFER.
#
ARRAY NCFBDT[00:00] S(NCFBDTL$);
BEGIN
ITEM NBT$WORD0 U(00,00,60) = [0];
ITEM NBT$PSFC U(00,00,16) = [HOPLG];
ITEM NBT$MSG C(01,00,44) =
["CS/ HH.MM.SS. NCF YY/MM/DD, HH.MM.SS."];
ITEM NBT$TIM C(02,00,10);
ITEM NBT$DATE C(03,30,08);
ITEM NBT$TIME C(04,30,08);
ITEM NBT$ZRO U(05,24,36) = [0];
END
#
* NCFTIT - NCF TITLE BUFFER.
#
ARRAY NCFTIT[00:00] S(NCFTITL$);
BEGIN
ITEM NTL$WORD0 U(00,00,60) = [0];
ITEM NTL$PSFC U(00,00,16) = [HOPLG];
ITEM NTL$MSG C(01,00,21) =
["CS/ HH.MM.SS. "];
ITEM NTL$TIM C(02,00,10);
ITEM NTL$TITLE C(03,06,50);
ITEM NTL$ZRO U(08,06,54) = [0];
END
CONTROL EJECT;
#
* INITIALIZE THE NCF FET. DEFINITION IN TXTCTCS.
#
NF$WORD[0] = 0;
NF$LFN[0] = "NCF";
NF$CBIT[0] = TRUE;
NF$WORD1[0] = 0;
NF$R[0] = TRUE;
NF$L[0] = NFSIZ$ - 5;
NF$FIRST[0] = LOC(NCFBUF);
NF$IN[0] = LOC(NCFBUF);
NF$OUT[0] = LOC(NCFBUF);
NF$WORD4[0] = 0;
NF$LIMIT[0] = NF$FIRST[0] + NBLIM$ + 1;
NF$LA[0] = 0;
NF$WORD6[0] = 0;
#
* READ HEADER RECORD FOR DATE, TIME AND TITLE.
#
REWIND(NCFFET);
READ(NCFFET);
RECALL(NCFFET);
READW(NCFFET,NCFWBF,PTSIZ$,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
#
* SEND CS VERSION NUMBER AND THE NCF BUILD DATE AND TIME, AND
* TITLE TO NAM DAYFILE.
#
ABHWORD[0] = 0;
ABHABT[0] = APPCMD;
ABHACT[0] = CT60TRANS;
WCB$WORD[0] = 0;
WCB$SMID[0] = SMID"HOPLG";
P<BNAMLEV> = LOC(NAMLEV); # CS VERSION AND LVL MSG #
CLV$TIM[0] = CTM$CLOCK[0];
CLV$VER[0] = BNL$VER[0];
CLV$LVL[0] = BNL$LEV[0];
ABHTLC[0] = CSLEVL$;
WCB$WC[0] = CSLEVL$ + 2;
SSTAQE(P<OTQ>, WCBUF[0],ABHBUF[0], CSLEV[0]);
NBT$TIM[0] = CTM$CLOCK[0]; # NCF BUILD DATE AND TIME MSG #
NBT$DATE[0] = NC$DATE[0];
NBT$TIME[0] = NC$TIME[0];
ABHTLC[0] = NCFBDTL$;
WCB$WC[0] = NCFBDTL$ + 2;
SSTAQE(P<OTQ>, WCBUF[0], ABHBUF[0], NCFBDT[0]);
NTL$TIM[0] = CTM$CLOCK[0]; # NCF TITLE MSG #
NTL$TITLE[0] = NC$TITLE[0];
ABHTLC[0] = NCFTITL$;
WCB$WC[0] = NCFTITL$ + 2;
SSTAQE(P<OTQ>, WCBUF[0], ABHBUF[0], NCFTIT[0]);
CSNCFVER = NC$VER[0]; # STORE DATE/TIME INTO CSCS #
CSNCFLEV = NC$LEV[0];
NF$IN[0] = NF$FIRST[0];
NF$OUT[0] = NF$FIRST[0];
#
* READ NCF PREFIX TABLE.
#
SKIPEI(NCFFET);
SKIPB(NCFFET,2);
READ(NCFFET);
RECALL(NCFFET);
READW(NCFFET,NCFWBF,PTSIZ$,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
#
* READ LFN, NCFWC WORDS.
#
READW(NCFFET,NCFWBF,KEYPR$,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
IF NOT NC$FLAG # BAD NCF FROM NDL? #
THEN
BEGIN
MESSAGE(NCFMSG[0],DF$);
CSIIAP;
END
#
* THE NCD FILE IS POSITIONED AT THE START OF THE INDEX
* RECORD. THE LENGTH OF THE REMAINDER OF THE INDEX RECORD
* IS CALCULATED AND THE RECORD IS THEN READ FROM THE NCF
* INTO THE NCFINDX BASED ARRAY VIA THE USE OF A MANAGED
* TABLE NOT YET IN USE BY CS. THE MANAGED TABLE USED WILL
* BE RELEASED AFTER THE RECORD IS READ.
*
* THE LENGTH OF THE INDEX RECORD MINUS THE HEADER IS EQUAL TO THE
* NUMBER OF RECORDS WRITTEN TO THE NCF MULTIPLIED BY 2. THEREFORE
* THE NUMBER OF KEY RECORDS = LENGTH - HEADER / 2.
#
INDXLEN = NC$WC[0]; # CALCULATE THE LENGTH #
SSTATS(P<OCB>,INDXLEN);
ADDR = P<OCB>;
P<NCFINDX> = ADDR;
N = INDXLEN - 1; # REMOVE HEADER LENGTH #
TKEYPR = N/2;
READW(NCFFET,NCFINDX,N,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
#
* THE NCF INDEX RECORD MINUS HEADER RESIDES AT NCFINDX. FOR EACH
* RECORD OF THE INDEX, CHECK AGAINST THE RECORD TYPES DEFINED BY
* THE RECARAY ARRAY FOR A MATCH. A MATCH INDICATES THAT THE INDEX
* RECORD IS ONE OF THE RECORDS NEEDED BY CS. A MATCH IS SECURE
* SINCE THE INDEX RECORD TYPE IS STORED AS THE LAST ENTRY OF THE
* RECARAY. THE END RECORD INDICATOR IS SET FOR THE LAST ENTRY OF
* THE RECARAY ARRAY.
#
#
* THE OUTER LOOP CAUSES A SEARCH OF ALL INDEX RECORDS. THE END OF
* THE INDEX RECORD ARRAY CONTAINS AN ENTRY WITH A ZZ RECORD TYPE.
* REACHING THE POINT OF THE ZZ RECORD CAUSES EVERYTHING TO STOP.
#
NCF$RL[TKEYPR] = 0;
FOR I = 0 STEP 1 WHILE NCF$RT[I] NQ O"7700"
DO
BEGIN
REC$TYPE[MXRECT$] = NCF$RT[I];
FOR J = 0 STEP 1 WHILE NCF$RT[I] NQ REC$TYPE[J]
DO
BEGIN
END
IF NOT REC$END[J] # IF A MATCH FOUND #
THEN
BEGIN
#
* AN INDEX RECORD NEEDED HAS BEEN FOUND. SET UP THE NCF FET,
* RESET THE CIO BUFFER, AND SET THE RELETIVE PRU ADDRESS OF
* THE NEEDED TABLE INTO THE FET.
#
RECALL(NCFFET);
WC = NCF$RL[I];
N = WC - 2; # SET UP ACTUAL REC LEN #
NF$RR[0] = NCF$RADDR[I];
NF$IN[0] = NF$FIRST[0];
NF$OUT[0] = NF$FIRST[0];
SAVEADR = NCF$RADDR[I];
#
* NOW READ THE HEADER OF THE RECORD AND DISCARD SINCE NOT NEEDED.
#
READ(NCFFET);
RECALL(NCFFET);
READW(NCFFET,NCFWBF[0],KEYPR$,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
#
* EACH CASE IS INVOKED DEPENDING ON THE RECORD TYPE MATCHED
* AGAINST IN THE RECARAY ARRAY. THE SPECIFIC TABLE ON THE NCF
* HAS BEEN READIED TO READ AND EACH CASE WILL APPROPRIATELY
* READ THE TABLE INTO THE MANAGED TABLE.
#
GOTO BLDTAB[J];
BLDLIR: #** BUILD LINE RECORD INDEX **#
$BEGIN
IF NC$RNAME[0] NQ "LNINDEX"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<LRI>,WC);
LIWORD[0] = 0;
ADDR1 = P<LRI> + 1;
P<DUMMY> = ADDR1;
READW(NCFFET,DUMMY,N,STATS);
WCTH = WC -1;
LIWORD[WCTH] = -1; # INSURE SEARCH SUCCESSFUL #
GOTO ENDBLD;
BLDLLX: #** BUILD LOGICAL LINK XREF TABLE **#
$BEGIN
IF NC$RNAME[0] NQ "LOGLINK"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<LLXRS>,WC);
READW(NCFFET,LLXRS,N,STATS);
GOTO ENDBLD;
BLDPHX: #** BUILD PHYSICAL LINK XREF TABLE **#
$BEGIN
IF NC$RNAME[0] NQ "PHYLINK"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<PLXREFS>,WC);
READW(NCFFET,PLXREFS,N,STATS);
GOTO ENDBLD;
BLDNPX: #** BUILD NPU XREF TABLE AND NPUCBS **#
$BEGIN
IF NC$RNAME[0] NQ "NPUXREF"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<NPXREF>,WC);
READW(NCFFET,NPXREF,N,STATS);
$BEGIN
IF STATS NQ 0
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
CSNPCNT = N/2; # CALCULATE NUMBER OF NPUCBS #
SIZE = (CSNPCNT * NPCBSZ$) + NPCBSZ$; # 1 EXTRA AT END #
SSTATS(P<NPUCB>,SIZE);
FOR M = 0 STEP 1 UNTIL (CSNPCNT - 1)
DO
BEGIN
NPU$WORD[M] = 0; # CLEAR NPUCB ARRAY #
NPU$WORD1[M] = 0;
NPU$WORD2[M] = 0;
NPU$WORD3[M] = 0;
NPU$WORD4[M] = 0 ;
NPU$WORD5[M] = 0 ;
NPU$WORD6[M] = 0 ;
NPU$WORD7[M] = 0 ;
NPU$NAME[M] = NPX$NAME[M]; # INIT NPUCB ARRAY #
NPU$NID[M] = NPX$NID[M];
NPU$VAR[M] = NPX$VAR[M];
NPU$CSUM[M] = NPX$CSUM[M];
NPU$CNID[M] = XCDD(NPX$NID[M]); #CONVERT NODE ID #
NPU$CP[M] = CSCP;
NPU$BU[M] = CSBU;
END
NPU$WORD[CSNPCNT] = 0;
NPU$WORD1[CSNPCNT] = 0;
NPU$WORD2[CSNPCNT] = 0;
NPU$WORD4[CSNPCNT] = 0 ;
NPU$WORD5[CSNPCNT] = 0 ;
NPU$WORD6[CSNPCNT] = 0 ;
NPU$WORD7[CSNPCNT] = 0 ;
SSTRTS(P<NPXREF>,0,WC); # RELEASE NPU XREF TABLE #
GOTO ENDBLD;
BLDLIX: #** BUILD LINE CROSS REFERENCE TABLE **#
$BEGIN
IF NC$RNAME[0] NQ "LNXREF"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<LIXS>,WC);
READW(NCFFET,LIXS,N,STATS);
GOTO ENDBLD;
BLDDEX: #** BUILD DEVICE CROSS REFERENCE TABLE **#
$BEGIN
IF NC$RNAME[0] NQ "DVXREF"
THEN
BEGIN
MESSAGE(BADREAD,DF$);
CSIIAP;
END
$END
SSTATS(P<DEXS>,WC);
READW(NCFFET,DEXS,N,STATS);
GOTO ENDBLD;
ENDBLD: #** COMMON EXIT **#
ADDR = P<OCB>; # REBASE NCFINDX POINTER #
P<NCFINDX> = ADDR;
END # IF NOT REC$END #
$BEGIN
IF STATS NQ 0 # BAD NCF READ ALONG WAY #
THEN
BEGIN
MESSAGE(BADREAD[0],DF$);
CSIIAP;
END
$END
END # FOR I LOOP #
SSTRTS(P<OCB>,0,INDXLEN); # RELEASE THE OCB USED SPACE#
DBVAR = 1;
V24FLAG = FALSE ; # CLEAR CCP 2.4 VERSION FLAG #
END # CSIBXT #
TERM