User Tools

Site Tools


cdc:nos2.source:nam5871:lfgmain

LFGMAIN

Table Of Contents

  • [00007] LFG MAIN ROUTINE

Source Code

LFGMAIN.txt
  1. *DECK LFGMAIN
  2. USETEXT LFGDIR,LFGIOD,LFGDB,LFGFN
  3. PROC LFGMAIN;
  4. BEGIN
  5. *IF DEF,IMS
  6. #
  7. ** LFGMAIN - LFG MAIN ROUTINE
  8. *
  9. * M. E. VATCHER 81/02/18
  10. *
  11. * THIS PROC CONTAINS THE LFG MAIN LOOP. EACH INPUT FILE ON THE
  12. * LFG CONTROL CARD IS PROCESSED.
  13. *
  14. * PROC LFGMAIN
  15. *
  16. * ENTRY NONE.
  17. *
  18. * EXIT NONE.
  19. *
  20. * METHOD
  21. *
  22. * FOR EACH INPUT FILE ON THE LFG CONTROL CARD
  23. * FOR EACH FILE IN THIS LFN (WHILE NOT EOI)
  24. * GET LOAD PARTITION NAME AND TYPE
  25. * WHILE NOT END OF PARTITION (EOP)
  26. * READ A HEADER RECORD
  27. * IF IT IS A PICB
  28. * THEN
  29. * REFORMAT PICB
  30. * BREAK OUT OF "WHILE NOT EOP" LOOP
  31. * FILL READ BUFFER
  32. * WHILE NOT EOR
  33. * READW TO WORKING BUFFER
  34. * MOVE AND SHIFT WORDS TO WORKING BUFFER FOR WRITE
  35. * CALCULATE CHECKSUM
  36. * ADD SM HEADER AND WRITE MESSAGE TO NLF
  37. * SEND SUMMARY LISTING LINE
  38. * SKIP TRAILER RECORDS
  39. * WRITE DIRECTORY
  40. *
  41. #
  42. *ENDIF
  43.  
  44. #
  45. **** PROC LFGMAIN - XREF LIST BEGIN.
  46. #
  47.  
  48. XREF
  49. BEGIN
  50. ITEM IFET U; # INPUT FILE FET #
  51. ITEM NLF U; # NETWORK LOAD FILE FET #
  52. ITEM OUTPUT U; # FWA OF OUTPUT FILE FET #
  53.  
  54. PROC LFGCKSM; # COMPUTE CHECKSUM #
  55. PROC LFGCRAK; # CRACK CONTROL CARD #
  56. PROC LFGGFN; # GET FILE NAMES FOR REFORMATTING #
  57. PROC LFGGPN; # GET PARTITION NAME #
  58. PROC LFGHDRW; # ADD SM HEADER AND WRITE TO NLF #
  59. PROC LFGLHDR; # SEND SUMMARY LISTING HEADER #
  60. PROC LFGMOVW; # MOVE AND SHIFT 16 BIT WORDS #
  61. PROC LFGNLFH; # WRITE HEADER RECORD TO NLF #
  62. PROC LFGRDER; # READ ERROR PROCESSOR #
  63. PROC LFGRDHR; # READ HEADER RECORD #
  64. PROC LFGRDSR; # READ SEQUENTIAL RECORD #
  65. PROC LFGREFP; # REFORMAT PICB #
  66. PROC LFGSKIP; # SKIP TRAILER RECORDS #
  67. PROC LFGSSLL; # SEND SUMMARY LISTING LINE #
  68. PROC LFGWRD; # WRITE DIRECTORY TO NLF #
  69. PROC MESSAGE; # SEND MESSAGE TO DAYFILE #
  70. PROC READW; # READ WORDS FROM CIO BUFFER #
  71. PROC WRITEC; # WRITE LINE TO CIO BUFFER #
  72. PROC WRITER; # WRITE RECORD #
  73. FUNC XCDD C(10); # CONVERT INTEGER TO DECIMAL DISPLAY CODE #
  74. FUNC XSFW C(10); # SPACE FILL WORD #
  75. END
  76.  
  77. #
  78. ****
  79. #
  80.  
  81. DEF DEF$BC # 64 #; # DEFAULT BATCH COUNT VALUE #
  82. DEF SYSLOC # 0 #; # MESSAGE TO SYSTEM AND LOCAL DAYFILES #
  83.  
  84. CONTROL PRESET;
  85. CONTROL NOLIST; # LFGSTAN COMMON DECK #
  86. *CALL LFGSTAN
  87. CONTROL LIST;
  88.  
  89. ITEM BEGADDR U; # BEGINNING ADDRESS #
  90. ITEM BPOS U; # BIT POSITION COUNTED FROM LEFT #
  91. ITEM CKSM U; # CHECKSUM #
  92. ITEM EOI B; # END OF INFORMATION INDICATOR #
  93. ITEM EOP B; # END OF PARTITION INDICATOR #
  94. ITEM FRST$REC B; # FLAG INDICATING 1ST RECORD IN PARTITION #
  95. ITEM FOUTR B; # FIRST OUTPUT RECORD OF PARTITION #
  96. ITEM I U; # LOOP INDEX #
  97. ITEM IW60 U; # NUMBER OF 60 BIT WORDS MOVED #
  98. ITEM J U; # LOOP INDEX #
  99. ITEM K U; # LOOP INDEX #
  100. ITEM LPAK U; # 16 BIT WORDS IN LAST PACKET #
  101. ITEM MRES B; # MEMORY RESIDENT INDICATOR #
  102. ITEM NP B; # NEW PARTITION INDICATOR #
  103. ITEM NPAK U; # NUMBER OF PACKETS (MESSAGES) #
  104. ITEM NWDS16 U; # 16 BIT WORDS IN CURRENT PACKET #
  105. ITEM ON U; # OVERLAY NAME IN ASCII #
  106. ITEM PICBF B; # PICB FLAG #
  107. ITEM PN C(6); # PARTITION NAME #
  108. ITEM PRC U; # PARTITION RECORD COUNT #
  109. ITEM RC U; # INPUT RECORD COUNT #
  110. ITEM STATIS;
  111. ITEM SUCCESS B;
  112. ITEM TEMP C(10);
  113. ITEM WC U; # WORD COUNT OF 16 BIT WORDS #
  114. ITEM WPOS; # WORD POSITION FOR SHIFTING #
  115.  
  116. ARRAY LFGCOMP [0:0] S(2);
  117. BEGIN
  118. ITEM LFGCOMP1 C(0,0,14) =
  119. [" LFG COMPLETE."];
  120. ITEM LFGCOMPZ U(1,24,36) = [ 0 ];
  121. END
  122.  
  123. ARRAY MEMIN [0:27] S(1);
  124. BEGIN
  125. ITEM INBUF U;
  126. END
  127.  
  128. CONTROL EJECT;
  129. PROC ERRCHECK(SUCCESS);
  130. BEGIN
  131.  
  132. XREF
  133. BEGIN
  134. PROC ABORT;
  135. PROC MESSAGE;
  136. END
  137.  
  138. ITEM SUCCESS B;
  139.  
  140. ARRAY LFGERR [0:0] S(2);
  141. BEGIN
  142. ITEM LERR C(0,0,12) = [" LFG ERRORS."];
  143. ITEM LZ U(1,12,48) = [ 0 ];
  144. END
  145.  
  146. IF NOT SUCCESS
  147. THEN
  148. BEGIN
  149. MESSAGE(LFGERR,SYSLOC); # *LFG ERRORS.* #
  150. ABORT;
  151.  
  152. END
  153. END
  154. CONTROL EJECT; # LFGMAIN CODE STARTS HERE #
  155. BC$VAL = DEF$BC; # SET DEFAULT BATCH COUNT VALUE #
  156. FIRST$PAGE = TRUE; # SET FIRST PAGE FLAG #
  157. LFGCRAK;
  158. LFGNLFH; # WRITE HEADER RECORD TO NLF #
  159. LFGGFN(FN,NUMIFILE); # GET FILE NAMES #
  160.  
  161. # INITIALIZE DIRECTORY #
  162.  
  163. P<DIR> = LOC(DIRB$WORD[0]) + 15;
  164. DIR$ID[0] = DIR$IDENT; # SET DIRECTORY IDENTIFIER #
  165. DIR$ZERO[0] = 0;
  166. DIR$FID[0] = "NLF";
  167. DIR$WC[0] = 0; # INITIALIZE DIRECTORY LENGTH #
  168.  
  169. # SEND SUMMARY LISTING HEADER #
  170.  
  171. PAGEN = 1; # INITIALIZE PAGE NUMBER #
  172. PARTNUM = 0; # CLEAR PARTITION COUNT #
  173. LFGLHDR(SUM$LST);
  174.  
  175. # LFG MAIN LOOP #
  176.  
  177. FOR LFN = 1 STEP 1 UNTIL NUMIFILE DO
  178. BEGIN
  179. FOR I = 1 STEP 1 UNTIL LFN - 1 DO
  180. BEGIN # SKIP OVER DUPLICATE FILE NAMES #
  181. IF FNAME[I] EQ FNAME[LFN]
  182. THEN
  183. TEST LFN;
  184.  
  185. END
  186. C<0,7>IFET = C<0,7>FNAME[LFN]; # PUT FILE NAME IN FET #
  187. EOI = FALSE;
  188. FOR FILENUM = 1 STEP 1 WHILE NOT EOI DO
  189. BEGIN
  190. LFGGPN(PN,RC,MRES,ON,EOI,SUCCESS); # GET PARTITION NAME #
  191. ERRCHECK(SUCCESS);
  192. IF EOI
  193. THEN
  194. TEST FILENUM;
  195.  
  196. EOP = FALSE; # NOT END OF PARTITION #
  197. FRST$REC = TRUE; # FIRST RECORD IN PARTITION #
  198. FOUTR = TRUE; # FIRST OUTPUT RECORD, CLEARED BY HDRWRT #
  199. NP = TRUE; # THIS IS A NEW PARTITION #
  200. FOR I = 1 STEP 1 WHILE NOT EOP DO
  201. BEGIN # WHILE NOT END OF PARTITION #
  202. LFGRDHR(PICBF,WC,BEGADDR,SUCCESS); # READ HEADER RECORD #
  203. ERRCHECK(SUCCESS);
  204. IF PICBF AND FRST$REC
  205. THEN # THIS IS A PICB #
  206. BEGIN
  207. LFGREFP(PN,WC,SUCCESS,DIR);
  208. ERRCHECK(SUCCESS);
  209. PRC = 1; # ONLY ONE RECORD IN PICB #
  210. EOP = TRUE;
  211. TEST I;
  212.  
  213. END
  214. FRST$REC = FALSE; # CLEAR FIRST RECORD FLAG #
  215. LFGRDSR(LOC(IFET),STATIS);
  216. IF STATIS NQ RDEOR AND STATIS NQ RDBFULL
  217. THEN
  218. BEGIN
  219. LFGRDER(STATIS);
  220. SUCCESS = FALSE;
  221. ERRCHECK(SUCCESS); # ***** ABORT ***** #
  222.  
  223. END
  224. NPAK = WC/105; # CALCULATE NUMBER OF MESSAGES #
  225. LPAK = WC - 105*NPAK; # 16 BIT WORDS IN LAST MESSAGE #
  226. IF LPAK NQ 0
  227. THEN
  228. NPAK = NPAK + 1;
  229. NWDS16 = 105;
  230. FOR J = 1 STEP 1 UNTIL NPAK DO
  231. BEGIN
  232. IF J EQ NPAK AND LPAK NQ 0
  233. THEN # LAST MESSAGE FROM THIS INPUT RECORD #
  234. NWDS16 = LPAK;
  235. READW(IFET,MEMIN,28,STATIS);
  236. LFGCKSM(LOC(MEMIN),59,NWDS16,CKSM);
  237. IF MRES
  238. THEN
  239. BEGIN
  240. BPOS = 36; # BIT POSITION COUNTED FROM THE LEFT #
  241. WPOS = 2; # WORD POSITION OF DATA IN MESSAGE #
  242. END
  243. ELSE # OVERLAY #
  244. BEGIN
  245. BPOS = 4; # BIT POSITION #
  246. WPOS = 2; # WORD POSITION #
  247. END
  248. LFGMOVW(0,WPOS,BPOS,NWDS16,IW60,CKSM,MEMIN);
  249. IF I EQ RC AND J EQ NPAK
  250. THEN # LAST MESSAGE OF PARTITION #
  251. EOP = TRUE;
  252. LFGHDRW(PN,PN,IW60,NWDS16,NP,MRES,EOP,BEGADDR,PRC,SUCCESS,
  253. ON,J,NPAK,BC$VAL,DIR);
  254. ERRCHECK(SUCCESS);
  255. END # GET NEXT 28 WORDS #
  256. END # GET NEXT HEADER RECORD #
  257. LFGSSLL(PN,PRC); # SEND SUMMARY LISTING LINE #
  258. LFGSKIP; # SKIP TRAILER RECORDS #
  259. END # GET NEXT PARTITION NAME #
  260. END # GET NEXT LFN #
  261. LFGWRD; # WRITE DIRECTORY TO NLF #
  262. IF LISTFLG # IF LISTING IS REQUESTED #
  263. THEN
  264. BEGIN
  265. WRITER(OUTPUT); # FLUSH CIO BUFFER FOR OUTPUT FILE #
  266. END
  267. MESSAGE(LFGCOMP,SYSLOC); # *LFG COMPLETE.* #
  268. END TERM
cdc/nos2.source/nam5871/lfgmain.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator