Table of Contents

DMSSBD Source

References

Source Listing

DMSSBD.ASSEMBLE.txt
  1. SBD TITLE 'DMSSBD (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * 00004000
  5. * MODULE NAME: 00005000
  6. * 00006000
  7. * DMSSBD (DMSSBD - BASIC DIRECT ACCESS METHOD) 00007000
  8. * 00008000
  9. * FUNCTION: 00009000
  10. * 00010000
  11. * THE CMS BDAM MACRO ROUTINE IS USED TO ACCESS DATA SET 00011000
  12. * RECORDS DIRECTLY BY ITEM NUMBER. IT CONVERTS RECORD 00012000
  13. * IDENTIFICATIONS GIVEN BY OS BDAM MACROS INTO ITEM 00013000
  14. * NUMBERS AND USES THESE ITEM NUMBERS TO ACCESS 00014000
  15. * RECORDS. THE CMS BDAM MACRO ROUTINE SUPPORTS ALL THE 00015000
  16. * RELEASE 20 OS BDAM MACRO FUNCTIONS EXCEPT THOSE 00016000
  17. * LISTED AS RESTRICTIONS. 00017000
  18. * 00018000
  19. * ATTRIBUTES: 00019000
  20. * 00020000
  21. * REENTRANT, NUCLEUS RESIDENT 00021000
  22. * 00022000
  23. * ENTRY POINTS: 00023000
  24. * 00024000
  25. * DMSSBD - CALLED BY DMSSBS 00025000
  26. * DMSSBDFR - CALLED BY DMSSVT FOR SVC 57 00026000
  27. * 00027000
  28. * ENTRY CONDITIONS: 00028000
  29. * 00029000
  30. * R1 = V(DECB) 00030000
  31. * R2 = V(DCB) 00031000
  32. * R11 = V(FCB) 00032000
  33. * R14 = V(RETURN) 00033000
  34. * R15 = V(DMSSBD) 00034000
  35. * 00035000
  36. * MUST BE CALLED BY BALR R14, R15 00036000
  37. * 00037000
  38. * EXIT CONDITIONS: 00038000
  39. * 00039000
  40. * IF ID, KEY, BUFFER, LIMIT, SEARCH OR I/O ERRORS 00040000
  41. * OCCUR, THEY ARE REFLECTED IN THE DECB AND CONTROL IS 00041000
  42. * RETURNED 00042000
  43. * TO THE DMSSBS ROUTINE WHICH RETURNS 00043000
  44. * CONTROL TO THE USER. THE ERROR CODES CORRESPOND TO OS 00044000
  45. * ERROR CODES AND ARE LISTED BELOW. 00045000
  46. * 00046000
  47. * ERROR CODES PUT IN DECB+1 00047000
  48. * 00048000
  49. * NOTFOUND DC X'8000' THE RECORD WAS NOT FOUND 00049000
  50. * IDTOBIG DC X'1010' RECORD ID WAS MORE THAN TWO BYTES 00050000
  51. * IOERR DC X'0800' UNCORRECTABLE I/O ERROR 00051000
  52. * BADDCB DC X'1020' DCB AND MACRO ENTRIES CONFLICT 00052000
  53. * NOBUFFER DC X'0200' NO BUFFERS FREE 00053000
  54. * NOSPACE DC X'2000' NO SPACE FOUND 00054000
  55. * 00055000
  56. * CALLS TO OTHER ROUTINES: 00056000
  57. * 00057000
  58. * DMSBRD, DMSFRE, DMSBWR, DMSFNS, DMSSVT 00058000
  59. * 00059000
  60. * EXTERNAL REFERENCES: 00060000
  61. * 00061000
  62. * NONE. 00062000
  63. * 00063000
  64. * TABLES/WORKAREAS: 00064000
  65. * 00065000
  66. * NONE. 00066000
  67. * 00067000
  68. * REGISTER USAGE: 00068000
  69. * 00069000
  70. * R0, R1 - WORK 00070000
  71. * R2 - DCB 00071000
  72. * R3 - DECB 00072000
  73. * R8 - OPSECT DSECT 00073000
  74. * R9 - BASE 00074000
  75. * R11 - FCB 00075000
  76. * R12 - KEYTABL DSECT 00076000
  77. * R13 - SAVE AREA 00077000
  78. * R4 - R7 - WORK 00078000
  79. * R10, R14, R15 - WORK 00079000
  80. * 00080000
  81. * OPERATION: 00081000
  82. * 00082000
  83. * FOR RELATIVE BLOCK, RELATIVE TRACK AND ACTUAL 00083000
  84. * ADDRESSES, THE LOW ORDER TWO BYTES OF A RECORD 00084000
  85. * IDENTIFICATION ARE USED FOR AN ITEM NUMBER. FOR 00085000
  86. * RELATIVE TRACK ADDRESS AND ACTUAL KEY, THE LOW ORDER 00086000
  87. * BYTE OF THE RELATIVE TRACK ADDRESS IS USED TO ACCESS 00087000
  88. * A TABLE OF KEYS WHICH IF NOT ALREADY IN CORE IS 00088000
  89. * BROUGHT IN AND SEARCHED FOR THE CORRECT KEY. 00089000
  90. * 00090000
  91. * CMS DOES NOT SUPPORT ACTUAL KEY I/O SO THE CMS BDAM 00091000
  92. * ROUTINE SIMULATES IT. IN CMS, ALL KEYS ARE KEPT AT 00092000
  93. * THE END OF THEIR DATA FILE. WHEN THE DATA FILES IS 00093000
  94. * OPENED, EITHER THE KEYS ARE ACCESSED FROM THE END OF V0016 00094000
  95. * THE DATA FILE AS IN THE CASE OF A FIXED FILE OR A V0016 00095000
  96. * VARIABLE FILE THAT IS ONLY BEING READ OR TWO NEW V0016 00096000
  97. * FILES ARE CREATED WITH THE SAME V0016 00097000
  98. * FILETYPE, BUT WITH FILENAMES OF $KEYTEMP AND 00098000
  99. * $KEYSAVE. BOTH THESE FILES CONTAIN ALL THE KEYS IN 00099000
  100. * THE ORIGINAL DATA FILE. $KEYTEMP IS USED FOR 00100000
  101. * UPDATING KEYS AND $KEYSAVE IS USED TO SAVE ALL THE 00101000
  102. * KEYS IN CASE OF A RE-IPL OR SYSTEM CRASH. FOR EVERY 00102000
  103. * ITEM IN THE ORIGINAL FILE THERE IS A CORRESPONDING 00103000
  104. * KEY SPACE IN THE $KEYTEMP FILE. EACH ITEM IN THE 00104000
  105. * $KEYTEMP FILE IS A KEY TABLE THAT CONTAINS 256 KEYS. 00105000
  106. * WHEN THE DATA FILE IS CLOSED, THE $KEYTEMP FILE IS 00106000
  107. * WRITTEN AT THE END OF THE DATA FILE, AND THE $KEYTEMP 00107000
  108. * AND $KEYSAVE FILES ARE ERASED. 00108000
  109. * 00109000
  110. * THE CMS BDAM ROUTINE GETS CONTROL FROM THE CMS BSAM 00110000
  111. * ROUTINE WHICH IN TURN GETS CONTROL FROM AN OS READ OR 00111000
  112. * WRITE MACRO. UPON ENTRY TO DMSSBD, A CHECK IS MADE 00112000
  113. * TO SEE IF DYNAMIC BUFFERING IS NEEDED. IF SO, A KEY 00113000
  114. * BUFFER AND OR DATA BUFFER IS ACQUIRED OR RETURNED 00114000
  115. * DEPENDING ON WHETHER A READ OR WRITE IS REQUESTED. 00115000
  116. * NEXT THE RELATIVE OR ACTUAL ADDRESS IS CHECKED TO 00116000
  117. * MAKE SURE IT DOES NOT EXCEED TWO BYTES. THIS ADDRESS 00117000
  118. * IS CONVERTED INTO AN ITEM NUMBER AND, IF KEYS ARE NOT 00118000
  119. * INVOLVED, THE FEEDBACK OPTION IS TAKEN CARE OF AND 00119000
  120. * CONTROL IS 00120000
  121. * PASSED BACK TO DMSSBS. 00121000
  122. * IF KEYS ARE ACCESSED AND THE KEY TABLE CONTAINING THE 00122000
  123. * KEY WANTED IS NOT IN CORE, IT IS BROUGHT IN AND 00123000
  124. * SEARCHED OR UPDATED. IF A SEARCH IS SPECIFIED, THE 00124000
  125. * ITEM NUMBER OF THE KEY TABLE CONTAINING THE KEY IS 00125000
  126. * COMBINED WITH THE POSITION NUMBER OF THE KEY IN THE 00126000
  127. * TABLE TO FORM THE ITEM NUMBER OF THE DATA. IF THE 00127000
  128. * EXTENDED SEARCH OPTION IS NOT SPECIFIED, ONLY ONE KEY 00128000
  129. * TABLE OF 256 KEYS IS SEARCHED. IF THE EXTENDED 00129000
  130. * SEARCH OPTION IS SPECIFIED, THE LIMIT PARAMETER IN 00130000
  131. * THE DCB IS CONVERTED TO A NUMBER OF KEY TABLES AND 00131000
  132. * THAT NUMBER OF KEY TABLES IS SEARCHED FOR A MATCHING 00132000
  133. * KEY. AFTER THE KEY TABLE HAS BEEN READ, UPDATED OR 00133000
  134. * SEARCHED, THE ITEM NUMBER, IF FEEDBACK 00134000
  135. * IS REQUESTED, IS STORED IN THE CORRECT FEEDBACK 00135000
  136. * ADDRESS AND CONTROL IS 00136000
  137. * RETURNED TO DMSSBS. 00137000
  138. * CORE FOR THE KEY TABLE AND ITS CONTROL PARAMETERS IS 00138000
  139. * ACQUIRED THE FIRST TIME A KEY IS ACCESSED. THE 00139000
  140. * ADDRESS OF THIS CORE IS STORED IN THE FCB AND THE 00140000
  141. * CORE IS NOT FREED UP UNTIL THE DATA SET IS CLOSED. 00141000
  142. * 00142000
  143. * THE FORMAT OF THE DISK KEY TABLE AND THE IN-CORE KEY 00143000
  144. * TABLE AND CONTROL WORDS IS DESCRIBED BELOW. 00144000
  145. * 00145000
  146. * 00146000
  147. * KEY TABLE 00147000
  148. * 00148000
  149. * | KEYLENGTH | 00149000
  150. * ----------------- 00150000
  151. * | LST KEY | N IS 256 00151000
  152. * ----------------- 00152000
  153. * | 2ND KEY | 00153000
  154. * ----------------- 00154000
  155. * | | 00155000
  156. * ----------------- 00156000
  157. * | NTH KEY | 00157000
  158. * ----------------- 00158000
  159. * 00159000
  160. * 00160000
  161. * IN-CORE KEY TABLE AND CONTROL WORDS 00161000
  162. * 00162000
  163. * KEYTABL DSECT 00163000
  164. * KEYLNGTH DS 1F KEY LENGTH 00164000
  165. * ENDDATA DS 1F LAST DATA ITEM IN FILE 00165000
  166. * KEYOP DS 2F COMMAND NAME 00166000
  167. * KEYNAME DS 2F FILENAME OF KEY FILE 00167000
  168. * KEYTYPE DS 2F FILETYPE OF KEY FILE 00168000
  169. * KEYMODE DS 1H FILEMODE OF KEY FILE 00169000
  170. * KEYTBLNO DS 1H ITEM NUMBER OF KEY TABLE 00170000
  171. * KEYTBLAD DC A(KEYTABLE) ADDRESS OF KEY TABLE 00171000
  172. * TBLLNGTH DS 1F BYTE SIZE OF KEY TABLE 00172000
  173. * KEYFORM DC C'F' FORMAT OF KEY TABLE 00173000
  174. * KEYCHNG DC X'00' BYTE TO SIGNIFY CHANGE IN KEY TBL 00174000
  175. * KEYCOUT DC X'0001' NUMBER OF TABLES PER ITEM 00175000
  176. * DS IF USED BY RDBUF FOR RESIDUAL COUNTS 00176000
  177. * KEYTABLE DS 0F TABLE OF KEYS 00177000
  178. * 00178000
  179. * 00179000
  180. * RESTRICTIONS 00180000
  181. * 00181000
  182. * THE FOUR METHODS OF ACCESSING BDAM RECORDS ARE: 00182000
  183. * 00183000
  184. * 1. RELATIVE BLOCK RRR 00184000
  185. * -- 00185000
  186. * 2. RELATIVE TRACK TTR 00186000
  187. * -- 00187000
  188. * 3. RELATIVE TRACK AND KEY TT KEY 00188000
  189. * - - 00189000
  190. * 4. ACTUAL ADDRESS MBBCCHHR 00190000
  191. * -- 00191000
  192. * 00192000
  193. * THE RESTRICTIONS ON THESE METHODS ARE: 00193000
  194. * 00194000
  195. * 00195000
  196. * . BDAM SPANNED RECORDS ARE NOT SUPPORTED IN CMS. 00196000
  197. * 00197000
  198. * . THE R AND RU OPTIONS OF READ AND WRITE (ADDED 00198000
  199. * IN OS RELEASE 19) ARE NOT SUPPORTED. 00199000
  200. * 00200000
  201. * . SINCE CMS FILES ONLY HAVE A TWO-BYTE RECORD 00201000
  202. * IDENTIFIER, ONLY THE BDAM IDENTIFIERS 00202000
  203. * UNDERLINED ABOVE CAN BE USED TO REFERENCE 00203000
  204. * RECORDS. 00204000
  205. * 00205000
  206. * . CMS BDAM FILES ARE ALWAYS CREATED WITH 255 00206000
  207. * RECORDS ON THE 1ST LOGICAL TRACK AND 256 RECORDS 00207000
  208. * ON ALL OTHER LOGICAL TRACKS REGUARDLESS OF THE 00208000
  209. * BLOCKSIZE. IF BDAM METHODS 2, 3 OR 4 ARE USED 00209000
  210. * AND THE RECFM IS U OR V, THE BDAM USER MUST EITHER 00210000
  211. * WRITE 255 RECORDS ON THE 1ST TRACK AND 256 00211000
  212. * RECORDS ON EVERY TRACK THEREAFTER OR HE MUST NOT 00212000
  213. * UPDATE THE TRACK INDICATOR UNTIL A NO SPACE 00213000
  214. * FOUND MESSAGE IS RETURNED ON A WRITE. FOR 00214000
  215. * METHOD 3 (WRITE ADD), THIS IS WHEN NO MORE 00215000
  216. * DUMMY RECORDS CAN BE FOUND ON A WRITE 00216000
  217. * REQUEST. FOR METHODS 2 AND 4, THIS WILL NOT 00217000
  218. * OCCUR, AND THE TRACK INDICATOR WILL ONLY BE 00218000
  219. * UPDATED WHEN THE RECORD INDICATOR REACHES 256 00219000
  220. * AND OVERFLOWS INTO THE TRACK INDICATOR. 00220000
  221. * 00221000
  222. * . TWO FILES WITH KEYS AND THE SAME FILETYPE 00222000
  223. * CANNOT BE OPEN AT THE SAME TIME. IF A 00223000
  224. * PROGRAM THAT IS UPDATING KEYS DOES NOT CLOSE 00224000
  225. * THE FILE IT IS UPDATING FOR SOME REASON, 00225000
  226. * E.G., A SYSTEM CRASH OR A RE-IPL, THE 00226000
  227. * ORIGINAL KEYS FOR A VARIABLE OR UNDEFINED DATA V0016 00227000
  228. * FILE WILL BE IN A TEMPORARY FILE V0016 00228000
  229. * WITH THE SAME FILETYPE AND A FILENAME OF 00229000
  230. * $KEYSAVE. THE KEYS FOR A FIXED DATA FILE WILL BE V0016 00230000
  231. * INTACT AT THE END OF THE DATA FILE. TO FINISH THEV0016 00231000
  232. * UPDATE, RUN THE UPDATE PROGRAM AGAIN. V0016 00232000
  233. * 00233000
  234. * . ONCE A FILE IS CREATED USING KEYS, THE FILE 00234000
  235. * MUST NOT BE ADDED TO WITHOUT USING KEYS AND 00235000
  236. * SPECIFYING THE ORIGINAL KEY LENGTH. 00236000
  237. * 00237000
  238. * . THE MINIMUM DCBLRECL FOR A CMS BDAM FILE WITH KEYV0016 00238000
  239. * IS 8 BYTES. V0016 00239000
  240. * 00240000
  241. *. 00241000
  242. EJECT 00242000
  243. * 00243000
  244. DMSSBD CSECT 00244000
  245. ENTRY DMSSBDFR 00245000
  246. SPACE 00246000
  247. * DCB FLAGS 00247000
  248. EXTSRCH EQU X'20' 00248000
  249. ACTADD EQU X'08' 00249000
  250. RELBLK EQU X'01' 00250000
  251. * BSAM DECB FLAGS 00251000
  252. WRSDSZ EQU X'14' DUMMY AND CAPACITY SWITCH P3056 00252000
  253. BSAMREAD EQU X'80' BSAM READ INDICATOR P3040 00253000
  254. * BDAM DECB FLAGS 00254000
  255. FDBK EQU X'10' 00255000
  256. DYNBUF EQU X'04' 00256000
  257. SKEY EQU X'80' 00257000
  258. SBLKLN EQU X'40' 00258000
  259. RDSW EQU X'08' 00259000
  260. KEYSW EQU X'04' 00260000
  261. WRADD EQU X'02' 00261000
  262. ******************************************************************* 00262000
  263. * 00263000
  264. * UPON ENTRY 00264000
  265. * R14 = V(RETURN) 00265000
  266. * R15 = V(BDAM) 00266000
  267. * R1 = V(DECB) 00267000
  268. * R2 = V(DCB) 00268000
  269. * R11 = V(FCB) 00269000
  270. * 00270000
  271. ******************************************************************* 00271000
  272. SPACE 2 00272000
  273. USING IHADCB,R2 00273000
  274. USING IHADECB,R3 00274000
  275. USING OPSECT,R8 00275000
  276. USING DMSSBD,R9 00276000
  277. USING FCBSECT,R11 00277000
  278. USING KEYSECT,R12 00278000
  279. * 00279000
  280. * SETUP DECB AND CONVERT RECORD IDENTIFIER TO AN ITEM NO. 00280000
  281. * 00281000
  282. LR R9,R15 GET BDAM BASE 00282000
  283. LR R3,R1 GET DECB BASE 00283000
  284. L R12,FCBKEYS GET ADDR OF KEY DSECT P3056 00284000
  285. SR R7,R7 00285000
  286. TM DCBDSORG,PS PHYSICAL SEQUENTIAL? 00286000
  287. BO GETKEYS YES, BYPASS FLAG CHECKING 00287000
  288. TM DECTYPE+1,SBLKLN IS LENGTH SPECIFIED 00288000
  289. BNO CKDYNBUF YES, CHECK FOR BUFFERRING 00289000
  290. MVC DECLNGTH(2),DCBBLKSI NO, GET LENGTH FROM DCB 00290000
  291. CKDYNBUF TM DECTYPE,DYNBUF IS DYNAMIC BUFFERRING OPTION ON 00291000
  292. BO GETBUF YES, GO HANDLE BUFFERS 00292000
  293. RDITEMNO L R10,DECRECPT GET RECORD IDENTIFIER 00293000
  294. ST R7,FCBOP 00294000
  295. TM DCBOPTCD,ACTADD IS ACTUAL ADDRESSING SPECIFIED 00295000
  296. BNO CKKEYSW NO, CHECK KEY SWITCH 00296000
  297. MVC FCBOP(4),4(R10) YES, GET ACTUAL ADDRESS 00297000
  298. B CKITEMNO 00298000
  299. CKKEYSW TM DECTYPE+1,KEYSW IS SEARCH KEY SWITCH ON 00299000
  300. BNO RELADD NO, GET RELATIVE ADDRESS 00300000
  301. MVC FCBOP+1(2),0(R10) YES, GET RELATIVE TRACK 00301000
  302. B CKITEMNO 00302000
  303. RELADD MVC FCBOP+1(3),0(R10) GET RELATIVE ADDRESS 00303000
  304. CKITEMNO EQU * V0310 00304000
  305. L R5,FCBOP NO, LOAD IDENTIFIER 00305000
  306. LA R5,1(R5) ADD ONE TO RELATIVE NO. 00306000
  307. LTR R5,R5 IS RESULT ZERO? @VA09009 00306300
  308. BZ IDERR YES, DISPLAY ERROR MSG @VA09009 00306600
  309. STH R5,FCBITEM SET ITEM NO. P3056 00307000
  310. LH R4,FCBXTENT GET EXTENT LIMIT P3056 00308000
  311. N R4,HALFWORD ALLIGN FOR COMPARE P3056 00309000
  312. CR R5,R4 IS ITEM NO. IN XTENT P3056 00310000
  313. BNH CKKYADR YES, CONTINUE V0310 00311000
  314. TM DECTYPE+1,KEYSW KEY SEARCH? V0310 00312000
  315. BO SRCHERR YES, GIVE NOT FOUND ERR V0310 00313000
  316. B IDERR NO, GIVE TO LARGE ID ERR V0310 00314000
  317. CKKYADR EQU * V0310 00315000
  318. C R7,DECKYADR ARE KEYS INVOLVED? 00316000
  319. BE RDWRITEM NO, RETURN TO BSAM 00317000
  320. CLI DCBKEYLE,X'00' DO DCB AND DECB AGREE? 00318000
  321. BE RDWRITEM NO, GO TO READ WRITE RTN 00319000
  322. TM DECTYPE+1,RDSW IS THIS A READ V0016 00320000
  323. BNO GETKEYS NO, CONTINUE V0016 00321000
  324. OI IOBIOFLG,IOBIN SET INPUT FLAG V0016 00322000
  325. GETKEYS LTR R12,R12 IS KEY TABLE IN CORE V0016 00323000
  326. BZ CALLSAVE NO GET A KEY TABLE V0016 00324000
  327. TM IOBIOFLG,IOBIN IS INPUT SPECIFIED V0016 00325000
  328. BO GETTBLNO YES, THEN GET CURRENT TBL V0016 00326000
  329. TM DCBRECFM,VAR RECFORM= FIXED V0016 00327000
  330. BNO GETTBLNO YES, CONTINUE V0016 00328000
  331. CLC KEYNAME(8),=CL8'$KEYTEMP' IS THIS A TEMP FILE V0016 00329000
  332. BE GETTBLNO YES, CONTINUE V0016 00330000
  333. CALLSAVE LA R0,4 CREATE OR SAVE KEY FILE V0016 00331000
  334. SVC 203 CALL KEYSAVE 00332000
  335. DC H'-3' SVC 203 ENTRY IN DMSSVT 00333000
  336. STH R5,FCBITEM RESTORE ITEM NO. 00334000
  337. MVC FCBBYTE+2(2),DCBBLKSI RESTORE FCBBYTE 00335000
  338. LTR R15,R15 WAS KEYSAV SUCCESSFULL 00336000
  339. BNZ WRERRRTN NO, RETURN WITH ERROR CODE 00337000
  340. L R12,FCBKEYS GET DSECT ADDR 00338000
  341. GETTBLNO SR R4,R4 ZERO REG 4 00339000
  342. LA R6,256 GET NO. KEYS IN TABLE 00340000
  343. DR R4,R6 GET NEW TABLE NO. 00341000
  344. LA R5,1(R5) 00342000
  345. L R6,KEYLNGTH GET KEY LENGTH 00343000
  346. BCTR R6,R0 SET LENGTH FOR MVC OR CLC 00344000
  347. L R10,DECKYADR GET KEY ADDRESS 00345000
  348. SR R15,R15 CLEAR REGISTER 15 P3040 00346000
  349. LA R1,KEYOP SETUP ADDR OF KEYS PLIST P3040 00347000
  350. CH R5,KEYTBLNO IS NEW TABLE IN CORE 00348000
  351. BNE SAVEKEYS NO, GO GET IT 00349000
  352. * 00350000
  353. * SETUP TO READ OR WRITE KEY 00351000
  354. * 00352000
  355. SRCHKEYS TM DCBDSORG,PS PHYSICAL SEQUENTIAL? 00353000
  356. BO PSKEY YES, GO TO PS CHECKS 00354000
  357. TM DECTYPE+1,KEYSW IS SEARCH KEY SWITCH ON 00355000
  358. BO FINDKEY YES, GO SEARCH FOR KEY 00356000
  359. TM DECTYPE+1,WRADD IS SEARCH FOR DUMMY SWITCH ON 00357000
  360. BO FINDDUMY YES, GO SEARCH FOR DUMMY 00358000
  361. MH R4,KEYLNGTH+2 GET ADDRESS OF 00359000
  362. A R4,KEYTBLAD KEY TO BE CHANGED 00360000
  363. TM DECTYPE+1,RDSW IS THIS A READ 00361000
  364. BNO MOVEKEY NO, GO WRITE KEY 00362000
  365. EX R6,RDMOVE YES, READ KEY 00363000
  366. B RDWRITEM RETURN TO BSAM 00364000
  367. SPACE 2 00365000
  368. PSKEY MH R4,KEYLNGTH+2 GET ADDRESS OF KEY 00366000
  369. A R4,KEYTBLAD TO BE CHANGED 00367000
  370. L R10,DECAREA GET ADDR OF USER KEY AREA P3040 00368000
  371. TM DECTYPE+1,BSAMREAD IS THIS A BSAM READ P3040 00369000
  372. BNO SETCHNG NO, THEN SET KEY CHNG BIT P3040 00370000
  373. EX R6,RDMOVE MOVE KEY TO USER AREA P3040 00371000
  374. B BDAMRTRN RETURN TO BSAM P3040 00372000
  375. SETCHNG MVI KEYCHNG,2 SET CHANGE BYTE P3040 00373000
  376. TM DECTYPE+1,WRSDSZ DUMMY OR CAPACITY SWITCH P3056 00374000
  377. BM WRDUMMY YES, THEN WRITE DUMMY KEYS P3056 00375000
  378. CLI 0(R10),X'FF' IS KEY A DUMMY KEY 00376000
  379. BE PSERR YES, GO TO ERROR RTN 00377000
  380. WRDUMMY EX R6,WRMOVE SET NEW KEY V0300 00378000
  381. B BDAMRTRN RETURN TO BSAM 00379000
  382. SPACE 2 00380000
  383. * 00381000
  384. * SEARCH KEY TABLES FOR A MATCHING KEY 00382000
  385. * 00383000
  386. FINDDUMY TM DCBRECFM,VAR RECFM VARIABLE V0300 00384000
  387. BNO GETDUMY NO, FIND KEY V0300 00385000
  388. L R10,KEYTBLAD GET ADDR OF KEY TABLE V0300 00386000
  389. A R10,TBLLNGTH GET ADDR OF END OF TABLE V0300 00387000
  390. EX R6,CLRKEY CLEAR DUMMY KEY V0300 00388000
  391. B FINDKEY GO FIND DUMMY KEY V0300 00389000
  392. GETDUMY SR R6,R6 SET COMPARE LENGTH TO 1 V0300 00390000
  393. LA R10,DUMMY FOR DUMMY KEY 00391000
  394. FINDKEY LA R5,256 GET NO. OF KEYS IN TABLE 00392000
  395. L R4,KEYTBLAD GET KEY TABLE ADDRESS P3056 00393000
  396. LTR R15,R15 RETURN CODE= 0 P3056 00394000
  397. BZ CKNEXT YES, THEN CONTINUE SEARCH P3056 00395000
  398. CH R15,=XL2'000C' ERROR= END OF FILE? P3056 00396000
  399. BNE SRCHERR NO, THEN KEY NOT FOUND ERR P3056 00397000
  400. SR R4,R4 ZERO LIMIT REG P3056 00398000
  401. IC R4,FCBITEM GET NO. AT START OF SEARCH P3056 00399000
  402. LTR R4,R4 TABLE ONE SEARCHED? P3056 00400000
  403. BZ SRCHERR YES, THEN KEY NOT FOUND P3056 00401000
  404. LA R5,1 SET TBL NO AT 1 P3056 00402000
  405. CLR R7,R4 LIMIT < NO. TABLES LEFT V0300 00403000
  406. BL SAVEKEYS NO, CONTINUE V0300 00404000
  407. LR R7,R4 LIMIT= NO. TABLES LEFT P3056 00405000
  408. B SAVEKEYS CONTINUE SEARCH V0300 00406000
  409. CKNEXT EX R6,COMPARE IS THIS THE KEY WE WANT 00407000
  410. BE KEYFOUND YES, GO TO FIND RTN 00408000
  411. A R4,KEYLNGTH NO, CONTINUE SEARCH 00409000
  412. BCT R5,CKNEXT CHECK NEXT KEY 00410000
  413. LTR R7,R7 IS THIS FIRST TABLE SEARCHED? 00411000
  414. BNZ SRCHON NO, GET NEXT TABLE 00412000
  415. LA R7,1 GET NO. OF TABLES FOR SEARCH 00413000
  416. CKEXTSRC TM DCBOPTCD,EXTSRCH IS EXTRA SEARCH OPTION ON 00414000
  417. BO EXTRSRCH YES, GET SEARCH LIMIT 00415000
  418. SRCHON LH R5,KEYTBLNO UPDATE ITEM NO. 00416000
  419. LA R5,1(R5) 00417000
  420. BCT R7,SAVEKEYS GET NEXT KEY TABLE V0300 00418000
  421. B SRCHERR GO TO KEY NOT FOUND RTN 00419000
  422. SPACE 2 00420000
  423. * 00421000
  424. * DETERMINE NO. OF TABLES TO BE SEARCHED 00422000
  425. * 00423000
  426. EXTRSRCH CLC DCBLIMCT(3),=AL3(1) IS LIMIT SPECIFIED P3056 00424000
  427. BNH KEYERR NO, GO TO ERROR RTN P3056 00425000
  428. TM DCBOPTCD,RELBLK IS LIMIT IN BLOCKS 00426000
  429. BO EXTRBLKS YES, GO CONVERT TO TABLES 00427000
  430. MH R7,DCBLIMCT+1 CONVERT TRACKS TO TABLES 00428000
  431. B SRCHON CONTINUE SEARCH 00429000
  432. EXTRBLKS L R4,DCBLIMCT-1 CONVERT NUMBER OF 00430000
  433. SLL R4,8 BLOCKS TO 00431000
  434. SRL R4,16 NUMBERS TBLS FOR SEARCH V0300 00432000
  435. AR R7,R4 TO BE SEARCHED 00433000
  436. B SRCHON CONTINUE SEARCH 00434000
  437. SPACE 2 00435000
  438. * 00436000
  439. * DETERMINE ITEM NO. FROM POSITION IN TABLE 00437000
  440. * 00438000
  441. KEYFOUND LR R6,R4 COMPUTE ITEM 00439000
  442. S R6,KEYTBLAD NUMBER OF DATA 00440000
  443. SRDL R6,32 FROM POSITION 00441000
  444. D R6,KEYLNGTH OF KEY IN TABLE 00442000
  445. LH R6,KEYTBLNO AND TABLE NUMBER 00443000
  446. BCTR R6,R0 00444000
  447. SLL R6,8 SET TRACK INDICATOR P3056 00445000
  448. AR R6,R7 00446000
  449. STH R6,FCBITEM STORE ITEM NUMBER IN FCB 00447000
  450. TM DECTYPE+1,RDSW IS THIS A READ 00448000
  451. BO RDWRITEM YES, RETURN TO BSAM 00449000
  452. L R6,KEYLNGTH GET KEY LENGTH 00450000
  453. BCTR R6,R0 DECREMENT LENGTH BY ONE 00451000
  454. L R10,DECKYADR GET ADDRESS OF NEW KEY 00452000
  455. SPACE 2 00453000
  456. * 00454000
  457. * SETUP FOR RETURN TO DMSSBS 00455000
  458. * 00456000
  459. MOVEKEY EX R6,WRMOVE WRITE NEW KEY 00457000
  460. MVI KEYCHNG,X'01' SET CHANGE BYTE 00458000
  461. RDWRITEM TM DECTYPE,FDBK IS FEEDBACK OPTION ON 00459000
  462. BO FEEDBACK YES, HANDLE FEEDBACK 00460000
  463. BDAMRTRN LR R1,R3 RESTORE DECB BASE 00461000
  464. L R3,BSAMBASE RESTORE BSAM BASE 00462000
  465. LTR R12,R12 IS IT ZERO 00463000
  466. BCR 8,R14 YES, THEN RETURN 00464000
  467. LH R5,FCBITEM GET ITEM NO. P3056 00465000
  468. N R5,HALFWORD CLEAR FIRST HALF P3056 00466000
  469. LH R15,FCBXTENT GET XTENT V0016 00467000
  470. N R15,HALFWORD CLEAR 1ST HALF V0016 00468000
  471. CR R5,R15 ITEM NO. > XTENT V0016 00469000
  472. BNH CKKEYPTR NO, CONTINUE V0016 00470000
  473. LR R3,R1 RESTORE DECB BASE V0016 00471000
  474. B IDERR RETURN ERROR V0016 00472000
  475. CKKEYPTR C R5,DATAEND SHOULD KEY PTR BE HIGHER V0016 00473000
  476. BCR 13,R14 BNH... NO, RETURN 00474000
  477. MVC DATAEND+2(2),FCBITEM YES, RESET DATAEND 00475000
  478. BR R14 RETURN TO BSAM OR USER 00476000
  479. FEEDBACK L R10,DECRECPT GET ADDR OF RECORD POINTER V0206 00477000
  480. LH R5,FCBITEM GET ITEM NO. 00478000
  481. N R5,HALFWORD ZERO FIRST HALF 00479000
  482. BCTR R5,R0 SUBTRACT ONE 00480000
  483. STH R5,FCBOP ALLIGN FOR MOVE 00481000
  484. XC 0(4,R10),0(R10) CLEAR FEEDBACK AREA V0206 00482000
  485. MVC 1(2,R10),FCBOP SET RELATIVE ADDRESS V0206 00483000
  486. TM DCBOPTCD,ACTADD ACTUAL ADDRESS SPECIFIED V0206 00484000
  487. BZ BDAMRTRN NO, RETURN TO CALLER V0206 00485000
  488. FEEDACTL MVC 6(2,R10),FCBOP RETURN ACTUAL ADDR V0206 00486000
  489. XC 0(6,R10),0(R10) CLEAR 1ST PART OF ADDRESS V0206 00487000
  490. B BDAMRTRN RETURN TO BSAM 00488000
  491. * 00489000
  492. * READ AND WRITE KEYTABLES 00490000
  493. * 00491000
  494. SAVEKEYS CLI KEYCHNG,0 IS CHANGE BYTE ON? P3040 00492000
  495. BE READKEYS NO, BYPASS WRITE 00493000
  496. CLC KEYNAME(8),=CL8'$KEYTEMP' IS THIS A TEMP FILE V0300 00494000
  497. BNE RDFXDKEY NO, GET NO. OF TABLE V0300 00495000
  498. TM DCBRECFM,VAR RECFM= VAR OR UND V0300 00496000
  499. BNO RDFXDKEY NO, GET REAL KEY ITEM NO. V0300 00497000
  500. CALLWRIT MVC KEYOP(8),=CL8'FINIS' FINIS FILE V0300 00498000
  501. SVC X'CA' V0300 00499000
  502. DC AL4(*+4) 00500000
  503. MVC KEYOP(8),=CL8'WRBUF' YES, WRITE OUT 00501000
  504. SVC X'CA' V0300 00502000
  505. DC AL4(WRERRRTN) 00503000
  506. DOFINIS MVC KEYOP(8),FINIS FINIS KEY FILE 00504000
  507. SVC X'CA' 00505000
  508. DC AL4(*+4) 00506000
  509. MVI KEYCHNG,X'00' RESET CHANGE BYTE 00507000
  510. READKEYS MVC KEYOP(8),=CL8'RDBUF' READ NEW 00508000
  511. NEWKYTBL STH R5,KEYTBLNO KEY TABLE IN 00509000
  512. CLC KEYNAME(8),=CL8'$KEYTEMP' IS THIS A TEMP FILE V0016 00510000
  513. BNE RDFXDKEY NO. GET ITEM NO. V0300 00511000
  514. TM DCBRECFM,VAR RECFM= VAR OR UND V0300 00512000
  515. BO CALLREAD YES, CONTINUE V0300 00513000
  516. RDFXDKEY LH R15,KEYTBLNO GET NO. OF KEY TABLE V0016 00514000
  517. BCTR R15,R0 SET FOR MULTIPLY V0016 00515000
  518. MH R15,KEYCOUT GET RELATIVE ITEM NO. V0016 00516000
  519. A R15,DATAEND GET REAL ITEM NO. V0016 00517000
  520. STH R15,KEYTBLNO SET REAL ITEM NO. V0016 00518000
  521. CLI KEYCHNG,0 IS THIS A WRITE V0016 00519000
  522. BNE CALLWRIT YES, ISSUE WRITE V0016 00520000
  523. CALLREAD MVC SEBSAV(1),37(R1) RETAIN INDICATOR @VA03023 00521000
  524. SVC X'CA' READ IN TABLE @VA03023 00522000
  525. DC AL4(RDERRRTN) V0016 00523000
  526. MVC 37(1,R1),SEBSAV RESTORE INDICATOR @VA03023 00524000
  527. READOK STH R5,KEYTBLNO SET KEY TABLE NO. V0016 00525000
  528. B SRCHKEYS CONTINUE KEY SEARCH 00526000
  529. SPACE 2 00527000
  530. * 00528000
  531. * GET AND RELEASE BDAM BUFFERS 00529000
  532. * 00530000
  533. GETBUF TM DECTYPE+1,RDSW IS THIS A READ 00531000
  534. BNO RDITEMNO NO, CONTINUE @VA03006 00532000
  535. L R5,DCBBUFCB YES GET ADDRESS 00533000
  536. L R6,0(R5) OF BUFFER 00534000
  537. LTR R6,R6 ARE ALL BUFFERS TAKEN 00535000
  538. BZ BUFFERR YES, GO TO ERROR RTN 00536000
  539. MVC 0(4,R5),0(R6) NO, GET BUFFER 00537000
  540. TM DECTYPE+1,SKEY IS KEY PART OF BUFFER 00538000
  541. BNO AREAADD NO, SET DECB DATA ADDRESS 00539000
  542. ST R6,DECKYADR YES, SET DECB KEY ADDRESS 00540000
  543. IC R7,DCBKEYLE GET DECB 00541000
  544. AR R6,R7 DATA ADDRESS 00542000
  545. SR R7,R7 00543000
  546. AREAADD ST R6,DECAREA SET DECB DATA ADDRESS 00544000
  547. B RDITEMNO GO COMPUTE ITEM NO. 00545000
  548. RETRNBUF LA R4,RDITEMNO SET DMSSBDFR RETURN ADDRESS 00546000
  549. BALR R15,R0 00547000
  550. DROP R9 00548000
  551. USING *,R15 00549000
  552. DMSSBDFR TM DECTYPE,DYNBUF DYNAMIC BUFFERING? @VA03006 00550000
  553. BNO NOBUF NO, RETURN @VA03006 00551000
  554. L R6,DECAREA GET DATA ADDRESS @VA03006 00552000
  555. L R5,DCBBUFCB GET BUFFER CONTROL BLOCK ADDR 00553000
  556. TM DECTYPE+1,SKEY IS KEY PART OF DATA 00554000
  557. BNO SETUPCB NO, RETURN BUFFER 00555000
  558. IC R7,DCBKEYLE YES, GET DECB 00556000
  559. SR R6,R7 DATA ADDRESS 00557000
  560. SR R7,R7 00558000
  561. SETUPCB MVC 0(4,R6),0(R5) RETURN BUFFER TO 00559000
  562. ST R6,0(R5) BUFFER CONTROL BLOCK 00560000
  563. NOBUF BR R4 RETURN TO CALLER @VA03006 00561000
  564. DROP R15 00562000
  565. USING DMSSBD,R9 00563000
  566. SPACE 2 00564000
  567. * 00565000
  568. * CHECK BDAM ERRORS AND SET ERROR CODES 00566000
  569. * 00567000
  570. RDERRRTN MVC 37(1,R1),SEBSAV RESTORE INDICATOR @VA03023 00568000
  571. CH R15,=XL2'000C' IS THIS EOF @VA03023 00569000
  572. BE EOFERR YES, CLEAR KEY TABLE P3056 00570000
  573. CH R15,=H'8' LENGTH ERROR V0016 00571000
  574. BE READOK YES, THEN IGNORE V0016 00572000
  575. CH R15,=H'1' IS THIS AN EOF ERROR V0016 00573000
  576. BE EOFERR YES, CLEAR KEY TABLE P3056 00574000
  577. CH R15,=H'9' IS A FINIS NEEDED 00575000
  578. BE DOFINIS YES, FINIS FILE 00576000
  579. WRERRRTN TM DCBDSORG,PS IS THIS PS DATA SET 00577000
  580. BO PSERR YES, GO TO PS ERROR RTN 00578000
  581. LA R7,IOERR GET IO ERROR CODE 00579000
  582. B ERRRTRN GO FILL IN DECB 00580000
  583. IDERR LA R7,IDTOBIG GET ID TO BIG ERROR CODE 00581000
  584. TM DCBDSORG,PS ACCESS METHOD= SEQUENTIAL V0206 00582000
  585. BNO ERRRTRN NO, RETURN BDAM ERROR CODE V0206 00583000
  586. MVI DECSDECB+3,12 RETURN EOF CODE V0206 00584000
  587. MVI DECSDECB,X'42' INDICATE BSAM ERROR V0206 00585000
  588. B USERRTRN RETURN TO CALLER V0206 00586000
  589. KEYERR LA R7,BADDCB GET BAD DCB ERROR CODE 00587000
  590. B ERRRTRN GO FILL IN DECB 00588000
  591. SRCHERR EQU * @VA05072 00589000
  592. CLI FCBRECFM,VAR IS THIS A VARIABLE RECORD? @VA05072 00590000
  593. BE SPACEERR YES DIFFERENT ERROR @VA05072 00591000
  594. LA R7,NOTFOUND GET KEY NOT FOUND ERROR CODE @VA06252 00592000
  595. CLC 0(2,R10),DUMMY IS THIS A WRITE ADD 00593000
  596. BNE ERRRTRN NO, CONTINUE 00594000
  597. SPACEERR LA R7,NOSPACE YES, THEN SET NO SPACE ERR 00595000
  598. B ERRRTRN GO FILL IN DECB 00596000
  599. BUFFERR LA R7,NOBUFFER GET NO BUFFER ERROR CODE 00597000
  600. ERRRTRN MVI DECSDECB,X'40' FILL IN DECB 00598000
  601. MVC DECSDECB+1(2),0(R7) WITH SELECTED ERROR CODE 00599000
  602. SETERR MVI DECSDECB+3,X'FF' FILL IN ERROR CODE 00600000
  603. USERRTRN L R14,=V(DMSSBSRT) RETURN TO THE USER 00601000
  604. SR R12,R12 DON'T CHECK FOR END OF XTENV0016 00602000
  605. B BDAMRTRN GO TO COMMON RETURN 00603000
  606. PSERR MVI DECSDECB,X'42' FILL IN ECB 00604000
  607. B SETERR RETURN TO CALLER 00605000
  608. EOFERR L R0,KEYLNGTH GET NO. OF 256 BYTE TBLS V0016 00606000
  609. L R1,KEYTBLAD GET KEY TBL ADDR P3056 00607000
  610. CLRLOOP XC 0(256,R1),0(R1) CLEAR A BLOCK P3056 00608000
  611. LA R1,256(,R1) GET ADDR OF NEXT BLK P3056 00609000
  612. BCT R0,CLRLOOP CLEAR NEXT BLK P3056 00610000
  613. LA R1,KEYOP GET ADDRESS OF KEY PLIST P3056 00611000
  614. B READOK CONTINUE KEY HANDLING V0016 00612000
  615. SPACE 2 00613000
  616. BSAMBASE DC V(DMSSBS) BSAM BASE REG 00614000
  617. WRMOVE DS 0H 00615000
  618. MVC 0(0,R4),0(R10) WRITE KEY 00616000
  619. COMPARE CLC 0(0,R4),0(R10) COMPARE KEYS 00617000
  620. RDMOVE MVC 0(0,R10),0(R4) READ KEY 00618000
  621. CLRKEY XC 0(0,R10),0(R10) CLEAR KEY V0300 00619000
  622. DUMMY DC X'FF00' DUMMY KEY 00620000
  623. NOTFOUND DC X'8000' 00621000
  624. IDTOBIG DC X'1010' ERROR 00622000
  625. IOERR DC X'0800' 00623000
  626. BADDCB DC X'1020' CODES 00624000
  627. NOSPACE DC X'2000' 00625000
  628. NOBUFFER DC X'0200' 00626000
  629. HALFWORD DC F'65535' 00627000
  630. FINIS DC CL8'FINIS' 00628000
  631. LTORG 00629000
  632. SPACE 2 00630000
  633. KEYSECT 00631000
  634. EJECT 00632000
  635. DCBD DSORG=(DA) 00633000
  636. EJECT 00634000
  637. CMSCB 00635000
  638. EJECT 00636000
  639. IO 00637000
  640. EJECT 00638000
  641. REGEQU 00639000
  642. END 00640000