User Tools

Site Tools


cdc:nos2.source:nam5871:lfgrefp

LFGREFP

Table Of Contents

  • [00007] REFORMAT PICB.

Source Code

LFGREFP.txt
  1. *DECK LFGREFP
  2. USETEXT LFGFET,LFGIOD,LFGFN,LFGIB,LFGWB
  3. PROC LFGREFP(PN,WC,SUCCESS,DIRBUF);
  4. BEGIN # REFORMAT PICB #
  5. *IF DEF,IMS
  6. #
  7. ** LFGREFP - REFORMAT PICB.
  8. *
  9. * M. E. VATCHER 81/02/23
  10. *
  11. * LFGREFP REFORMATS A PICB AND WRITES IT TO THE NLF.
  12. *
  13. * PROC LFGREFP(PN,WC,SUCCESS)
  14. *
  15. * ENTRY PN PARTITION NAME
  16. * WC 16 BIT WORD COUNT OF INPUT RECORD
  17. *
  18. * EXIT SUCCESS SUCCESSFUL COMPLETION INDICATOR
  19. *
  20. * METHOD
  21. *
  22. * READ A RECORD
  23. * SAVE CURRENT RANDOM INDEX ON NLF
  24. * PUT PARTITION NAME IN FIRST WORD OF PICB
  25. * PUT NDCB ADDRESS IN SECOND WORD OF PICB
  26. * WHILE THERE ARE STILL DIRECTIVES IN THE INPUT BUFFER
  27. * GET NEXT 64 BIT DIRECTIVE FROM THE INPUT BUFFER
  28. * REFORMAT THE DIRECTIVE
  29. * WRITE PICB TO NLF
  30. * MAKE A DIRECTORY ENTRY FOR THE PICB
  31. * END
  32. *
  33. #
  34. *ENDIF
  35.  
  36. #
  37. **** PROC LFGREFP - XREF LIST BEGIN.
  38. #
  39.  
  40. XREF
  41. BEGIN
  42. ITEM IFET U; # FWA OF INPUT FILE FET #
  43. ITEM OUTPUT U; # FWA OF OUTPUT FILE FET #
  44. ITEM WFET U; # FWA OF NLF FET #
  45.  
  46. PROC LFGMDE; # MAKE DIRECTORY ENTRY #
  47. PROC LFGRDER; # SEND READ ERROR MESSAGE #
  48. PROC LFGRDSR; # READ SEQUENTIAL RECORD #
  49. PROC WRITEC; # WRITE LINE TO CIO BUFFER #
  50. PROC WRITER; # WRITE RECORD #
  51. FUNC XCDD C(10); # CONVERT INTEGER TO DECIMAL DISPLAY CODE #
  52. FUNC XSFW C(10); # SPACE FILL WORD #
  53. END
  54.  
  55. #
  56. ****
  57. #
  58.  
  59.  
  60. ITEM CODE U; # DIRECTIVE CODE #
  61. ITEM CRI U; # CURRENT RANDOM INDEX ON NLF #
  62. ITEM DIRC U; # DIRECTIVE COUNT #
  63. ITEM ENDS U; #NUMBER OF END DIRECTIVES #
  64. ITEM I U; #LOOP INDEX #
  65. ITEM IBIT U; # CURRENT INPUT BIT IN IBUF #
  66. ITEM IWORD U; # CURRENT INPUT WORD IN IBUF #
  67. ITEM J U; # LOOP INDEX #
  68. ITEM OWORD U; # LAST 60 BITS OF 64 BIT DIRECTIVE #
  69. ITEM PN C(10); # PARTITION NAME #
  70. ITEM STATIS U;
  71. ITEM SUCCESS B;
  72. ITEM TEMPC C(10);
  73. ITEM WC U; # 16 BIT WORD COUNT OF INPUT RECORD #
  74. ARRAY DIRBUF [0:0] S(2); # DIRECTORY BUFFER #
  75. BEGIN
  76. ITEM DIR$ENT I(00,00,60);
  77. END
  78.  
  79. ARRAY MANYEND [0:0] S(5);
  80. BEGIN
  81. ITEM MANYEND1 C(0,0,45) =
  82. [" TOO MANY END DIRECTIVES ON XXXXXXX FILE NNN."];
  83. ITEM MANYLFN C(2,48,7);
  84. ITEM MANYFILE C(4,6,3);
  85. ITEM MANYZ U(4,30,30) = [ 0 ];
  86. END
  87.  
  88. ARRAY ILLDIR [0:0] S(5);
  89. BEGIN
  90. ITEM ILLDIR1 C(0,0,47) =
  91. [" BAD DIRECTIVE IN PICB ON XXXXXXX FILE NNN."];
  92. ITEM ILLLFN C(3,0,7);
  93. ITEM ILLFILE C(4,18,3);
  94. ITEM ILLZ U(4,42,18) = [ 0 ];
  95. END
  96.  
  97. ARRAY FEWEND [0:0] S(6);
  98. BEGIN
  99. ITEM FEWEND1 C(0,0,55) =
  100. [" NOT ENOUGH END DIRECTIVES IN PICB IN XXXXXXX FILE NNN."];
  101. ITEM FEWLFN C(3,48,7);
  102. ITEM FEWFILE C(5,6,3);
  103. ITEM FEWZ U(5,30,30) = [ 0 ];
  104. END
  105. CONTROL EJECT;
  106. PROC REFDUMP(OWORD);
  107. BEGIN
  108.  
  109. ITEM OWORD U;
  110.  
  111. B<0,4>WBUF[J] = 0;
  112. B<4,8>WBUF[J] = B<0,4>OWORD;
  113. B<12,24>WBUF[J] = B<4,24>OWORD; # BEGINNING ADDRESS #
  114. B<36,24>WBUF[J] = B<36,24>OWORD; # ENDING ADDRESS #
  115. END
  116.  
  117.  
  118. PROC REFLOAD(OWORD);
  119. BEGIN
  120.  
  121. *CALL LFGASCI
  122.  
  123. ITEM OWORD U;
  124. ITEM ACHAR U;
  125.  
  126. WBUF[J] = 0; # CLEAR ENTRY #
  127. B<0,4>WBUF[J] = 1; # LOAD CODE #
  128. ACHAR = B<5,7>OWORD;
  129. B<12,6>WBUF[J] = C<ACHAR,1>ASCIITAB; # CONVERT TO DISPLAY CODE #
  130. ACHAR = B<13,7>OWORD;
  131. B<18,6>WBUF[J] = C<ACHAR,1>ASCIITAB;
  132. ACHAR = B<21,7>OWORD;
  133. B<24,6>WBUF[J] = C<ACHAR,1>ASCIITAB;
  134. ACHAR = B<29,7>OWORD;
  135. B<30,6>WBUF[J] = C<ACHAR,1>ASCIITAB;
  136. ACHAR = B<37,7>OWORD;
  137. B<36,6>WBUF[J] = C<ACHAR,1>ASCIITAB;
  138. ACHAR = B<45,7>OWORD;
  139. B<42,6>WBUF[J] = C<ACHAR,1>ASCIITAB;
  140. END
  141.  
  142.  
  143. PROC REFSTART(OWORD);
  144. BEGIN
  145.  
  146. ITEM OWORD U;
  147.  
  148. B<0,4>WBUF[J] = 2; # START CODE #
  149. B<4,8>WBUF[J] = B<0,4>OWORD;
  150. B<12,48>WBUF[J] = 0;
  151. END
  152.  
  153.  
  154. PROC REFSNCB(OWORD);
  155. BEGIN # REFORMAT SEND NCB DIRECTIVE #
  156.  
  157. ITEM OWORD U;
  158.  
  159. B<0,4>WBUF[J] = 5; # SEND NCB CODE #
  160. B<4,8>WBUF[J] = 0;
  161. B<12,24>WBUF[J] = B<4,24>OWORD; # BEGINNING ADDRESS #
  162. B<36,8>WBUF[J] = 0;
  163. B<44,16>WBUF[J] = B<44,16>OWORD; # SIZE OF NCB #
  164. END
  165.  
  166.  
  167. PROC REFOTHER(CODE);
  168. BEGIN # REFORMAT OTHER KIND OF DIRECTIVE #
  169.  
  170. ITEM CODE U;
  171.  
  172. B<0,4>WBUF[J] = CODE;
  173. B<4,56>WBUF[J] = 0;
  174. END
  175. CONTROL EJECT;
  176. PROC GN64B(CODE,OWORD);
  177. BEGIN # GET NEXT 64 BITS #
  178.  
  179. ITEM BITCOUNT U;
  180. ITEM CODE U;
  181. ITEM OBIT U;
  182. ITEM OWORD U;
  183.  
  184. CODE = 0;
  185. OWORD = 0;
  186. B<56,4>CODE = B<IBIT,4>IBUF[IWORD]; # GET FIRST FOUR BITS #
  187. IBIT = IBIT + 4;
  188. BITCOUNT = 4; #NUMBER OF BITS TRANSFERRED #
  189. IF IBIT EQ 60
  190. THEN # GO ON TO NEXT INPUT WORD #
  191. BEGIN
  192. IBIT = 0;
  193. IWORD = IWORD + 1;
  194. END
  195.  
  196. # GET BITS UNTIL INPUT WORD BOUNDARY #
  197.  
  198. B<0,60 - IBIT>OWORD = B<IBIT,60 - IBIT>IBUF[IWORD];
  199. OBIT = 60 - IBIT; # SAVE TO GET BITS FROM NEXT INPUT WORD #
  200. BITCOUNT = BITCOUNT + 60 - IBIT;
  201. IBIT = 0;
  202. IWORD = IWORD + 1;
  203. IF BITCOUNT EQ 64
  204. THEN
  205. RETURN; # ***** EXIT ***** #
  206.  
  207. # GET REST OF BITS FROM NEXT INPUT WORD #
  208.  
  209. B<OBIT,64-BITCOUNT>OWORD = B<0,64 - BITCOUNT>IBUF[IWORD];
  210. IBIT = 64 - BITCOUNT;
  211. END
  212. CONTROL EJECT; # REFPICB CODE STARTS HERE #
  213. SUCCESS = TRUE;
  214. ENDS = 0;
  215. IBIT = 0;
  216. IWORD = 0;
  217. LFGRDSR(LOC(IFET),STATIS); # READ PICB #
  218. IF STATIS NQ RDEOR AND STATIS NQ RDBFULL
  219. THEN
  220. BEGIN
  221. LFGRDER(STATIS);
  222. SUCCESS = FALSE;
  223. RETURN; # ***** EXIT ***** #
  224.  
  225. END
  226. P<SIOFET> = WFET;
  227. CRI = FETCRI[0]; # SAVE CURRENT RANDOM INDEX ON NLF #
  228. FETOUT[0] = FETFST[0]; # FETIN IS SET LATER #
  229. B<0,36>WBUF[0] = B<0,36>PN; # PUT IN VARIANT NAME #
  230. B<36,24>WBUF[0] = 0;
  231. B<0,36>WBUF[1] = 0;
  232. GN64B(CODE,OWORD);
  233. B<36,24>WBUF[1] = B<36,24>OWORD; # PUT IN NDCB ADDRESS #
  234. B<0,24>WBUF[2] = "DPCB"; # DPCB HEADER #
  235. B<24,36>WBUF[2] = 0;
  236. DIRC = WC/4 - 1; # NUMBER OF DIRECTIVES #
  237. J = 3;
  238. FOR I = 1 STEP 1 UNTIL DIRC DO
  239. BEGIN
  240. GN64B(CODE,OWORD); # GET NEXT 64 BITS #
  241. IF CODE EQ 0
  242. THEN
  243. REFDUMP(OWORD);
  244. ELSE IF CODE EQ 1
  245. THEN
  246. REFLOAD(OWORD);
  247. ELSE IF CODE EQ 2
  248. THEN
  249. REFSTART(OWORD);
  250. ELSE IF CODE EQ 5
  251. THEN
  252. REFSNCB(OWORD);
  253. ELSE IF CODE EQ 4 OR CODE EQ 6
  254. THEN
  255. REFOTHER(CODE);
  256. ELSE IF CODE EQ 15
  257. THEN
  258. BEGIN
  259. ENDS = ENDS + 1;
  260. IF ENDS GQ 4
  261. THEN # TOO MANY END DIRECTIVES #
  262. BEGIN
  263. TEMPC = XSFW(FNAME[LFN]);
  264. MANYLFN[0] = C<0,7>TEMPC;
  265. TEMPC = XCDD(FILENUM);
  266. MANYFILE[0] = C<7,3>TEMPC; # SET FILE NUMBER IN MESSAGE #
  267. WRITEC(OUTPUT,MANYEND);
  268. WRITER(OUTPUT,"R"); # SEND MESSAGE TO OUTPUT #
  269. SUCCESS = FALSE;
  270. RETURN; # ***** EXIT ***** #
  271.  
  272. END
  273. REFOTHER(CODE);
  274. IF ENDS EQ 1
  275. THEN # END OF DPCB #
  276. BEGIN
  277. J = J + 1;
  278. B<0,24>WBUF[J] = "LPCB"; # PUT IN LPCB HEADER #
  279. B<24,36>WBUF[J] = 0;
  280. B<24,12>WBUF[1] = J - 2; # SAVE DPCB LENGTH #
  281. END
  282. ELSE IF ENDS EQ 2
  283. THEN # END OF LPCB #
  284. BEGIN
  285. J = J + 1;
  286. B<0,24>WBUF[J] = "SPCB";
  287. B<24,36>WBUF[J] = 0;
  288. B<12,12>WBUF[1] = J - 2 - B<24,12>WBUF[1]; # LPCB LENGTH #
  289. END
  290. ELSE IF ENDS EQ 3
  291. THEN # FILL IN SPCB LENGTH #
  292. BEGIN
  293. B<0,12>WBUF[1] = J - 1 - B<12,12>WBUF[1]
  294. - B<24,12>WBUF[1]; # LENGTH OF SPCB #
  295. END
  296. END
  297. ELSE
  298. BEGIN # ILLEGAL DIRECTIVE CODE #
  299. TEMPC = XSFW(FNAME[LFN]);
  300. ILLLFN[0] = C<0,7>TEMPC;
  301. TEMPC = XCDD(FILENUM);
  302. ILLFILE[0] = C<7,3>TEMPC;
  303. WRITEC(OUTPUT,ILLDIR);
  304. WRITER(OUTPUT,"R"); # SEND MESSAGE TO OUTPUT #
  305. SUCCESS = FALSE;
  306. RETURN; # ***** EXIT ***** #
  307.  
  308. END
  309. J = J + 1;
  310. END #GET NEXT 64 BITS #
  311. IF ENDS LQ 2
  312. THEN # NOT ENOUGH END DIRECTIVES #
  313. BEGIN
  314. TEMPC = XSFW(FNAME[LFN]);
  315. FEWLFN[0] = C<0,7>TEMPC;
  316. TEMPC = XCDD(FILENUM);
  317. FEWFILE[0] = C<7,3>TEMPC;
  318. WRITEC(OUTPUT,FEWEND);
  319. WRITER(OUTPUT,"R");
  320. SUCCESS = FALSE;
  321. RETURN; # ***** EXIT ***** #
  322.  
  323. END
  324. FETIN[0] = FETFST[0] + DIRC + 5;
  325. WRITER(SIOFET,"R");
  326. LFGMDE(PN,CRI,DIRC + 5,SUCCESS,DIRBUF);
  327. END TERM
cdc/nos2.source/nam5871/lfgrefp.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator