*DECK LFGHDRW
USETEXT LFGFET,LFGIOD,LFGWKBS,LFGFN
PROC LFGHDRW(PN,RN,IW60,NWDS16,NEWP,MRES,EOP,BEGADDR,PRC,SUCCESS,
OVNAME,BN,LB,BC,DIRBUF);
BEGIN
*IF DEF,IMS
#
** LFGHDRW - ADD SM HEADER AND WRITE TO NLF.
*
* M. E. VATCHER 81/02/20
*
* LFGHDRW ADDS A SM HEADER TO A MESSAGE AND WRITES IT TO THE NLF.
*
* PROC LFGHDRW(PN,RN,IW60,NWDS16,NEWP,MRES,EOP,BEGADDR,PRC,SUCCESS,
* OVNAME,BN,LB,DIRBUF)
*
* ENTRY PN PARTITION NAME FOR DIRECTORY
* RN RECORD NAME FOR FIRST WORD OF RECORD
* IW60 NUMBER OF 60 BIT WORDS IN THIS MESSAGE
* NWDS16 NUMBER OF 16 BIT WORDS IN THIS MESSAGE
* NEWP NEW PARTITION FLAG
* MRES MEMORY RESIDENT FLAG
* EOP END OF PARTITION FLAG
* BEGADDR BEGINNING ADDRESS IN NPU FOR LOAD DATA
* PRC PARTITION RECORD COUNT
* OVNAME OVERLAY NAME IN ASCII
* BN BLOCK NUMBER FOR OVERLAYS
* LB LAST BLOCK NUMBER FOR OVERLAYS
* BC BATCH COUNT
* DIRBUF DIRECTORY BUFFER ADDRESS
*
* EXIT PRC PARTITION RECORD COUNT
* SUCCESS SUCCESSFUL COMPLETION INDICATOR
*
* METHOD
*
* IF ITS A NEW PARTITION
* THEN
* SAVE CURRENT RANDOM INDEX FROM FET
* WRITE RECORD NAME TO CIO BUFFER
* PUT NUMBER OF 60 BIT AND NUMBER OF 16 BIT WORDS IN HEADER
* IF END OF PARTITION
* THEN
* SET EOP BIT IN MESSAGE HEADER
* PUT IN SM HEADER, EITHER OVL/DT OR OVL/PB
* WRITEW MESSAGE TO CIO BUFFER
* IF MESSAGES IN RECORD SO FAR < 64 AND NOT END OF PARTITION
* THEN
* RETURN
* WRITE REST OF RECORD TO NLF
* IF ITS THE FIRST RECORD OF THE PARTITION
* THEN
* MAKE A DIRECTORY ENTRY
* END
*
#
*ENDIF
#
**** PROC LFGHDRW - XREF LIST BEGIN.
#
XREF
BEGIN
PROC LFGMDE; # MAKE DIRECTORY ENTRY #
PROC RECALL; # CHECK COMPLETION BIT #
ITEM WFET U; # FWA OF NLF FET #
PROC WRITER; # WRITE RECORD #
PROC WRITEW; # WRITE WORDS TO CIO BUFFER #
END
#
****
#
CONTROL NOLIST; # SMPFC, SMDEF #
*CALL SMPFC
*CALL SMDEF
CONTROL LIST;
DEF OVLPB # 0 #; # TEMP FIX UNTIL OVERLAY CODE IS REMOVED #
COMMON HDRWRTCOM;
BEGIN
ITEM CRI U; # CURRENT RANDOM INDEX #
ITEM FIRSTREC B; # FIRST RECORD OF PARTITION FLAG #
ITEM MINRSF U; # MESSAGES IN RECORD SO FAR #
ITEM RECL U; # RECORD LENGTH #
END
ITEM BC; # BATCH COUNT #
ITEM BEGADDR U; # BEGINNING ADDRESS #
ITEM BN U; # BLOCK NUMBER #
ITEM EOP B; #END OF PARTITION FLAG #
ITEM IW60 U; # NUMBER OF 60 BIT WORDS IN MESSAGE #
ITEM LB U; # LAST BLOCK NUMBER #
ITEM MRES B; # MEMORY RESIDENT FLAG #
ITEM NEWP B; # NEW PARTITION FLAG #
ITEM NWDS16 U; # NUMBER OF 16 BIT WORDS OF MESSAGE DATA #
ITEM OVNAME U; # OVERLAY NAME IN ASCII #
ITEM PN C(6); # PARTITION NAME #
ITEM PRC U; # PARTITION RECORD COUNT #
ITEM RN C(6); # RECORD NAME #
ITEM SUCCESS B;
ARRAY DIRBUF [0:0] S(1);
BEGIN # ADDRESS OF DIRECTORY BUFFER PASSED TO LFGMDE #
ITEM DIRBUFWORD U(0,0,60);
END
P<SM$NS> = LOC(PBUF[1]); # POINT SM HEADER BASED ARRAY #
SUCCESS = TRUE;
P<SIOFET> = WFET;
IF NEWP
THEN # STARTING A NEW PARTITION #
BEGIN
NEWP = FALSE; # NO LONGER A NEW PARTITION #
FIRSTREC = TRUE; # FIRST RECORD OF PARTITION #
CRI = FETCRI[0]; # SAVE CURRENT RANDOM INDEX #
WRITEW(SIOFET,RN,1); # PUT RECORD NAME IN CIO BUFFER #
RECL = 1; # INITIALIZE RECORD LENGTH #
MINRSF = 0; # NO MESSAGES IN RECORD YET #
PRC = 0; # NO RECORDS WRITTEN YET #
END
B<42,18>PBUF[0] = IW60;
IF EOP
THEN #END OF PARTITION #
B<0,1>PBUF[0] = 1; # THIS IS THE LAST MESSAGE #
IF MRES
THEN # MEMORY RESIDENT PARTITION #
BEGIN
B<24,18>PBUF[0] = NWDS16*2 + LNPUDTLR; # SET TLC #
PFCSFC[0] = NPUDT; # SET PFC/SFC = NPU/DT #
NPUCC[0] = CMDCODE"CC$LOAD"; # SET COMMAND CODE = LOAD #
NPUBA1[0] = B<36,4>BEGADDR; # SET BEGINNING ADDRESS #
NPUBA2[0] = B<40,20>BEGADDR;
BEGADDR = BEGADDR + 105;
END
ELSE
BEGIN
B<24,18>PBUF[0] = NWDS16*2 + LOVLPBR; # SET TLC #
PFCSFC[0] = OVLPB; # SET PFC/SFC = OVL/PB #
OVLON[0] = B<36,24>OVNAME; # SET OVERLAY NAME #
OVLBN[0] = BN; # SET BLOCK NUMBER #
OVLBC[0] = LB; # SET BATCH COUNT = LAST BLOCK NUMBER #
END
MINRSF = MINRSF + 1; # MESSAGES IN THIS RECORD SO FAR #
IF MRES AND (MINRSF EQ BC OR EOP)
THEN # FILL IN BATCH COUNT #
BEGIN
NPUBC[0] = MINRSF;
END
WRITEW(SIOFET,PDATA,IW60); # WRITE MESSAGE TO CIO BUFFER #
RECL = RECL + IW60; # UPDATE RECORD LENGTH #
IF MINRSF LS BC AND NOT EOP
THEN # RECORD NOT YET FULL #
BEGIN
RETURN; # ***** EXIT ***** #
END
RECALL(SIOFET); #WAIT FOR POSSIBLE WRITE AHEAD #
WRITER(SIOFET,"R"); # FINISH WRITING DATA IN CIO BUFFER #
IF FIRSTREC
THEN # FIRST RECORD OF LOAD PARTITION #
BEGIN
FIRSTREC = FALSE;
LFGMDE(PN,CRI,RECL,SUCCESS,DIRBUF);
IF NOT SUCCESS
THEN
RETURN; # ***** EXIT ***** #
END
MINRSF = 0; # RESET MESSAGE COUNT #
PRC = PRC + 1; # INCREMENT PARTITION RECORD COUNT #
IF NOT EOP
THEN
BEGIN
WRITEW(SIOFET,RN,1); # WRITE RECORD NAME TO CIO BUFFER #
RECL = 1; # INITIALIZE RECORD LENGTH #
END
END TERM