Table of Contents

DMSSRT Source

References

Source Listing

DMSSRT.ASSEMBLE.txt
  1. SRT TITLE 'DMSSRT (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * 00004000
  5. * 00005000
  6. * 00006000
  7. * 00007000
  8. * MODULE NAME: 00008000
  9. * 00009000
  10. * DMSSRT (SORT) 00010000
  11. * 00011000
  12. * FUNCTION: 00012000
  13. * 00013000
  14. * TO ARRANGE RECORDS WITHIN A FILE IN A DESCENDING 00014000
  15. * SEQUENTIAL ORDER. 00015000
  16. * 00016000
  17. * ATTRIBUTES: 00017000
  18. * 00018000
  19. * DISK RESIDENT 00019000
  20. * 00020000
  21. * ENTRY POINTS: 00021000
  22. * 00022000
  23. * DMSSRT - 00023000
  24. * 00024000
  25. * ENTRY CONDITIONS: 00025000
  26. * 00026000
  27. * GPR1 = A(PLIST) 00027000
  28. * 00028000
  29. * PLIST DC CL8'SORT' 00029000
  30. * DC CL16'FILEID1' FILENAME,FILETYPE,FILEMODE 00030000
  31. * DC CL16'FILEID2' FILENAME,FILETYPE,FILEMODE 00031000
  32. * DC XL8'FENCE' 00032000
  33. * 00033000
  34. * EXIT CONDITIONS: 00034000
  35. * 00035000
  36. * NORMAL - GPR15 = 0 00036000
  37. * 00037000
  38. * ERROR - GPR15 = NON-ZERO 00038000
  39. * 20 INVALID '*' IN FILEID 00039000
  40. * 24 INVALID PARAMETER 00040000
  41. * 24 INCOMPLETE FILEID 00041000
  42. * 28 INPUT FILE1 NOT FOUND 00042000
  43. * 24 INCOMPLETE SORT FIELD PAIR DEFINITION 00043000
  44. * 24 SORT COLUMN EXCEEDS RECORD LENGTH 00044000
  45. * 32 INPUT FILE NOT FIXED FORMAT 00045000
  46. * 24 FILEID 1 & 2 IDENTICAL 00046000
  47. * 24 NO LIST ENTERED 00047000
  48. * 24 INVALID DISK MODE 00048000
  49. * 36 OUTPUT DISK IS READ/ONLY 00049000
  50. * 36 TARGET DISK NOT ACCESSED @VA12416 00049250
  51. * 40 MAX NUMBER OF RECORDS EXCEEDED 00049500
  52. * 100 ERROR READING/WRITING FILE 00050000
  53. * 00051000
  54. * EXTERNAL REFERENCES: 00052000
  55. * 00053000
  56. * DMSCWR, DMSBWR, DMSBRD, DMSSTT 00054000
  57. * DMSFRE, DMSFNS, DMSCRD, DMSERR 00055000
  58. * 00056000
  59. * REGISTER USAGE: 00057000
  60. * 00058000
  61. * BASE = GPR12 00059000
  62. * WORK REGISTER = ALL OTHERS 00060000
  63. * 00061000
  64. * OPERATION: 00062000
  65. * 00063000
  66. * FROM THE REQUESTED FIELD DEFINITIONS, SORT SETS UP AN 00064000
  67. * ORDERED SERIES OF MVC'S AT THE BEGINNING OF THE FREE 00065000
  68. * AREA, IN WHICH THE 'FROM' FIELD IS INPUT RECORD FIELD 00066000
  69. * LOCATION, THE LENGTH IS THE LENGTH OF THE FIELD, AND 00067000
  70. * THE 'TO' LOCATION IS THE START OF THE DISTRIBUTION 00068000
  71. * BUFFER PLUS THE LENGTH OF ANY FIELDS WHICH HAVE COME 00069000
  72. * BEFORE. THUS, A PRIMARY FIELD OF LENGTH 5 WOULD BE 00070000
  73. * MOVED INTO DISTRIBUTION BUFFER LOCATION 0, WHILE THE 00071000
  74. * SECONDARY FIELD, IF ANY WOULD BE MOVED INTO 00072000
  75. * DISTRIBUTION BUFFER LOCATION 0 PLUS 5. THUS A SINGLE 00073000
  76. * CONTIGUOUS SORT ELEMENT IS CREATED WHOSE LENGTH IS 00074000
  77. * THE TOTAL LENGTH OF ALL THE FIELDS. 00075000
  78. * 00076000
  79. * RECORDS ARE READ IN ONE AT A TIME INTO CONTIGUOUS 00077000
  80. * AREAS OF STORAGE. A SORT ELEMENT IS CREATED WHICH IS 00078000
  81. * THEN PLACED IN ASCENDING ORDER IN A SORT TREE, WHERE 00079000
  82. * EACH ENTRY HAS THE FOLLOWING FORMAT: 00080000
  83. * 00081000
  84. * DC AL3(LOW) 00082000
  85. * DC AL3(HIGH) 00083000
  86. * DC AL3(BACK) 00084000
  87. * DC XL1(FLAG) 00085000
  88. * DC AL2(CNT) 00086000
  89. * DC AL ELEMENT LENGTH PLUS 2 BYTES FOR ITEM NO. 00087000
  90. * 00088000
  91. * LOW IS ADDRESS OF NEXT LOWER ENTRY 00089000
  92. * HIGH IS ADDRESS OF NEXT HIGHER ENTRY 00090000
  93. * BACK IS BACK POINTER TO PREVIOUS ENTRY 00091000
  94. * FLAG IS USED IN UNWINDING THE TREE TO MARK A DELETED ELEM 00092000
  95. * CNT INDICATES NUMBER OF DUPLICATES 00093000
  96. * 00094000
  97. * WHEN THE TREE HAS BEEN COMPLETED, THE CHAIN IS 00095000
  98. * SEARCHED FOR THE LOWEST ELEMENT, WHICH IS SIGNIFIED 00096000
  99. * BY A LOW FIELD OF ALL ZEROS. THE FLAG IS SET TO 00097000
  100. * 'USED'. RDBUF IS CALLED WITH THE ITEMNO WHICH WAS 00098000
  101. * SAVED IN THE MODE. WRBUF WRITES THE RECORD OUT ON 00099000
  102. * DISK. THE CHAIN IS THEN UNWOUND UPWARDS, WITH EACH 00100000
  103. * DELETED ENTRY BEING FLAGGED AND THE CORRESPONDING 00101000
  104. * RECORD WRITTEN OUT, UNTIL THE ENTIRE TREE IS 00102000
  105. * EXHAUSTED AND THE SORTED FILE IS WRITTEN. THE INPUT 00103000
  106. * AND OUTPUT FILES ARE CLOSED, STORAGE IS RELEASED, THE 00104000
  107. * PAGES RELEASED, AND CONTROL IS PASSED BACK TO THE 00105000
  108. * CALLER. 00106000
  109. * 00107000
  110. *. 00108000
  111. EJECT 00109000
  112. DMSSRT START X'0' 00110000
  113. USING DMSSRT,R12 00111000
  114. LR R12,R15 00112000
  115. ST R14,CMSRET 00113000
  116. DMSKEY NUCLEUS DISABLE NUCLEUS PROTECT 00114000
  117. USING NUCON,R0 00115000
  118. MVC DOSF(1),DOSFLAGS SAVE CURR. SET OF DOSFLAGS @V305001 00115100
  119. NI DOSFLAGS,255-DOSSVC TURN DOSSVC FLAF OFF @V305001 00115200
  120. CLI 8(1),X'FF' 00116000
  121. BE ERR54E 00117000
  122. CLI 8(R1),C'*' 00118000
  123. BE ERR62I '*' IS NO-NO IN FILEID 00119000
  124. CLI 16(1),X'FF' 00120000
  125. BE ERR54E 00121000
  126. CLI 16(R1),C'*' 00122000
  127. BE ERR62I 00123000
  128. CLI 24(1),X'FF' 00124000
  129. BE ERR54E 00125000
  130. CLI 32(1),X'FF' RAM 00126000
  131. BE ERR54E 00127000
  132. CLI 32(R1),C'*' 00128000
  133. BE ERR62O NO '*' IN OUT FILEID EITHER 00129000
  134. CLI 40(R1),X'FF' 00130000
  135. BE ERR54E 00131000
  136. CLI 40(R1),C'*' 00132000
  137. BE ERR62O 00133000
  138. CLI 48(R1),X'FF' 00134000
  139. BE ERR54E 00135000
  140. CLC 48(2,R1),RDMODE CHECK WRITE MODE FOR '*' 00136000
  141. BNE GARCHK 00137000
  142. MVC 48(2,R1),WRMODE IF SO, FORCE 'A1' MODE 00138000
  143. GARCHK CLI 56(R1),X'FF' CHEK XTRA OPTIONS 00139000
  144. BNE ERR70E ERROR IF ANY MORE 00140000
  145. * 00141000
  146. LR R2,R1 SAVE COMMAND PLIST PTR 00142000
  147. MVC RDFN(18),8(R1) MOVE IN THE INPUT FILEID 00143000
  148. MVC WRFN(18),32(R1) MOVE IN OUTPUT FILEID 00144000
  149. LA 1,RDPLST CALL STATE FOR INPUT 00145000
  150. SVC 202 00146000
  151. DC AL4(*+4) 00147000
  152. LTR R15,R15 00148000
  153. BZ FSTAD FILE FOUND WITH NO PROBLEMS 00149000
  154. CH R15,=H'28' 00150000
  155. BE ERR2E FILE NOT FOUND 00151000
  156. CH R15,=H'36' DISK NOT ACCESSED @VA12416 00151100
  157. LA R2,RDMODE POINT TO DISK MODE @VA12416 00151200
  158. BE ERRMSG36 YES, ISSUE MSG69E @VA12416 00151300
  159. B ERET DISK OR SYNTAX ERROR 00152000
  160. FSTAD L 2,DATABF GET FST ADDRESS 00153000
  161. CLI 30(2),C'F' IS IT FIXED LENGTH? 00154000
  162. BNE ERR34E 00155000
  163. L 3,32(,2) GET RECORD SIZE 00156000
  164. ST 3,INSIZE PUT IT INTO PLIST 00157000
  165. STATEOUT LA 1,WRPLST NOW FIND OUT IF OUTPUT ALREADY EXISTS 00158000
  166. SVC 202 00159000
  167. DC AL4(*+4) 00160000
  168. LTR R15,R15 00161000
  169. BZ CHKSAME FILE FOUND, ERASE IT 00162000
  170. CH R15,=H'28' 00163000
  171. BE NOTTHERE FILE NOT FOUND 00164000
  172. CH R15,=H'36' DISK NOT ACCESSED @VA12416 00164100
  173. LA R2,WRMODE POINT TO DISK MODE @VA12416 00164200
  174. BE ERRMSG36 YES, ISSUE MSG69E @VA12416 00164300
  175. B ERET DISK OR SYNTAX ERROR 00165000
  176. CHKSAME EQU * @VA09700 00166000
  177. CLC WRFN(17),RDFN INPUT/OUTPUT FILES THE SAME.? @VA09700 00166500
  178. BE ERR19E YES 00167000
  179. MVC WROPTN(8),=CL8'ERASE' 00168000
  180. L 2,WRBUF GET FST ADDRESS 00169000
  181. LA 1,WRPLST GO ERASE THE OLD FILE 00170000
  182. SVC 202 00171000
  183. DC AL4(*+4) 00172000
  184. B SAMESIZE 00173000
  185. NOTTHERE LA R1,WRPLST 00174000
  186. L R15,VCADTLKW GET ADDRESS OF ADTLKW. @VM03093 00175100
  187. BALR R14,R15 00176000
  188. BC 2,ERR37E 00177000
  189. SAMESIZE MVC WRSIZE(4),INSIZE AND SAME RECORD SIZE 00178000
  190. LR R1,R2 RESTORE PLIST POINTR 00179000
  191. * 00180000
  192. CLI WRMODE+1,C' ' BLANK MODE NUMBER? P3037 00181000
  193. BNE SKIP P3037 00182000
  194. MVI WRMODE+1,C'1' IF SO, DEFAULT '1' P3037 00183000
  195. SKIP EQU * P3037 00184000
  196. CLI WRMODE,C'*' CAN'T WRITE TO '*' 00185000
  197. BNE R604 00186000
  198. MVC WRMODE(2),=CL2'A1' FORCE WRITES TO A-DISK 00187000
  199. R604 DS 0H HRC323DS 00187020
  200. LH R15,NUMFINRD get number of lines in the stack HRC323DS 00187040
  201. LTR R15,R15 HRC323DS 00187060
  202. BNZ NOTYPE skip next msg if line in stack HRC323DS 00187080
  203. DMSERR NUM=604,LET=R,TEXT='Enter sort fields: ',DOT=NO RC323DS 00188000
  204. * WHILE TYPING, SETUP FREE CORE 00189000
  205. NOTYPE DS 0H HRC323DS 00189020
  206. L R15,ASTRINIT CALL 'STRINIT 00190000
  207. BALR 14,15 00191000
  208. GETMAIN VU,LA=LENGTHS,A=GENBUF GET ALL STORAGE WE CAN @VA04199 00196000
  209. L R1,GENBUF GET STARTING FREE ADDRESS @VA04199 00197000
  210. A 1,FREESIZE COMPUTE END OF CORE 00198000
  211. BCTR 1,0 SUBTRACT 1 00199000
  212. ST 1,AFREEND PLACE IT INTO THE 'TREE' PLIST 00200000
  213. LA R1,CONRDLST READ FIELDS FROM TERMINAL 00201000
  214. SVC 202 00202000
  215. DC AL4(*+4) 00203000
  216. B CONTINUE 00204000
  217. CONRDLST DS 0D 00205000
  218. DC CL8'WAITRD' 00206000
  219. DC AL1(1) 00207000
  220. DC AL3(CONBUF) 00208000
  221. DC C'U' 00209000
  222. NCH DC AL3(0) 00210000
  223. CONTINUE DS 0H 00211000
  224. LH 3,NCH+1 GET NUMBER OF CHARACTERS READ 00212000
  225. LTR 3,3 00213000
  226. BZ ERR63E IF ZERO, NULL LINE 00214000
  227. ST 3,SCNCH NON-ZERO, SET LENGTH FOR SCAN 00215000
  228. LA 1,SCNCH SET R1 FOR 'SCAN' 00216000
  229. L 15,ASCANO CALL SCAN 00217000
  230. BALR 14,15 00218000
  231. EJECT 00219000
  232. L 5,GENBUF 00220000
  233. SR 6,6 SET STARTING 'TO' DISPLACEMENT 00221000
  234. GENLP CLI 0(1),X'FF' DOES FIRST OF PAIR EXIST? 00222000
  235. BE ENDLINE NO, GO CLEANUP AND START 00223000
  236. CLI 8(1),X'FF' DOES SECOND OF PAIR EXIST? 00224000
  237. BE ERR53E NO, ERROR 00225000
  238. L 4,0(,1) GET 'SC' 00226000
  239. BAL 14,BD2BN GO CONVERT IT 00227000
  240. ST 4,SC SAVE IT 00228000
  241. L 4,8(,1) GET 'EC' 00229000
  242. BAL 14,BD2BN GO CONVERT IT 00230000
  243. S 4,SC COMPUTE 'MVC' COUNT FIELD 00231000
  244. BM ERR53E IF MINUS, ERROR 00232000
  245. MVC 0(L'MVC,5),MVC MOVE INTO FREE CORE THE MVC 00233000
  246. STC 4,1(,5) INSERT THE COUNT FIELD 00234000
  247. STC 6,3(,5) SET 'TO' DISPLACEMENT 00235000
  248. LA 6,1(4,6) UPDATE THE TO DISP. 00236000
  249. L 7,SC GET 'SC' 00237000
  250. BCTR 7,0 REDUCE BY 1 00238000
  251. LH 8,4(,5) GET MVC FROM FIELD 00239000
  252. OR 8,7 'OR' IN THE FROM DISP. 00240000
  253. STH 8,4(,5) PUT IT BACK INTO THE 'MVC' 00241000
  254. LA 5,L'MVC(,5) 00242000
  255. LA 1,16(,1) UPDATE PARAM POINTER 00243000
  256. B GENLP 00244000
  257. * 00245000
  258. MVC MVC *-*(*-*,3),*-*(2) DUMMY MVC FOR GENERATION 00246000
  259. BR BR 9 DUMMY BR FOR GENERATION 00247000
  260. SC DS F SUBFIELD STARTING CHARACTER 00248000
  261. EJECT 00249000
  262. ENDLINE MVC 0(L'BR,5),BR MOVE THE BRANCH CODE INTO CORE 00250000
  263. LA 5,L'BR(,5) UPDATE R5 00251000
  264. ST 5,AFREES SAVE NEW FREE ADDRESS 00252000
  265. L 3,INSIZE SETUP BUFFER SPACE 00253000
  266. L 4,AFREES 00254000
  267. ST 4,DATABF 00255000
  268. ST 4,WRBUF 00256000
  269. AR 4,3 COMPUTE NEW FREE AREA ADDRESS 00257000
  270. MVC RDOPTN,=CL8'RDBUF' SET PLIST FOR READ 00258000
  271. MVC WROPTN,=CL8'WRBUF' AND WRITE 00259000
  272. ST 4,DBUF SET DISTRIBUTION BUFFER ADDRESS 00260000
  273. C R6,=F'253' SORT FIELD > 253 00261000
  274. BH ERR53E YES, ERROR 00262000
  275. ST 6,FLDLEN SAVE ACTUAL SORT FIELD LENGTH 00263000
  276. STC 6,MVCITMNO+3 SET DISP. FOR ITMNO MVC 00264000
  277. LA 6,2(,6) UPDATE BUFFER LENGTH FOR ITMNO 00265000
  278. STC 6,DBUF SET IT INOT THE 'TREE' PLIST 00266000
  279. AR 4,6 COMPUTE NEW FREE ADDRESS 00267000
  280. ST 4,AFREES 00268000
  281. LA 9,MVCITMNO SET R9 FOR GENERATED 'BR' 00269000
  282. L 10,GENBUF SET R10 FOR BRANCH INTO GENERATED 'MVC'S 00270000
  283. EJECT 00271000
  284. L 3,DBUF GET DISTRIBUTION BUFFER ADDRESS 00272000
  285. L 2,DATABF GET DATA BUFFER ADDRESS 00273000
  286. RDLP LA 1,RDPLST CALL RDBUF FOR AN INPUT RECORD 00274000
  287. SVC 202 .. 00275000
  288. DC AL4(*+4) .. 00276000
  289. LH 4,RCNT UPDATE INPUT ITEM NO. 00277000
  290. LA 4,1(,4) .. 00278000
  291. STH 4,RCNT .. 00279000
  292. LTR 15,15 ANY READ ERRORS? 00280000
  293. BCR 8,10 NO, GO MOVE SORT FIELDS TO 'DBUF' 00281000
  294. CH 15,=H'12' YES, IS IT EOF? 00282000
  295. BNE ERR104S NO, BAD NEWS 00283000
  296. BCTR 4,0 REDUCE COUNT BY ONE 00284000
  297. EOF L 2,FLDLEN YES, SET R2 TO TOTAL SORT FIELD LENGTH 00285000
  298. WRTLP LA 1,ATREE GET 'TSRCH' PLST ADDRESS 00286000
  299. BAL R14,TSRCH 00287000
  300. LTR 15,15 WAS AN ELEMENT GOTTEN? 00288000
  301. BNZ FINIS NO, WE ARE ALL FINISHED 00289000
  302. LA 3,12(1,2) YES, SET R3 TO ADDRESS OF ITEMNO 00290000
  303. MVC INITMNO(2),0(3) AND MOVE IT TO READ PLIST 00291000
  304. LA 1,RDPLST NOW GO READ THAT ITEM INTO CORE 00292000
  305. SVC 202 .. 00293000
  306. DC AL4(ERR104S) ANY ERRORS NOW ARE BAD 00294000
  307. LA 1,WRPLST NOW WRITE THE RECORD OUT SEQUENTALLY 00295000
  308. SVC 202 .. 00296000
  309. DC AL4(ERR105S) SO ARE WRITE ERRORS 00297000
  310. B WRTLP GO BACK FOR NEXT RECORD 00298000
  311. * 00299000
  312. MVCITMNO MVC *-*(2,3),RCNT SORT FIELD MOVED, GET CURRENT ITMNO 00300000
  313. LA 1,TPLST NOW CALL 'TREE' WITH ITS PLIST 00301000
  314. BAL 14,TREE 00302000
  315. LTR 15,15 WAS ELEMENT PROCESSED CORRECTLY? 00303000
  316. BZ RDLP YES, GO GET RECORD FOR NEXT ELEMENT 00304000
  317. B ERR212E @VA01057 00305000
  318. FINIS MVC RDOPTN,=CL8'FINIS' CLOSE INPUT FILE 00306000
  319. LA 1,RDPLST .. 00307000
  320. SVC 202 00308000
  321. DC AL4(*+4) .. 00309000
  322. MVC WROPTN,=CL8'FINIS' CLOSE OUTPUT FILE 00310000
  323. LA 1,WRPLST .. 00311000
  324. SVC 202 .. 00312000
  325. DC AL4(*+4) .. 00313000
  326. FREEMAIN V,A=GENBUF RELEASE OUR FREE STORAGE @VA04199 00315000
  327. RET SR 15,15 CLEAR ERROR FLAGS 00317000
  328. ERET LR R4,R15 SAVE RETURN CODE 00318000
  329. OI MISFLAGS,RELPAGES TURN PAGE REL. FLAG ON 00319000
  330. MVC DOSFLAGS(1),DOSF RESET DOSFLAGS @V305001 00319100
  331. DMSKEY RESET RESTORE NUCLEUS PROTECT 00320000
  332. L R14,CMSRET 00321000
  333. LR R15,R4 RESTORE RETURN CODE 00322000
  334. BR 14 00323000
  335. BD2BN EQU * DELETE TRAILING BLANKS AND CVB 00324000
  336. LA R2,4 4-BYTE LIMIT (REGISTER CONTENTS) 00325000
  337. ST R4,SAV5 SAVE IT FOR COMPARES 00326000
  338. LA R3,SAV5 00327000
  339. VALNUM CLI 0(R3),C' ' WE'RE LOOKING FOR INVALID CHARS 00328000
  340. BE NEXTD BLANKS WILL BE STRIPPED LATER 00329000
  341. CLI 0(R3),C'0' 00330000
  342. BL ERR53E HAS TO BE A NUMERIC 00331000
  343. CLI 0(R3),C'9' BETWEEN 0 AND 9 00332000
  344. BH ERR53E OR IT'S AN ERROR 00333000
  345. NEXTD LA R3,1(,R3) LOOK AT NEXT CHARACTER 00334000
  346. BCT R2,VALNUM 00335000
  347. * EVRYTHING IS O.K. AT THIS POINT 00336000
  348. ST R5,SAV5 SAVE FREE STORAGE POINTR 00337000
  349. CVTLP SR R5,R5 00338000
  350. SRDL R4,8 00339000
  351. CL R5,=X'40000000' DROP TRAILING BLANKS AFTER ENTRY 00340000
  352. BE CVTLP TRY ANOTHER BLANK 00341000
  353. SLDL R4,8 ALL BLANKS OUT, SHIFT BACK 00342000
  354. O R4,=C'0000' ZONE THE ZEROES 00343000
  355. ST R4,DEC SET UP ZONED DIGITS 00344000
  356. PACK DECD(8),DEC(4) FOR PACKING AND 00345000
  357. CVB R4,DECD CONVERSION TO BINARY 00346000
  358. C R4,INSIZE SORT ENTRY > LRECL? 00347000
  359. BH ERR9E YES, ERROR 00348000
  360. LTR R4,R4 SORT ENTRY OF '0' ILLEGAL 00349000
  361. BZ ERR53E 00350000
  362. L 5,SAV5 RESTORE FREE STORAGE POINTR 00351000
  363. BR 14 00352000
  364. SAV5 DS F 00353000
  365. EJECT 00354000
  366. * 00355000
  367. * SUBROUTINE NAME - 00356000
  368. * 00357000
  369. * TREE 00358000
  370. * 00359000
  371. * FUNCTION- 00360000
  372. * 00361000
  373. * TO SEARCH AN ORDERED DISTRIBUTION TREE FOR A PARTICULAR 00362000
  374. * ELEMENT. 00363000
  375. * 00364000
  376. * ENTRY CONDITIONS - 00365000
  377. * 00366000
  378. * GPR15 - A($$$SRRA) 00367000
  379. * GPR1 - A(PLIST) 00368000
  380. * PLIST - AL1(LENGTH),AL3(ELEMENT) 00369000
  381. * XL1'TFLAG' 00370000
  382. * AL3(ATREE) 00371000
  383. * A(STRTFREE) 00372000
  384. * A(ENDFREE) 00373000
  385. * 00374000
  386. * WHERE: 00375000
  387. * LENGTH - NO. OF CHARACTERS IN ELEMENT FIELD 00376000
  388. * ELEMENT - ADDRESS OF ELEMENT TO SEARCH FOR 00377000
  389. * TFLAG - A SWITCH FLAG TO INDICATE: 00378000
  390. * 80 - THE TREE HAS AT LEAST ONE ENTRY 00379000
  391. * 00 - THE TREE IS EMPTY 00380000
  392. * ATREE - STARTING ADDRESS OF THE SEARCH TREE; 00381000
  393. * WILL BE SET BY 'TREE' DURING FIRST 00382000
  394. * ENTRY TO VALUE IN 'STRTFREE'. 00383000
  395. * STRTFREE - ADDRESS OF LOWEST FREE CORE BYTE 00384000
  396. * INTO WHICH 'ATREE' MAY EXPAND. 'TREE' 00385000
  397. * WILL UPDATE THIS ADDRESS EACH TIME A 00386000
  398. * NEW ELEMENT IS BUILT. 00387000
  399. * ENDFREE - ADDRESS OF HIGHEST FREE CORE BYTE 00388000
  400. * INTO WHICH 'ATREE' MAY EXPAND. 00389000
  401. * 00390000
  402. * EXIT CONDITIONS - 00391000
  403. * 00392000
  404. * NORMAL - 00393000
  405. * GPR15 = 0 : ELEMENT PROCESSED CORRECTLY 00394000
  406. * 00395000
  407. * ERROR - 00396000
  408. * GPR15 = 4 : ELEMENT NOT FOUND AND NO CORE AVAILABLE 00397000
  409. * TO CREATE A NEW ELEMENT IN THE TABLE 00398000
  410. * 00399000
  411. * 00400000
  412. * TABLES | WORKAREAS - 00401000
  413. * 00402000
  414. * TREE TABLE ENTRY FORMAT: 00403000
  415. * 00404000
  416. * AL3(LOW) ADDRESS OF LOWER ELEMENT OR ZERO 00405000
  417. * AL3(HIGH) ADDRESS OF HIGHER ELEMENT OR ZERO 00406000
  418. * AL3(BACK) ADDRESS OF PREVIOUS NODE 00407000
  419. * XL1(FLAG) ATTACHED|DETACHED FLAG 00408000
  420. * AL2(CNT) FREQUENCY COUNT FOR ELEMENT 00409000
  421. * CL(LENGTH)'EE...EE' 00410000
  422. * 00411000
  423. * REGISTER USAGE - 00412000
  424. * 00413000
  425. * GPR2 - A(ELEMENT) 00414000
  426. * GPR3 - LENGTH OF ELEMENT 00415000
  427. * GPR4 - A(TREE) 00416000
  428. * GPR5 - A(FREE) FOR TREE BUILD 00417000
  429. * GPR14 - RETURN 00418000
  430. * GPR15 - ERROR CODE RETURN 00419000
  431. * 00420000
  432. * OPERATION - 00421000
  433. * 00422000
  434. * IF THE ELEMENT IS FOUND DURING THE SEARCH, A FREQUENCY COUNT 00423000
  435. * IS UPDATED; IF IT IS NOT FOUND, A NEW ELEMENT IS CREATED. 00424000
  436. * 00425000
  437. * 00426000
  438. TREE DS 0H 00427000
  439. STM R0,R14,SAVEAREA 00428000
  440. USING TREED,4 00429000
  441. SR 15,15 CLEAR ERROR FLAG 00430000
  442. SR 3,3 AND R3 00431000
  443. L 2,0(,1) R2 = A(ELEMENT) 00432000
  444. IC 3,0(,1) R3 = LENGTH 00433000
  445. BCTR 3,0 DECRIMENT FOR 'EX' MASK 00434000
  446. CLI 4(1),0 NEW TREE? 00435000
  447. BE BUILD YES, GO INSERT FIRST ENTRY 00436000
  448. L 4,4(,1) R4 = A(TREE) 00437000
  449. LOOP LA 6,3 SET R6 WITH HIGH FLAG 00438000
  450. EX 3,COMPARE COMPARE SEARCH/TREE ELEMENTS 00439000
  451. BE FOUND EQUAL? 00440000
  452. BL GOLOW NO, LOW? 00441000
  453. MVC NXTADR+1(3),HIGH NO, GET HIGH ELEM. ADDRESS 00442000
  454. B JOIN 00443000
  455. GOLOW MVC NXTADR+1(3),LOW IS LOW, GET LOW ELEM. ADDR. 00444000
  456. SR 6,6 RESET R6 WITH LOW FLAG 00445000
  457. JOIN L 5,NXTADR DOES NEXT TREE ELEMENT 00446000
  458. LTR 5,5 EXIST? 00447000
  459. BZ BUILD NO, GO BUILD ONE 00448000
  460. LR 4,5 YES, SET R4 00449000
  461. B LOOP AND LOOP 00450000
  462. * 00451000
  463. FOUND MVC ADDER,CNT ELEMENTS MATCHED 00452000
  464. LH 6,ADDER UPDATE 00453000
  465. LA 6,1(,6) TREE 00454000
  466. STH 6,ADDER FREQUENCY 00455000
  467. MVC CNT,ADDER COUNT 00456000
  468. RET2 LM R2,R14,SAVEAREA+8 00457000
  469. BR 14 00458000
  470. EJECT 00459000
  471. USING TREED,5 00460000
  472. BUILD L 5,8(,1) ELEM. NOT IN TREE, R5=A(FREE) 00461000
  473. LA 7,13(5,3) SET R7 TO NEW FREE ADDRESS 00462000
  474. C 7,12(,1) CORE OVERFLOW? 00463000
  475. BH FULL YES, GO SET ERROR FLA 00464000
  476. ST 7,8(,1) NO, RESET A(FREE) 00465000
  477. MVC TREED(12),INIT INITIALIZE FIXED ENTRY PORTION 00466000
  478. EX 3,MOVE MOVE INTO ENTRY THE ELEMENT FIELD 00467000
  479. CLI 4(1),X'80' FIRST ENTRY? 00468000
  480. BE NORMAL NO, BRANCH 00469000
  481. ST 5,4(,1) SET TREE ADDRESS FOR NEXT ENTRY 00470000
  482. MVI 4(1),X'80' SET TREE CREATED SWITCH 00471000
  483. B RET2 00472000
  484. * 00473000
  485. NORMAL EQU * 00474000
  486. ST 4,BKADR 00475000
  487. MVC BACK,BKADR+1 00476000
  488. ST 5,NXTADR SET NEW TREE ENTRY ADDRESS 00477000
  489. LA 4,0(6,4) IN CORRECT OLD 00478000
  490. MVC 0(3,4),NXTADR+1 ENTRY FIELD 00479000
  491. B RET2 00480000
  492. FULL MVI 4(1),0 RESET TREE EXISTANCE SWITCH 00481000
  493. LA 15,4 INDICATE FULL TABLE 00482000
  494. B RET2 00483000
  495. EJECT 00484000
  496. * CONSTANTS AND FORMATS 00485000
  497. * 00486000
  498. NXTADR DC A(0) 00487000
  499. BKADR EQU NXTADR 00488000
  500. ADDER DS H 00489000
  501. INIT DC XL12'1' 00490000
  502. * 00491000
  503. MOVE MVC ELEM,0(2) 00492000
  504. DROP 5 00493000
  505. USING TREED,4 00494000
  506. COMPARE CLC 0(1,2),ELEM 00495000
  507. EJECT 00496000
  508. * 00497000
  509. * SUBROUTINE NAME - 00498000
  510. * 00499000
  511. * TSRCH 00500000
  512. * 00501000
  513. * FUNCTION - 00502000
  514. * 00503000
  515. * TO FIND THE LOWEST VALUED ELEMENT IN AN ORDERED DISTRIBUTION 00504000
  516. * TREE. 00505000
  517. * 00506000
  518. * ENTRY CONDITIONS - 00507000
  519. * 00508000
  520. * GPR15 - A($$$SRSA) 00509000
  521. * GPR1 - A(PLIST) 00510000
  522. * PLIST - XL1'TFLAG',A(ATREE) 00511000
  523. * 00512000
  524. * WHERE: 00513000
  525. * TFLAG - A SWITCH FLAG TO INDICATE: 00514000
  526. * 80 - THE TREE HAS AT LEAST ONE ENTRY 00515000
  527. * 00 - THE TREE IS EMPTY 00516000
  528. * ATREE - STARTING ADDRESS OF THE SEARCH TREE 00517000
  529. * 00518000
  530. * EXIT CONDITIONS - 00519000
  531. * 00520000
  532. * NORMAL - 00521000
  533. * GPR15 = 0 : ELEMENT FOUND 00522000
  534. * GPR1 = A(ELEMENT) 00523000
  535. * 00524000
  536. * ERROR - 00525000
  537. * GPR15 = 4 : TREE IS EMPTY 00526000
  538. * 00527000
  539. * 00528000
  540. * TABLES | WORKAREAS - 00529000
  541. * 00530000
  542. * TREE TABLE ENTRY FORMAT: 00531000
  543. * 00532000
  544. * AL3(LOW) ADDRESS OF LOWER ELEMENT OR ZERO 00533000
  545. * 00534000
  546. * AL3(HIGH) ADDRESS OF HIGHER ELEMENT OR ZERO 00535000
  547. * AL3(BACK) ADDRESS OF PREVIOUS NODE 00536000
  548. * XL1(FLAG) ATTACHED|DETACHED FLAG 00537000
  549. * AL2(CNT) FREQUENCY COUNT FOR ELEMENT 00538000
  550. * CL(LENGTH)'EE...EE' 00539000
  551. * 00540000
  552. * REGISTER USAGE - 00541000
  553. * 00542000
  554. * GPR2 - A(TREE) 00543000
  555. * GPR14 - RETURN 00544000
  556. * GPR15 - ERROR CODE RETURN 00545000
  557. * 00546000
  558. * OPERATION - 00547000
  559. * 00548000
  560. * WHEN THE ELEMENT IS FOUND DURING THE TREE SEARCH, IT IS 00549000
  561. * DETACHED FROM THE TREE, AND THE TREE ELEMENT ADDRESS IS 00550000
  562. * RETURNED IN GPR1. 00551000
  563. * 00552000
  564. TSRCH DS 0H 00553000
  565. STM R0,R14,SAVEAREA 00554000
  566. DROP 4 00555000
  567. USING TREED,2 00556000
  568. L 2,0(,1) SET R2 TO BEGINNING OF TREE 00557000
  569. CKLOW TM FLAG,USED HAS CURRENT ENTRY BEEN DETACHED? 00558000
  570. BO TAKEN YES, BRANCH 00559000
  571. MVC A+1(3),LOW NO, DOES A 00560000
  572. L 3,A LOWER ENTRY 00561000
  573. LTR 3,3 EXIST? 00562000
  574. BZ FOUND2 NO, ELEMENT FOUND, GO RETURN IT 00563000
  575. CKLOW1 LR 2,3 YES, RESET ENTRY BASE 00564000
  576. B CKLOW AND LOOP 00565000
  577. * 00566000
  578. TAKEN EQU * CURRENT ENTRY HAS BEEN DETACHED 00567000
  579. MVC A+1(3),HIGH THERE CANNOT BE ANY LOWER ENTRIES 00568000
  580. L 3,A DOES A HIGHER ENTRY EXIST? 00569000
  581. LTR 3,3 00570000
  582. BZ BKCHN NO, GO BACK-CHAIN 00571000
  583. LR 2,3 YES, RESET ENTRY BASE 00572000
  584. TM FLAG,USED HAS THIS NODE BEEN DETACHED? 00573000
  585. BO TAKEN YES, BRANCH 00574000
  586. MVC A+1(3),LOW NO, DOES IT 00575000
  587. L 3,A HAVE A LOWER NODE? 00576000
  588. LTR 3,3 00577000
  589. BNZ CKLOW1 YES, GO CHECK IT 00578000
  590. * 00579000
  591. FOUND2 EQU * ELEMENT FOUND 00580000
  592. LR 1,2 LOAD ITS ADDRESS IN R1 00581000
  593. MVI FLAG,USED DETACH IT FROM THE TREE 00582000
  594. SR 15,15 CLEAR ERROR FLAG 00583000
  595. B RET3 00584000
  596. BKCHN1 TM FLAG,USED IS ELEMENT USED? 00585000
  597. BZ FOUND2 NO, RETURN THIS ELEMENT TO CALLER 00586000
  598. BKCHN EQU * SEARCH BACKWARD 00587000
  599. MVC A+1(3),BACK THROUGH THE TREE 00588000
  600. L 3,A FOR A NON-DETACHED 00589000
  601. LTR 2,3 NODE. 00590000
  602. BNZ BKCHN1 00591000
  603. * 00592000
  604. EMPTY LA 15,4 00593000
  605. RET3 LM R2,R14,SAVEAREA+8 00594000
  606. BR 14 00595000
  607. EJECT 00596000
  608. * CONSTANTS AND FORMATS 00597000
  609. * 00598000
  610. USED EQU X'80' 00599000
  611. A DC F'0' 00600000
  612. * 00601000
  613. EJECT 00602000
  614. ERR2E DMSERR NUM=2,LET=E,SUB=(CHAR8A,RDFN), *00603000
  615. TEXT='File ''....................'' not found' HRC323DS 00604000
  616. LA R15,28 RETURN CODE = 28 00605000
  617. B ERET 00606000
  618. SPACE 2 00607000
  619. ERR9E DMSERR NUM=9,LET=E,SUB=(DEC,(R4)),TEXT='Column ''...'' exceeds*00608000
  620. record length' HRC323DS 00609000
  621. LA R15,24 RETURN CODE = 24 00610000
  622. B ERET 00611000
  623. SPACE 2 00612000
  624. ERR19E DMSERR NUM=19,LET=E,TEXT='Identical fileids' HRC323DS 00613000
  625. LA R15,24 RETURN CODE = 24 00614000
  626. B ERET 00615000
  627. SPACE 2 00616000
  628. ERR34E DMSERR NUM=34,LET=E,SUB=(CHAR8A,RDFN), *00617000
  629. TEXT='File ''....................'' is not fixed length' 00618000
  630. LA R15,32 RETURN CODE = 32 00619000
  631. B ERET 00620000
  632. SPACE 2 00621000
  633. ERR37E DMSERR NUM=37,LET=E,SUB=(CHARA,WRMODE), *00622000
  634. TEXT='Disk ''..'' is read/only' HRC323DS 00623000
  635. LA R15,36 RETURN CODE = 36 00624000
  636. B ERET 00625000
  637. SPACE 2 00626000
  638. SPACE 2 00627000
  639. ERR53E DMSERR NUM=53,LET=E,TEXT='Invalid sort field pair defined' 00628000
  640. LA R15,24 RETURN CODE = 24 00629000
  641. B ERET 00630000
  642. SPACE 2 00631000
  643. ERR54E DMSERR NUM=54,LET=E,TEXT='Incomplete fileid specified' RC323DS 00632000
  644. LA R15,24 RETURN CODE = 24 00633000
  645. B ERET 00634000
  646. SPACE 2 00635000
  647. ERR62I LA R2,8(,R1) POINT TO INPUT FILEID 00636000
  648. B ERR62E 00637000
  649. ERR62O LA R2,32(,R1) POINT TO OUTPUT FILEID 00638000
  650. * 00639000
  651. ERR62E DMSERR NUM=62,LET=E,SUB=(CHAR8A,(R2)),TEXT='Invalid ''*'' in f*00640100
  652. ileid ''....................''' HRC323DS 00641000
  653. LA R15,20 RETURN CODE = 20 00642000
  654. B ERET 00643000
  655. ERRMSG36 EQU * @VA12416 00643100
  656. DMSERR TEXT='DISK ''..'' NOT ACCESSED',NUM=69, X00643200
  657. LET=E,SUB=(CHARA,((R2),1)) @VA12416 00643300
  658. LA R15,36 RETURN CODE = 36 @VA12416 00643400
  659. B ERET @VA12416 00643500
  660. SPACE 2 00644000
  661. ERR70E LA R2,56(,R1) POINT TO XTRA PARM 00645000
  662. DMSERR NUM=70,LET=E,SUB=(CHARA,(R2)),TEXT='Invalid parameter '*00646000
  663. '........''' 00647000
  664. LA R15,24 RETURN CODE = 24 00648000
  665. B ERET 00649000
  666. SPACE 2 00650000
  667. ERR63E DMSERR NUM=63,LET=E,TEXT='No list entered' HRC323DS 00651000
  668. LA R15,40 RETURN CODE = 40 00652000
  669. B ERET 00653000
  670. SPACE 2 00654000
  671. ERR104S LR R0,R15 SAVE ERROR CODE V0314 00655000
  672. DMSERR NUM=104,LET=S,SUB=(DEC,(R0),CHAR8A,RDFN), *00655100
  673. TEXT='Error ''..'' reading file ''....................''*00655200
  674. from disk',RENT=NO HRC323DS 00655300
  675. LA R15,100 RETURN CODE = 100 00658000
  676. B ERET 00659000
  677. SPACE 2 00660000
  678. ERR105S LR R0,R15 00661000
  679. DMSERR NUM=105,LET=S,SUB=(DEC,(R0),CHAR8A,WRFN), *00662000
  680. TEXT='Error ''...'' writing file ''....................'*00663000
  681. ' on disk',RENT=NO HRC323DS 00664000
  682. LA R15,100 RETURN CODE = 100 00665000
  683. B ERET 00666000
  684. ERR212E DMSERR NUM=212,LET=E,TEXT='Maximum number of records exceeded' 00666100
  685. LA R15,40 RETURN CODE = 40 @VA01057 00666300
  686. B ERET @VA01057 00666500
  687. SPACE 2 00667000
  688. EJECT 00668000
  689. RDPLST DS 0D 00669000
  690. RDOPTN DC CL8'STATE' 00670000
  691. RDFN DS CL8 00671000
  692. RDFT DS CL8 00672000
  693. RDMODE DC CL2'*' 00673000
  694. INITMNO DC H'0' 00674000
  695. DATABF DC A(0) 00675000
  696. INSIZE DC F'0' 00676000
  697. DC CL2'F' 00677000
  698. DC H'1' 00678000
  699. DC F'0' 00679000
  700. * 00680000
  701. WRPLST DS 0D 00681000
  702. WROPTN DC CL8'STATEW' CKECK FOR EXISTING FILE ON R/W DISK 00682000
  703. WRFN DS CL8 00683000
  704. WRFT DS CL8 00684000
  705. WRMODE DC CL2'A1' 00685000
  706. DC H'0' 00686000
  707. WRBUF DC A(0) 00687000
  708. WRSIZE DC F'0' 00688000
  709. DC CL2'F' 00689000
  710. DC H'1' 00690000
  711. DC F'0' 00691000
  712. * 00692000
  713. TPLST DS 0F 00693000
  714. DBUF DC AL1(*-*),AL3(*-*) 00694000
  715. ATREE DC A(0) 00695000
  716. AFREES DC A(0) 00696000
  717. AFREEND DC A(0) 00697000
  718. * 00698000
  719. DECD DS D 00699000
  720. DEC DS F 00700000
  721. GENBUF DS F 00701000
  722. FREESIZE DS F 00702000
  723. FLDLEN DS F 00703000
  724. RCNT DC H'0' 00704000
  725. SCNCH DS F 00705000
  726. CONBUF DS 130C 00706000
  727. * 00707000
  728. SAVEAREA DC 14F'-1' 00708000
  729. LENGTHS DC F'4096',F'8343600' MIN/MAX LENGTHS FOR GETMAIN @VA04199 00709000
  730. CMSRET DS F 00710000
  731. DOSF DS X SAVE AREA FOR DOSFLAGS @V305001 00710100
  732. * 00711000
  733. TREED DSECT 00712000
  734. LOW DS AL3 00713000
  735. HIGH DS AL3 00714000
  736. BACK DS AL3 00715000
  737. FLAG DS XL1 00716000
  738. CNT DS AL2 00717000
  739. ELEM DS C 00718000
  740. * 00719000
  741. EJECT 00720000
  742. REGEQU 00721000
  743. NUCON 00722000
  744. EJECT 00723000
  745. END 00724000