*DECK NS$HFI
USETEXT DEF$NS
USETEXT DIR$NS
USETEXT HOC$NS
USETEXT LIN$NS
USETEXT NPT$NS
USETEXT PRF$NS
PROC NS$HFI(REASON); # ALTERNATE LOAD FILE COMMAND PROCESSOR #
# TITLE NS$HFI - ALTERNATE LOAD FILE COMMAND PROCESSOR. #
BEGIN # NS$HFI #
#
** NS$HFI - ALTERNATE LOAD FILE COMMAND PROCESSOR.
*
* J.C. LEE 1981
*
* PROC NS$HFI(REASON)
*
* ENTRY:
* NONE.
*
* EXIT:
* REASON - REASON CODE, POSSIBLE REASONS ARE:
* - NPU NOT SPECIFIED IN COMMAND.
* - SPECIFIED NPU NOT CONFIGURED/NOT FOUND
* - ALTERNATE NLF NOT SPECIFIED IN COMMAND.
* - FILE ATTACH NOT SUCCESSFUL.
* - BAD NLF FILE FORMAT.
* - SPECIFIED NPU ACTIVE, CANNOT ACTION COMMAND.
*
* METHOD:
* SEARCH SPECIFIED NPU IN NPU TABLE.
* ATTACH SPECIFIED ALTERNATE NLF.
* GET CIO BUFFER.
* READ THE ALTERNATE NLF.
* IF SPECIFIED NLF NOT CURRENTLY ACTIVE, SEND ALTERNATE NLF
* VERSION MESSAGE TO *KDB*.
* READ NLF DIRECTORY TO TSB.
* SAVE DIRECTORY TSBN.
* RELEASE CIO BUFFER.
*
#
ITEM REASON U; # FILE COMMAND ERROR REASON CODE #
$BEGIN
XREF
BEGIN
PROC NS$DBG; # TRACE CALL #
END
$END
XREF
BEGIN
FUNC ATTACH; # ATTACH FILE TO CONTROL POINT #
PROC NS$TKD; # TRANSFER DATA TO K DISPLAY BUFFER #
FUNC NS$XZFN C(10); # ZERO-FILLED WORD #
PROC READ; # READ FILE #
PROC READW; # TRANSFER DATA #
PROC RECALL; # WAIT TILL I/O COMPLETES #
PROC REQTSB; # REQUEST TSB #
PROC RETERN; # RETURN FILE #
PROC RETTSB; # RELEASE TSB #
PROC SKIPB; # SKIP FILE BACKWARDS #
PROC SKIPEI; # SKIP TILL EOI #
END
DEF L$ALFBUF # O"101" #; # SIZE OF CIO BUFFER #
DEF PRF$7700L # 15 #; # SIZE OF 77 TABLE IN NLF #
ITEM DIRTSBN U; # DIRECTORY TSB NUMBER #
ITEM I U; # TEMPORARY #
ITEM NPTINDEX U; # NPU TABLE ENTRY INDEX #
ITEM NPTCOUNT U; # NPU TABLE ENTRY COUNT #
ITEM NPUNAME C(7); # NPU NAME #
ITEM PFN C(7); # PFN OF ALTERNATE LOAD FILE #
ITEM PW C(7); # PASSWORD OF ALTERNATE LOAD FILE #
ITEM STAT U; # RETURN STATUS #
ITEM TSBFWA U; # TSB FWA #
ITEM TSBN U; # TSB NUMBER #
ITEM UN C(7); # USER NAME OF ALTERNATE LOAD FILE #
ARRAY ALF$FET[0:0]S(5);
BEGIN # ALTERNATE LOAD FILE FET #
ITEM FET$LFN C(00,00,07); # LOGICAL FILE NAME #
ITEM FET$FM B(00,58,01) = [TRUE]; # BINARY FILE MODE #
ITEM FET$COMP B(00,59,01) = [TRUE]; # COMPLETION BIT #
ITEM FET$RAN B(01,12,01) = [TRUE]; # RANDOM FILE #
ITEM FET$FIRST I(01,42,18); # FIRST POINTER #
ITEM FET$IN I(02,42,18); # IN PONTER #
ITEM FET$OUT I(03,42,18); # OUT POINTER #
ITEM FET$LIMIT I(04,42,18); # LIMIT POINTER #
END
DEF L$FVERSION # 5 #; # LENGTH OF FILE VERSION MESSAGE #
ARRAY FILVERSION[0:0]S(L$FVERSION);
BEGIN # ALTERNATE FILE VERSION MESSAGE #
ITEM FVER$LNHDR U(00,00,60); # LINE HEADER WORD #
ITEM FVER$LNID U(00,00,24) = [LIN$IDENT]; # LINE ID #
ITEM FVER$LNSIZ U(00,42,18) = [L$FVERSION]; # SIZE #
ITEM FVER$TEXT C(01,00,38) = # MESSAGE TEXT #
["FILENAM VERSION - YY/MM/DD, HH.MM.SS."];
ITEM FVER$PFN C(01,00,07); # ALTERNATE NLF PFN #
ITEM FVER$DATE C(02,48,08); # CREATION DATE #
ITEM FVER$TIME C(03,48,08); # CREATION TIME #
ITEM FVER$TERM U(04,48,12) = [0]; # LINE TERMINATOR #
END
CONTROL EJECT;
$BEGIN
NS$DBG("HFI"); # TRACE CALL #
$END
REASON = 0;
NPUNAME = CMD$NPUNAM[PAR$NPU]; # NPU NAME #
IF NPUNAME NQ 0
THEN # NPU NAME IS SPECIFIED IN COMMAND #
BEGIN
NPTCOUNT = NPT$EC[0]; # NPU TABLE ENTRY COUNT #
NPTINDEX = 0; # NPU TABLE ENTRY INDEX #
FOR I = 1 STEP 1 WHILE I LQ NPTCOUNT
AND NPTINDEX EQ 0
DO # SEARCH NPU TABLE FOR SPECIFIED NPU #
BEGIN
IF NPT$NPNAME[I] EQ NPUNAME
THEN # NPU NAME MATCH, ENTRY FOUND #
NPTINDEX = I; # SAVE NPU ENTRY INDEX #
END
IF NPTINDEX NQ 0
THEN # FOUND SPECIFIED NPU #
BEGIN
IF CMD$WORD[PAR$NLF] NQ 0
THEN # ALTERNATE NLF MUST BE SPECIFIED #
BEGIN # TRY ATTACHING SPECIFIED FILE #
PFN = NS$XZFN(CMD$NLFPFN[PAR$NLF]); # ZERO-FILLED PFN #
UN = NS$XZFN(CMD$NLFUN[PAR$UN]); # ZERO-FILLED UN #
PW = NS$XZFN(CMD$NLFPW[PAR$PW]); # ZERO-FILLED PASSWORD #
IF CMD$WORD[PAR$PW] EQ 0
THEN # USE DEFAULT PASSWORD FOR ATTACH CALL #
CMD$NLFPW[PAR$PW] = "DEFAULT";
STAT = ATTACH(PFN,PFN,UN,PW,1); # ATTACH SPECIFIED NLF #
IF STAT EQ 0
THEN # FILE ATTACH IS SUCCESSFUL #
BEGIN # VALIDATE CCP LOAD FILE #
REQTSB(L$ALFBUF,TSBFWA,TSBN); # GET CIO BUFFER #
FET$LFN[0] = PFN; # SET LFN OF ALTERNATE LOAD FILE #
FET$FIRST[0] = TSBFWA; # SET FET TO READ ALTERNATE NLF #
FET$IN[0] = TSBFWA;
FET$OUT[0] = TSBFWA;
FET$LIMIT[0] = TSBFWA + L$ALFBUF;
SKIPEI(ALF$FET); # SKIP FILE TILL EOI #
SKIPB(ALF$FET,2); # POITION AT DIRECTORY RECORD #
READ(ALF$FET); # READ NLF DIRECTORY RECORD #
RECALL(ALF$FET); # WAIT TILL I/O COMPLETES #
P<PRF$TABLE> = TSBFWA; # FWA OF PREFIX TABLE #
P<DIR> = TSBFWA + PRF$7700L; # FWA OF NLF DIRECTORY #
IF PRF$ID[0] EQ PRF$IDENT # PREFIX TABLE ID OK #
AND DIR$FID[0] EQ LFN$NLF # FILE IDENTIFIER OK #
THEN # VALID NLF #
BEGIN
IF NPT$NATTSB[NPTINDEX] EQ 0
THEN # NPU CURRENTLY NOT ACTIVE, PROCEED #
BEGIN
FVER$PFN[0] = CMD$NLFPFN[PAR$NLF]; # FORMAT MESSAGE #
FVER$DATE[0] = PRF$DATE[0]; # SET FILE CREATION DATE #
FVER$TIME[0] = PRF$TIME[0]; # SET FILE CREATION TIME #
NS$TKD(FILVERSION,L$FVERSION,1); # SEND LINE TO KDB #
I = DIR$WC[0] + 1; # SIZE OF DIRECTORY RECORD #
REQTSB(I,TSBFWA,DIRTSBN); # GET TSB FOR DIRECTORY #
FET$OUT[0] = P<DIR>; # SET TO FWA OF DIRECTORY #
P<DIR> = TSBFWA; # FWA OF DIRECTORY RECORD #
READW(ALF$FET,DIR,I,STAT); # READ DIRECTORY TO TSB #
IF NPT$ALFWD[NPTINDEX] NQ 0
THEN # AN ALTERNATE NLF CURRENTLY EXISTS #
BEGIN # RELEASE CURRENT NLF DIRECTORY TSB #
RETTSB(NPT$DIRTSB[NPTINDEX]);
FET$LFN[0] = NS$XZFN(NPT$ALFPFN[NPTINDEX]);
RETERN(ALF$FET); # RETURN OLD ALTERNATE NLF #
NPT$ALFWD[NPTINDEX] = 0; # CLEAR ALTERNATE NLF WORD#
END
NPT$ALFPFN[NPTINDEX] = CMD$NLFPFN[PAR$NLF];
NPT$DIRTSB[NPTINDEX] = DIRTSBN; # SAVE DIR TSBN #
RETTSB(TSBN); # RELEASE CIO BUFFER #
END
ELSE # NPU ACTIVE, CANNOT ACTION COMMAND #
REASON = HOPCMDERR"NPUACTIVE";
END
ELSE # BAD NLF DIRECTORY RECORD #
REASON = HOPCMDERR"NLFBAD"; # BAD NLF FILE FORMAT #
END
ELSE # FILE ATTACH IS NOT SUCCESSFUL #
REASON = HOPCMDERR"NLFNAVAIL"; # NLF NOT AVAILABLE #
END
ELSE # ALTERNATE LOAD FILE IS NOT SPECIFIED #
REASON = HOPCMDERR"NLFNSPEC";
END
ELSE # NPU NOT FOUND, SPECIFIED NPU NOT CONFIGURED #
REASON = HOPCMDERR"NPUNCNFG";
END
ELSE # NPU MUST BE SPECIFIED IN COMMAND #
REASON = HOPCMDERR"NPUNSPEC";
RETURN;
END # NS$HFI #
TERM