Table of Contents

SXDEST

Table Of Contents

  • [00001] PROC DS$$DOC
  • [00003] DS$$DOC - DESIGN DOCUMENTATION FOR THE DESTAGE PROCESS.
  • [00360] PROC DESTAGR1)
  • [00362] DESTAGR - DESTAGE FILE FROM DISK TO M860 CARTRIDGE.
  • [00441] PROC ADD$LNK
  • [00442] PROC ACQ$FCT
  • [00443] PROC CKPFETC
  • [00444] PROC CFLUSH
  • [00445] PROC CPUTFCT
  • [00446] PROC CRELSLK
  • [00447] PROC DELAY
  • [00448] PROC DROPDS
  • [00449] PROC DROPIDS
  • [00450] PROC DSALLO
  • [00451] PROC DSERCAT
  • [00452] PROC DSERPFM
  • [00453] PROC DSNTDAM
  • [00454] PROC HLCPYDC
  • [00455] PROC HLLOAD
  • [00456] PROC HLLDSET
  • [00457] PROC MSG
  • [00458] PROC MSGAFDF
  • [00459] PROC RECALL
  • [00460] PROC RETERN
  • [00461] PROC RLSVOL
  • [00462] PROC RLS$FCT
  • [00463] PROC SETASA
  • [00464] PROC UASTPRM
  • [00465] PROC UATTACH
  • [00466] PROC UGET
  • [00467] PROC UPUSAGE
  • [00468] PROC ZFILL
  • [00469] PROC ZSETFET
  • [01923] PROC DSALLO2)
  • [01925] DSALLO - ALLOCATE A VOLUME ON A M860 CARTRIDGE.
  • [01930] DSALLO - ALLOCATE A VOLUME ON A M860 CARTRIDGE.
  • [02074] PROC ACQ$FCT
  • [02075] PROC ANLZAST
  • [02077] PROC CRDAST
  • [02078] PROC DSERCAT
  • [02079] PROC OCTSRCH
  • [02080] PROC RLSVOL
  • [02081] PROC RLS$FCT
  • [02082] PROC UASTPRM
  • [02731] PROC DSERCAT3)
  • [02733] DSERCAT - PROCESS DESTAGE CATALOG ACCESS ERRORS.
  • [02738] DSERCAT - PROCESS DESTAGE CATALOG ACCESS ERRORS.
  • [02767] PROC ABORT
  • [02768] PROC MESSAGE
  • [02802] PROC DSERPFM4)
  • [02804] DSERPFM - PROCESS DESTAGE *PFM* ERRORS.
  • [02809] DSERPFM - PROCESS DESTAGE *PFM* ERRORS.
  • [02845] PROC ABORT
  • [02846] PROC DELAY
  • [02847] PROC MESSAGE
  • [02848] PROC PFMEC
  • [02909] PROC DSNTDAM5)
  • [02911] DSNTDAM - SELECT NEXT FILE TO DESTAGE.
  • [02916] DSNTDAM - SELECT NEXT FILE TO DESTAGE.
  • [02943] FUNC XCOD C(10)
  • [02944] PROC BLOWUP
  • [02945] PROC CRELSLK
  • [02946] PROC MESSAGE
  • [02947] PROC MSGAFDF
  • [02948] PROC READ
  • [02949] PROC READW
  • [02950] PROC RENAME
  • [02951] PROC RETERN
  • [02952] PROC REWIND
  • [02953] PROC STNTDAM
  • [02954] PROC WRITER
  • [02955] PROC WRITEW
  • [02956] PROC ZSETFET
  • [03407] PROC DSSETUP(FAM,ERRSTAT)
  • [03409] DSSETUP - DESTAGING INITIALIZATION PROCESSOR.
  • [03414] DSSETUP - DESTAGING INITIALIZATION PROCESSOR.
  • [03446] PROC ABORT
  • [03447] PROC BLOWUP
  • [03448] PROC BZFILL
  • [03449] PROC HLRQENQ
  • [03450] PROC MESSAGE
  • [03451] PROC MSG
  • [03452] PROC PFD
  • [03453] PROC READ
  • [03454] PROC READW
  • [03455] PROC RETERN
  • [03456] PROC REWIND
  • [03457] PROC RMVBLNK
  • [03458] PROC SETPFP
  • [03459] PROC WRITER
  • [03460] PROC WRITEW
  • [03461] PROC ZSETFET

Source Code

SXDEST.txt
  1. PROC DS$$DOC;
  2.  
  3. # TITLE DS$$DOC - DESIGN DOCUMENTATION FOR THE DESTAGE PROCESS. #
  4.  
  5. BEGIN # DS$$DOC #
  6.  
  7. #
  8. * D E S T A G I N G O V E R V I E W
  9. *
  10. * *SSMOVE* CREATES A FILE CALLED *MVOCOM* (UI = 377760B) WHICH HAS
  11. * AN ENTRY FOR EACH FILE TO BE DESTAGED OR DESTAGED AND RELEASED.
  12. * *SSMOVE* ISSUES A *UCP* CALL TO *SSEXEC* TO INDICATE THAT
  13. * DESTAGING IS TO BE DONE. THE *UCP* REQUEST PROCESSOR *TYP2RP*
  14. * CALLS *DSSETUP* TO PREPARE FOR FILE DESTAGING.
  15. *
  16. * *DSSETUP* COPIES THE DESTAGING ENTRIES (*TDAM* ENTRIES) FROM THE
  17. * FILE PREPARED BY *SSMOVE* TO EIGHT SCRATCH FILES, ONE PER
  18. * SUBFAMILY. WHILE DOING THIS COPY, IT CALCULATES THE NUMBER OF AU
  19. * REQUIRED TO HOLD THE FILES TO BE DESTAGED. THESE REQUIREMENTS
  20. * ARE USED BY THE ALLOCATOR (*DSALLO*) TO SELECT THE BEST STORAGE
  21. * MODULE AND CARTRIDGE FOR THE SET OF FILES IN ATTEMPTING TO
  22. * SATISFY THE DUAL OBJECTIVES OF AVOIDING CARTRIDGE OVERFLOW AND
  23. * REDUCING CARTRIDGE ACCESS TIME BY PLACING MANY FILES ON THE SAME
  24. * CARTRIDGE.
  25. *
  26. * WHEN THE EIGHT SCRATCH FILES ARE PREPARED, THE FILE FROM *SSMOVE*
  27. * IS REWOUND AND IS READY TO BE USED TO REPORT BACK TO *SSMOVE* THE
  28. * IDENTITY OF ALL FILES WHICH COULD NOT BE DESTAGED. THE REASON
  29. * FOR EACH SUCH FAILURE IS ALSO SUPPLIED. THE VARIABLE *DSC$INIT*
  30. * IS SET NON-ZERO TO SIGNAL THE MAIN LOOP THAT DESTAGING IS TO BE
  31. * INITIATED. *MAINLP* CALLS *NEWWORK* WHICH GETS AN *HLRQ* ENTRY
  32. * AND THEN CALLS *DSNTDAM* TO SELECT A SUBFAMILY AND FILE TO START
  33. * DESTAGING.
  34. *
  35. * IT SHOULD BE NOTED THAT THE STAGING PROCESS CAN PRE-EMPT THE
  36. * CARTRIDGE OR *HLRQ* ENTRY USED FOR DESTAGING BY SETTING THE
  37. * *DOSTG* FLAG IN THE *HLRQ* ENTRY. WHEN DESTAGER IS DONE WITH THE
  38. * CURRENT CARTRIDGE (EXCEPT IN A CARTRIDGE OVERFLOW CONDITION), IT
  39. * WILL CALL *STNTDAM* TO SELECT A FILE TO BE STAGED FROM THE
  40. * CURRENT CARTRIDGE USING THE CURRENT *HLRQ* ENTRY. WHEN THIS
  41. * OCCURS, THE *DSC$INIT* FLAG IS AGAIN SET NON-ZERO TO CAUSE THE
  42. * DESTAGING PROCESS TO BE RE-INITIATED.
  43. #
  44.  
  45. CONTROL EJECT;
  46.  
  47. #
  48. * M A J O R R O U T I N E S I N D E S T A G I N G
  49. *
  50. * 1) DSSETUP IS CALLED BY *TYP2RP* WHEN *SSMOVE* MAKES A *UCP*
  51. * REQUEST TO *SSEXEC*. IT COPIES THE *TDAM* ENTRIES FOR FILES TO
  52. * BE DESTAGED FROM THE *MVOCOM* FILE TO EIGHT SCRATCH FILES, ONE
  53. * PER SUBFAMILY.
  54. *
  55. * 2) DESTAGR IS CALLED BY THE *HLRQ* MONITOR TO DESTAGE A FILE.
  56. * IT CALLS PROCEDURES 3 AND 5-8 BELOW TO ASSIST IT IN THIS PROCESS.
  57. * WHEN A FILE HAS BEEN DESTAGED, IT CALLS *DSNTDAM* TO UPDATE THE
  58. * *HLRQ* ENTRY TO REFLECT THE NEXT FILE TO BE DESTAGED.
  59. *
  60. * 3) DSALLO IS CALLED BY *DESTAGR* TO SELECT A STORAGE MODULE
  61. * AND CARTRIDGE FOR A FILE AND ALSO ASSIGN SOME UNUSED SPACE TO THE
  62. * FILE BEING DESTAGED.
  63. *
  64. * 4) ANLZAST IS A HELPER ROUTINE TO *DSALLO* TO IDENTIFY THE
  65. * BEST CARTRIDGE FOR A SHORT FILE AND THE BEST CARTRIDGE OR
  66. * CARTRIDGE GROUP FOR A LONG FILE.
  67. *
  68. * 5) HLLOAD IS CALLED BY *DESTAGR* TO INTERFACE WITH THE DRIVER
  69. * TO CAUSE A CARTRIDGE TO BE MADE AVAILABLE FOR I/O.
  70. *
  71. * 6) HLCPYDC IS CALLED BY *DESTAGR* TO COPY SOME FILE DATA FROM
  72. * DISK TO THE CURRENTLY ASSIGNED M860 VOLUME.
  73. *
  74. * 7) HLUNLD IS CALLED BY *DESTAGR* TO INTERFACE WITH THE DRIVER
  75. * TO UNLOAD A CARTRIDGE WHICH IS NO LONGER NEEDED.
  76. *
  77. * 8) RLSVOL IS CALLED BY *DESTAGR* AND *HLCPYDC* (AND OTHER
  78. * PROCEDURES) TO RELEASE ANY UNUSED AU BY RETURNING THEM TO THE
  79. * CHAIN OF AVAILABLE AU ON THE CURRENT CARTRIDGE.
  80. *
  81. * 9) DSNTDAM IS CALLED BY *DESTAGR* AND *NEWWORK* WHEN AN *HLRQ*
  82. * ENTRY IS AVAILABLE FOR USE IN DESTAGING A FILE. *DSNTDAM* ISSUES
  83. * ANY APPROPRIATE MESSAGES ABOUT THE STATUS OF THE FILE JUST
  84. * DESTAGED AND SELECTS THE NEXT FILE TO BE DESTAGED, TRYING TO PICK
  85. * ONE WHICH WILL FIT ON THE CURRENTLY LOADED CARTRIDGE.
  86. *
  87. * 10) LLRQXXX REPRESENT SEVERAL LOW LEVEL REQUEST MODULES WHICH
  88. * ARE CALLED BY THE *HLXXXXX* ROUTINES AS NEEDED TO PERFORM
  89. * CARTRIDGE LOADS, UNLOADS, AND COPIES FROM DISK TO CARTRIDGE.
  90. #
  91.  
  92. CONTROL EJECT;
  93.  
  94. #
  95. * D E S T A G E O V E R V I E W ( D E T A I L E D )
  96. *
  97. * INPUT TO THE TOTAL DESTAGE PROCESS IS PREPARED BY THE *SSMOVE*
  98. * UTILITY AND CONSISTS OF ONE FILE WHICH CONTAINS AN ENTRY FOR EACH
  99. * FILE WHICH IS TO BE DESTAGED. THESE ENTRIES HAVE BEEN ORDERED BY
  100. * *SSMOVE* TO ASSIST IN REDUCING THE NUMBER OF CARTRIDGE ACCESSES
  101. * NEEDED TO DESTAGE ALL THE FILES. THE FIRST SET OF ENTRIES IS FOR
  102. * SUBFAMILY 0, SUBFAMILY 1, ... THROUGH SUBFAMILY 7. WITHIN EACH
  103. * SUBFAMILY, ENTRIES ARE ORDERED SUCH THAT ALL SHORT FILES OCCUR
  104. * FIRST AND ALL LONG FILES OCCUR AFTERWARDS. WITHIN THE LIST OF
  105. * SHORT FILES AND LONG FILES, INDIVIDUAL FILES ARE ORDERED BY
  106. * DECREASING FILE LENGTH. THE *SSMOVE* UTILITY DECLARES A FILE TO
  107. * BE SHORT IF ITS LENGTH IS LESS THAN A SITE SPECIFIED VALUE.
  108. *
  109. * BY DEFINITION, SHORT FILES ONLY RESIDE ON ONE CARTRIDGE. IF A
  110. * SHORT FILE IS ENCOUNTERED WHICH DOES NOT FIT ON ONE CARTRIDGE,
  111. * THE ATTEMPT TO DESTAGE IT IS ABANDONED DUE TO LACK OF SPACE AND
  112. * DESTAGING CONTINUES WITH THE NEXT FILE. TO REDUCE STAGING DELAYS
  113. * DUE TO CARTRIDGE POSITIONING TIME, SHORT FILES ARE STORED AT THE
  114. * FRONT OF A CARTRIDGE. A CARTRIDGE DIVISION POINT PARAMETER TO
  115. * *SSLABEL* DETERMINES THE END OF THE SHORT FILE AREA.
  116. *
  117. * LONG FILES ARE ALLOWED TO OVERFLOW FROM ONE CARTRIDGE TO ANOTHER
  118. * WITHIN A GROUP OF UP TO 16 CARTRIDGES, ALTHOUGH THE DESTAGER
  119. * ATTEMPTS TO AVOID OR REDUCE CARTRIDGE OVERFLOW AS MUCH AS
  120. * POSSIBLE. IF A LONG FILE DOES NOT FIT ON ANY GROUP OF
  121. * CARTRIDGES, THE ATTEMPT TO DESTAGE IT IS ABANDONED DUE TO LACK OF
  122. * AVAILABLE SPACE.
  123. *
  124. * IF THE FIRST FILE OF THE SEQUENCE OF FILES FOR A SUBFAMILY IS A
  125. * SHORT FILE, THE ALLOCATOR SELECTS A CARTRIDGE WHICH WILL
  126. * DEFINITELY HOLD THE FIRST SHORT FILE AND HOPEFULLY WILL HOLD ALL
  127. * THE SHORT FILES. IF THIS IS POSSIBLE, THE ALLOCATOR WILL FURTHER
  128. * PICK THE CARTRIDGE WHICH IS ABLE TO HOLD THE MOST LONG FILES.
  129. * AFTER A CARTRIDGE HAS BEEN SELECTED AND THE FIRST SHORT FILE HAS
  130. * BEEN DESTAGED, AS MANY OTHER SHORT FILES AS WILL FIT ON THAT
  131. * CARTRIDGE ARE DESTAGED, AND THEN AS MANY LONG FILES AS WILL FIT
  132. * ON THAT CARTRIDGE ARE ALSO DESTAGED. ALL FILES WHICH DO NOT FIT
  133. * ON THE CURRENT CARTRIDGE ARE DEFERRED FOR SUBSEQUENT DESTAGING TO
  134. * A DIFFERENT CARTRIDGE. THIS IS DONE BY WRITING THE FILES'S
  135. * *TDAM* ENTRY TO A SCRATCH FILE. WHEN DESTAGING TO THIS FIRST
  136. * CARTRIDGE HAS BEEN COMPLETED, THE ABOVE PROCESS IS REPEATED USING
  137. * THE LIST OF DEFERRED FILES AS INPUT INSTEAD OF THE ORIGINAL LIST
  138. * OF FILES FROM *SSMOVE*. THIS PROCESS CONTINUES ONE CARTRIDGE AT
  139. * A TIME UNTIL ALL THE SHORT FILES AND AS MANY LONG FILES AS
  140. * POSSIBLE HAVE BEEN DESTAGED.
  141. *
  142. * WHEN ONLY LONG FILES REMAIN TO BE DESTAGED, THE PROCESS CONTINUES
  143. * AS DESCRIBED ABOVE. HOWEVER, IF AT ANY TIME, THE FIRST FILE ON
  144. * THE SEQUENCE OF REMAINING FILES WILL NOT FIT ON ONE CARTRIDGE,
  145. * THEN A GROUP OF CARTRIDGES IS SELECTED AND CARTRIDGES WITHIN THIS
  146. * GROUP ARE SELECTED ONE AT A TIME UNTIL THE FIRST FILE HAS BEEN
  147. * COMPLETELY DESTAGED. THE DESTAGE PROCESS THEN CONTINUES BY
  148. * DESTAGING AS MANY OF THE REMAINING LONG FILES AS POSSIBLE TO THE
  149. * FINAL CONTINUATION CARTRIDGE AS LONG AS NO FILE HAS TO OVERFLOW
  150. * TO ANOTHER CARTRIDGE. AGAIN, ANY FILES WHICH DO NOT FIT IN THEIR
  151. * ENTIRETY ARE DEFERRED FOR DESTAGING TO A SUBSEQUENT CARTRIDGE OR
  152. * CARTRIDGES BY WRITING THE DESTAGE *TDAM* ENTRY TO A SCRATCH FILE.
  153. #
  154.  
  155. CONTROL EJECT;
  156.  
  157. #
  158. * D E S T A G E D E T A I L E D F L O W
  159. *
  160. * ( N O R M A L C A S E )
  161. *
  162. * THE FOLLOWING SEQUENCE OCCURS WHEN A FILE IS DESTAGED.
  163. *
  164. * CASE A) NO CARTRIDGE OVERFLOW.
  165. *
  166. * PROCEDURE *DSNTDAM* SELECTS THE SUBFAMILY FOR WHICH FILE
  167. * DESTAGING IS TO OCCUR. IT THEN SELECTS THE FIRST FILE ON THE
  168. * LIST OF FILES SUBMITTED BY *SSMOVE*. IF SHORT FILES ARE TO BE
  169. * DESTAGED, THIS FIRST FILE IS THE LONGEST OF THE SHORT FILES. IF
  170. * ONLY LONG FILES ARE TO BE DESTAGED, THIS FILE IS THE LONGEST OF
  171. * THE LONG FILES.
  172. *
  173. * PROCEDURE *DSALLO* IS CALLED BY *DESTAGR* TO ALLOCATE SOME
  174. * CARTRIDGE SPACE FOR THE FILE DATA. SINCE THIS IS THE INITIAL
  175. * ALLOCATION CALL, IT FIRST SELECTS A STORAGE MODULE THAT CAN BE
  176. * USED, READS IN THE *AST* FOR THIS STORAGE MODULE, PICKS A
  177. * CARTRIDGE (OR, IF OVERFLOW IS ANTICIPATED, A GROUP OF CARTRIDGES
  178. * AND THE INITIAL CARTRIDGE TO BE USED WITHIN THIS GROUP), READS IN
  179. * THE *FCT* ENTRY FOR THIS CARTRIDGE AND FINALLY ALLOCATES A
  180. * SEQUENCE OF ALLOCATION UNITS TO BE USED FOR THE FILE DATA. THIS
  181. * SEQUENCE IS CALLED A VOLUME.
  182. *
  183. * THE DESTAGER THEN CALLS *HLLOAD* TO LOAD THE CARTRIDGE SO IT CAN
  184. * BE ACCESSED AND MAKES A CALL TO *PFM* TO OBTAIN ACCESS TO THE
  185. * FILE DATA. IT THEN CALLS *HLCPYDC* TO COPY SOME FILE DATA FROM
  186. * DISK TO THE CARTRIDGE. IF THE ENTIRE FILE IS NOT YET COPIED TO
  187. * THE CARTRIDGE, CALLS TO ALLOCATE MORE SPACE AND COPY MORE DATA
  188. * ARE MADE UNTIL THE FILE IS COPIED TO THE CARTRIDGE. AS EACH
  189. * VOLUME IS COPIED TO THE CARTRIDGE, THE *FCT* ENTRY IS UPDATED IN
  190. * MEMORY TO REFLECT THE SEQUENCE OF ALLOCATION UNITS THAT ARE USED
  191. * TO STORE THE FILE DATA. UPON COMPLETION OF THIS ALLOCATE/COPY
  192. * SEQUENCE, *PFM* IS AGAIN CALLED TO UPDATE THE FILE'S *PFC* ENTRY
  193. * TO REFLECT THE LOCATION OF THE FILE DATA ON THE ALLOCATED
  194. * CARTRIDGE. IF DISK SPACE IS TO BE RELEASED, ANOTHER CALL TO
  195. * *PFM* IS MADE TO ACHIEVE THIS.
  196. *
  197. * CASE B) ADDITIONAL FILES ON THE SAME CARTRIDGE.
  198. *
  199. * UPON COMPLETION OF THE DESTAGE PROCESS FOR THE FIRST FILE,
  200. * PROCEDURE *DSNTDAM* IS AGAIN CALLED TO SELECT THE NEXT FILE TO BE
  201. * DESTAGED. IT SELECTS ONE WHICH WILL FIT ON THE CURRENT
  202. * CARTRIDGE. IF LONGER FILES EXIST, THEIR DESTAGE ENTRIES ARE
  203. * STORED ON A SCRATCH FILE TO BE PROCESSED LATER WHEN IT BECOMES
  204. * NECESSARY TO SWITCH TO A DIFFERENT CARTRIDGE. THE DESTAGER
  205. * ALLOCATES SPACE VIA *DSALLO*, OBTAINS ACCESS TO THE FILE DATA VIA
  206. * *PFM* AND COPIES THE FILE TO THE CARTRIDGE USING THE
  207. * ALLOCATE/COPY SEQUENCE DESCRIBED ABOVE. THE FILE'S *PFC* ENTRY
  208. * IS UPDATED AND THE DISK SPACE RELEASED AS DESCRIBED ABOVE.
  209. *
  210. * CASE C) CARTRIDGE OVERFLOW.
  211. *
  212. * THIS DESTAGE PROCESS IS SIMILAR TO CASE A), EXCEPT THAT WHEN THE
  213. * FIRST CARTRIDGE NO LONGER HAS AVAILABLE SPACE, THE ALLOCATOR
  214. * SELECTS A CONTINUATION CARTRIDGE. THIS SECOND CARTRIDGE MUST BE
  215. * IN THE SAME GROUP AS THE FIRST. THE LINKAGE INFORMATION FOR THE
  216. * FIRST CARTRIDGE IS UPDATED TO POINT TO ANOTHER CARTRIDGE WITHOUT
  217. * IDENTIFYING A SPECIFIC CARTRIDGE OR INITIAL ALLOCATION UNIT. THE
  218. * *FCT* ENTRY FOR THE FIRST CARTRIDGE IS THEN WRITTEN TO DISK, AND
  219. * THE *FCT* ENTRY FOR THE SECOND CARTRIDGE IS THEN READ TO MEMORY.
  220. * AFTER THE FIRST VOLUME ON THE SECOND CARTRIDGE HAS BEEN WRITTEN,
  221. * THE *FCT* ENTRY FOR THE SECOND CARTRIDGE IS UPDATED TO REFLECT
  222. * THE NEW VOLUME AND WRITTEN TO DISK. THE *FCT* ENTRY FOR THE
  223. * FIRST CARTRIDGE IS READ INTO MEMORY, UPDATED TO LINK TO THE
  224. * INITIAL ALLOCATION UNIT OF THE FIRST VOLUME ON THE SECOND
  225. * CARTRIDGE AND THEN WRITTEN BACK TO DISK. THE *FCT* ENTRY FOR THE
  226. * SECOND CARTRIDGE IS THEN READ BACK TO MEMORY. UPON COMPLETION OF
  227. * THE ALLOCATE/COPY SEQUENCE, THE FILE'S *PFC* ENTRY IS UPDATED AS
  228. * BEFORE, AND THE DISK SPACE RELEASED IF APPROPRIATE.
  229. #
  230.  
  231. CONTROL EJECT;
  232.  
  233. #
  234. * D E S T A G E
  235. *
  236. * E R R O R C O N D I T I O N S A N D P R O C E S S I N G
  237. *
  238. * THE RESULT OF ANY ERROR ENCOUNTERED IN DESTAGING A FILE IS THAT
  239. * THE ERROR CAN BE OVERCOME (SUCH AS A DELAY CONDITION), OR THE
  240. * ERROR WILL CAUSE THE DESTAGE TO BE RETRIED, OR THE ERROR WILL
  241. * CAUSE THE DESTAGE TO BE ABANDONED. FILE DESTAGES WHICH ARE
  242. * ABANDONED RESULT IN A DAYFILE AND ACCOUNT FILE MESSAGE WITH AN
  243. * ERROR CODE. IN ADDITION, *SSMOVE* WILL PRODUCE A NON-CODED
  244. * DESCRIPTION OF THE REASON FOR THE DESTAGE FAILING IF THE *NW*
  245. * PARAMETER WAS NOT SELECTED. IF A DESTAGE IS TO BE RETRIED, THE
  246. * DESTAGE REQUEST IS WRITTEN (BY *DSNTDAM*) TO A SCRATCH FILE.
  247. * AFTER THE CARTRIDGE CURRENTLY IN USE IS SCHEDULED TO BE UNLOADED,
  248. * THE ENTRIES ON THE SCRATCH FILE ARE RESCHEDULED FOR ANOTHER
  249. * DESTAGE ATTEMPT.
  250. *
  251. * CASE A) NO CARTRIDGE OVERFLOW.
  252. *
  253. * 1) *DSALLO* MAKES AN INITIAL ACCESS TO THE SUBFAMILY CATALOG TO
  254. * DETERMINE WHICH STORAGE MODULE TO USE. IF THE SUBFAMILY CATALOG
  255. * IS TEMPORARILY NOT AVAILABLE (BECAUSE *PFDUMP* IS DOING A CATALOG
  256. * BACKUP DUMP) THE DESTAGE ATTEMPT IS DELAYED BY PLACING THE *HLRQ*
  257. * ENTRY ON THE DELAY CHAIN FOR A FEW SECONDS. THE CATALOG ACCESS
  258. * REQUEST IS THEN REPEATED UNTIL THE CATALOG CAN BE ACCESSED. THIS
  259. * TYPE OF CATALOG ACCESS DELAY SHOULD NEVER OCCUR WITH ANY OTHER
  260. * CATALOG ACCESS REQUEST ISSUED BY THE REST OF THE DESTAGE PROCESS.
  261. * IF IT DOES, A FATAL ERROR WILL OCCUR.
  262. *
  263. * 2) *DSALLO* LOOKS AT THE SUBFAMILY CATALOG PREAMBLE AND THE UNIT
  264. * DEVICE TABLE (*UDT*) TO IDENTIFY A STORAGE MODULE WHICH IS USABLE
  265. * AND WHICH ALSO HAS ENOUGH SPACE FOR THE FILE TO BE DESTAGED. IF
  266. * NO SUCH STORAGE MODULE CAN BE FOUND, THE DESTAGE REQUEST IS
  267. * ABANDONED.
  268. *
  269. * 3) *DSALLO* THEN READS THE *AST* FOR THE SELECTED STORAGE MODULE
  270. * SO THE BEST CARTRIDGE OR CARTRIDGE GROUP CAN BE IDENTIFIED. IF A
  271. * READ ERROR OCCURS WHEN READING THE SUBFAMILY CATALOG, THE DESTAGE
  272. * IS ABANDONED. ANY OTHER CATALOG ACCESS ERROR CONDITION IS FATAL.
  273. *
  274. * 4) *DSALLO* THEN EXAMINES THE *AST*. IF THE FILE IS TOO LONG TO
  275. * FIT ON ANY CARTRIDGE OR GROUP OF CARTRIDGES, THE DESTAGE IS
  276. * ABANDONED.
  277. *
  278. * 5) *DSALLO* THEN READS IN THE *FCT* ENTRY FOR THE SELECTED
  279. * CARTRIDGE. A CATALOG ACCESS ERROR RESULTS IN THE DESTAGE BEING
  280. * ABANDONED. ALSO, IF THE *FCT* ENTRY SAYS THAT THE CARTRIDGE IS
  281. * NOT TO BE USED FOR ANY MORE FILES, THE *AST* AND PREAMBLE ARE
  282. * UPDATED, AND A NEW CARTRIDGE IS SELECTED.
  283. *
  284. * 6) *DSALLO* THEN ALLOCATES A VOLUME CONSISTING OF A SEQUENCE OF
  285. * AVAILABLE ALLOCATION UNITS. IF NONE EXIST AND THE CARTRIDGE OR
  286. * GROUP OF CARTRIDGES WAS CHOSEN FOR THIS FILE, THE DESTAGE IS
  287. * ABANDONED. IF THIS FILE IS BEING DESTAGED BECAUSE IT SHOULD HAVE
  288. * BEEN ABLE TO FIT ON A PREVIOUSLY SELECTED CARTRIDGE, THE DESTAGE
  289. * IS RETRIED. THIS ERROR TYPICALLY OCCURS IF A GREATER THAN
  290. * EXPECTED NUMBER OF STRIPES ARE DEMARKED WHILE PREVIOUS VOLUMES OF
  291. * THE FILE WERE BEING WRITTEN.
  292. *
  293. * 7) *DSTAGR* CALLS *HLLOAD* TO LOAD THE CARTRIDGE SO DATA CAN BE
  294. * WRITTEN TO IT. IF ANY PROBLEMS OCCUR, THE DESTAGE ATTEMPT IS
  295. * RETRIED. ALSO, IF THE CARTRIDGE IS LOST OR IS UNUSABLE DUE TO A
  296. * LABEL PROBLEM, THE APPROPRIATE FLAGS ARE SET IN THE *FCT* AND
  297. * EVENTUALLY IN THE *AST* AND PREAMBLE FOR THE SUBFAMILY CATALOG.
  298. *
  299. * 8) *DSTAGR* THEN CALLS *PFM* TO ACQUIRE ACCESS TO THE FILE DATA.
  300. * IF THE REQUEST CAN NOT BE PROCESSED IMMEDIATELY BECAUSE THE
  301. * CATALOG TRACK IS INTERLOCKED, *DESTAGR* PLACES THE *HLRQ* ENTRY
  302. * ON A DELAY CHAIN FOR A FEW SECONDS AND RETRIES THE CALL UNTIL IT
  303. * CAN BE PROCESSED. IF A USER OR SYSTEM ACTION SUCH AS A FILE
  304. * PURGE OR UPDATE HAS OCCURED SUCH THAT THE REASON FOR SELECTING
  305. * THE FILE TO BE DESTAGED HAS BEEN INVALIDATED, THE DESTAGE REQUEST
  306. * IS ABANDONED.
  307. *
  308. * 9) *DESTAGR* CALLS *HLCPYDC* TO COPY FILE DATA FROM DISK TO THE
  309. * CARTRIDGE. A DISK READ ERROR RESULTS IN THE DESTAGE BEING
  310. * ABANDONED. ANY OTHER ERROR CAUSES THE DESTAGE TO BE RETRIED. IF
  311. * THE ERROR WAS DUE TO AN UNRECOVERABLE WRITE ERROR (STRIPE DEMARK
  312. * FAILURE) OR DUE TO EXCESSIVE RECOVERED WRITE ERROS (SUCCESSFUL
  313. * STRIPE DEMARKS) THE AFFECTED AU(S) ARE MARKED AS FLAWED IN THE
  314. * *FCT* ENTRY AND WILL NO LONGER BE AVAILABLE FOR ALLOCATION. IF A
  315. * GENERAL HARDWARE PROBLEM OCCURED, THE CARTRIDGE IS ALSO FORCED TO
  316. * BE UNLOADED SO ANY FURTHER DESTAGES WILL BEGIN WITH THE SELECTION
  317. * OF A STORAGE MODULE AND THEN A CARTRIDGE.
  318. *
  319. * 10) UPON COMPLETION OF THE COPY SEQUENCE, *DESTAGR* MAKES A
  320. * CATALOG ACCESS REQUEST TO WRITE THE *FCT* ENTRY TO DISK TO
  321. * PRESERVE THE STATUS OF THE CARTRIDGE SPACE ALLOCATED TO THE FILE.
  322. * IT THEN CALLS *PFM* TO UPDATE THE FILE'S *PFC* ENTRY TO REFLECT
  323. * THE LOCATION OF THE DATA ON THE CARTRIDGE AND MAY CALL *PFM* TO
  324. * RELEASE THE FILE'S DISK SPACE. A CATALOG ACCESS ERROR RESULTS IN
  325. * THE DESTAGE BEING ABANDONED. A *PFM* ERROR RESPONSE CAN RESULT
  326. * IN A DELAY OR MAY RESULT IN THE DESTAGE BEING ABANDONED OR THE
  327. * DISK SPACE RELEASE NOT BEING DONE.
  328. *
  329. *
  330. * C A R T R I D G E O V E R F L O W E R R O R S
  331. *
  332. * 11) *DSALLO* CAN ENCOUNTER A CASE WHERE MORE SPACE IS NEEDED, BUT
  333. * NONE IS AVAILABLE ON THE CARTRIDGE IN USE. THE DESTAGE IS
  334. * ABANDONED IF THIS CARTRIDGE DOES NOT HAVE AN OFF CARTRIDGE LINK
  335. * AVAILABLE OR IF NO OTHER CARTRIDGE IN THE GROUP HAS ANY AVAILABLE
  336. * SPACE.
  337. *
  338. * A D D I T I O N A L N O T E S
  339. *
  340. * 1) THE ABILITY OF THE M860 CONTROLLER TO DO WRITE ERROR RECOVERY
  341. * BY DEMARKING A STRIPE MEANS THAT LESS DATA CAN BE STORED ON AN AU
  342. * THAN EXPECTED. THEREFORE, A FILE MAY REQUIRE ONE OR POSSIBLY
  343. * MORE AU THAN ANTICIPATED. BECAUSE OF THIS, *DSALLO* CALCULATES
  344. * AN AMOUNT OF CONTINGENCY SPACE WHICH IT TRIES TO ALLOCATE IN
  345. * ADDITION TO THE SPACE NEEDED FOR FILE DATA IF NO STRIPES ARE
  346. * DEMARKED.
  347. *
  348. * 2) IF A FILE DESTAGE IS ABANDONED OR RETRIED, THE DESTAGE
  349. * PROCESS WILL ATTEMPT TO RELEASE ANY AU ALLOCATED TO THE FILE. IF
  350. * CARTRIDGE OVERFLOW HAS OCCURED, THIS IS NOT DONE.
  351. *
  352. * 3) ANY ERRORS ENCOUNTERED BY THE DRIVER AS IT ATTEMPTS TO UNLOAD
  353. * A CARTRIDGE ARE IGNORED BY THE DESTAGE PROCESS.
  354. *
  355. #
  356.  
  357. END # DS$$DOC #
  358.  
  359. TERM
  360. PROC DESTAGR((HLRQADR));
  361.  
  362. # TITLE DESTAGR - DESTAGE FILE FROM DISK TO M860 CARTRIDGE. #
  363.  
  364. BEGIN # DESTAGR #
  365.  
  366. #
  367. * DESTAGR - DESTAGE FILE FROM DISK TO M860 CARTRIDGE.
  368. *
  369. * *DESTAGR* COPIES A PERMANENT FILE FROM DISK TO AN M860
  370. * CARTRIDGE. IT SELECTS THE BEST CARTRIDGE(S) FOR THE FILE,
  371. * ALLOCATES AVAILABLE AU AS NEEDED TO HOLD THE FILE DATA,
  372. * ORGANIZES CONSECUTIVE AU INTO VOLUMES AND LINKS THESE
  373. * VOLUMES INTO A CHAIN THAT DEFINES THE LOCATION OF THE FILE
  374. * DATA ON THE CARTRIDGE. UPON COMPLETION OF THE COPY, THE
  375. * *FCT* ON DISK IS UPDATED TO REFLECT THE CHAIN OF AU/VOLUMES AND
  376. * THE *PFC* ENTRY FOR THE FILE IS UPDATED TO REFLECT THE
  377. * NEW *ASA* VALUE FOR THE M860 COPY OF THE FILE. DEPENDING UPON
  378. * AN INPUT PARAMETER FROM *SSMOVE*, THE DISK SPACE FOR THE FILE
  379. * IS RELEASED UPON SUCCESSFUL COMPLETION OF THE DESTAGE.
  380. * PERFORMANCE MESSAGES ARE WRITTEN TO THE ACCOUNT FILE IF
  381. * EXEC WAS CALLED WITH THE TRACE MODE (*TM*) RUN-TIME PARAMETER.
  382. *
  383. * PROC DESTAGR((HLRQADR))
  384. *
  385. * ENTRY (HLRQADR) - ADDRESS OF THE *HLRQ* ENTRY CONTAINING
  386. * THE DESTAGE REQUEST.
  387. * THE PROCESS STATE FIELD (HLR$HPS) INDICATES THE TYPE
  388. * OF PROCESSING TO BE DONE ON THIS CALL TO *DESTAGR*.
  389. * POSSIBLE ACTIONS ARE AS FOLLOWS..
  390. * - INITIATE THE DESTAGE PROCESS.
  391. * - RESUME PROCESSING AFTER INTERFACING WITH THE DRIVER,
  392. * (TO DO A CARTRIDGE LOAD OR UNLOAD, OR A COPY FROM
  393. * DISK TO CARTRIDGE.)
  394. * - RETRY A FUNCTION WHICH COULD NOT BE DONE PREVIOUSLY
  395. * BECAUSE OF AN INTERLOCK CONDITION.
  396. * - ACCESS A SUBFAMILY CATALOG
  397. * - INTERFACE TO *PFM* (ACQUIRE THE FILE TO BE
  398. * DESTAGED, ENTER A NEW *ASA* VALUE IN THE *PFC*,
  399. * SET AN ERROR FLAG IN THE *PFC*, OR DROP THE
  400. * FILES DISK SPACE).
  401. * EXIT THE PROCESS NAME AND STATE FIELDS ARE SET UP TO
  402. * IDENTIFY THE NEXT PROCESSING ACTION - WHETHER
  403. * BY *DESTAGR* OR BY ONE OF ITS HELPER
  404. * ROUTINES (*HLXXXX*).
  405. *
  406. * PROCESSING LOGIC FOR *DESTAGR* HAS BEEN
  407. * ORGANIZED INTO THE FOLLOWING STEPS.
  408. *
  409. * 1. INITIALIZATION.
  410. *
  411. * 2. ALLOCATE NEXT VOLUME.
  412. *
  413. * 3. UNLOAD CARTRIDGE (IF CARTRIDGE OVERFLOW).
  414. *
  415. * 4. LOAD CARTRIDGE (IF NECESSARY).
  416. *
  417. * 5. ACQUIRE ACCESS TO THE PERMANENT FILE (VIA *PFM*).
  418. *
  419. * 6. COPY DATA TO THE ALLOCATED VOLUME.
  420. *
  421. * 7. UPDATE THE *FCT* TO REFLECT A SUCCESSFUL COPY.
  422. *
  423. * 8. COMPLETE DESTAGING AND UPDATE THE *FCT* ON
  424. * DISK, AND THE *PFC* ENTRY FOR THE FILE.
  425. *
  426. * 9. RELEASE DISK SPACE (IF REQUESTED).
  427. *
  428. * 10. ERROR PROCESSING.
  429. *
  430. * 11. PREPARE TO DESTAGE NEXT FILE, OR TERMINATE.
  431. #
  432.  
  433. ITEM HLRQADR U; # *HLRQ* ENTRY ADDRESS #
  434.  
  435. #
  436. **** PROC DESTAGR - XREF LIST BEGIN.
  437. #
  438.  
  439. XREF
  440. BEGIN
  441. PROC ADD$LNK; # ADD ENTRY TO CHAIN #
  442. PROC ACQ$FCT; # ACQUIRE *FCT* ENTRY #
  443. PROC CKPFETC; # CHECK *UGET* STATUS #
  444. PROC CFLUSH; # FLUSH SM CATALOG BUFFER #
  445. PROC CPUTFCT; # UPDATE *FCT* ENTRY #
  446. PROC CRELSLK; # RELEASE CATALOG INTERLOCKS #
  447. PROC DELAY; # TIMED DELAY #
  448. PROC DROPDS; # DROP DIRECT FILE DISK SPACE #
  449. PROC DROPIDS; # DROP INDIRECT FILE DISK SPACE #
  450. PROC DSALLO; # ALLOCATE SPACE ON SM #
  451. PROC DSERCAT; # DESTAGE ERROR PROCESSOR #
  452. PROC DSERPFM; # DESTAGE ERROR PROCESSOR #
  453. PROC DSNTDAM; # GET NEXT DESTAGE REQUEST #
  454. PROC HLCPYDC; # CHECK COPY RETURN CODES #
  455. PROC HLLOAD; # CHECK LOAD RETURN CODES #
  456. PROC HLLDSET; # SET *HLRQ* INTO *LLRQ* #
  457. PROC MSG; # ISSUE DAYFILE MESSAGE #
  458. PROC MSGAFDF; # ISSUE ACCOUNT-DAYFILE MESSAGE #
  459. PROC RECALL; # GIVE UP CPU FOR A MOMENT #
  460. PROC RETERN; # RETURN FILE #
  461. PROC RLSVOL; # RELEASE UNUSED VOLUME #
  462. PROC RLS$FCT; # RELEASE *FCT* ENTRY #
  463. PROC SETASA; # SET ALTERNATE STORAGE ADDRESS #
  464. PROC UASTPRM; # UPDATE *AST* AND PREAMBLE #
  465. PROC UATTACH; # UTILITY ATTACH OF FILE #
  466. PROC UGET; # UTILITY GET OF FILE #
  467. PROC UPUSAGE; # UPDATE USAGE INFO #
  468. PROC ZFILL; # ZERO FILL BUFFER #
  469. PROC ZSETFET; # INITIALIZE A FET #
  470. END
  471.  
  472. #
  473. **** PROC DESTAGR - XREF LIST END.
  474. #
  475.  
  476. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  477. *CALL,COMBFAS
  478. *CALL,COMBCHN
  479. *CALL,COMBCMD
  480. *CALL,COMBCMS
  481. *CALL COMBCPR
  482. *CALL COMBLRQ
  483. *CALL,COMBMCT
  484. *CALL,COMBTDM
  485. *CALL COMBUDT
  486. *CALL,COMXCTF
  487. *CALL,COMXEMC
  488. *CALL,COMXFCQ
  489. *CALL,COMXHLR
  490. *CALL COMXIPR
  491. *CALL,COMXMSC
  492. *CALL,COMSPFM
  493.  
  494. ITEM ATEOI B; # END OF INFORMATION #
  495. ITEM CC U; # CHAIN CONTROL VALUE #
  496. ITEM CURFCT U; # *FCT* OF A PARALLEL *HLRQ* #
  497. ITEM DRDCOUNT I; # NUMBER OF DRD-S AVAILABLE #
  498. ITEM DSTGCOUNT I; # DRD AVAILABLE TO DESTAGER #
  499. ITEM FLAG B; # BOOLEAN STATUS #
  500. ITEM I I; # LOOP COUNTER #
  501. ITEM QADDR U; # *FCT* ENTRY ADDRESS #
  502. ITEM START I; # STARTING AU #
  503. ITEM STAT I; # STATUS #
  504. ITEM TEMP U; # TEMPORARY #
  505. ITEM TEMP1 U; # TEMPORARY #
  506. ITEM TFAM C(7); # TERMPORARY FAMILY #
  507. ITEM TFCT U; # ASAFCT #
  508. ITEM TTDAMSBF U; # SUBFAMILY NUMBER #
  509. ITEM T1 I; # TEMPORARY #
  510. ITEM T2 I; # TEMPORARY #
  511. ITEM USED I; # AU USED #
  512.  
  513. ARRAY SCR$FET [0:0] P(SFETL); ; # SCRATCH FET #
  514.  
  515. STATUS DSLABEL
  516. DS1A, # INITIALIZATION #
  517. DS2A, # RETRY *DSALLO* CALL #
  518. DS3A, # RE-ENTER AFTER "NORMAL" UNLOAD #
  519. DS3B, # RE-ENTER AFTER "FORCED" LOAD #
  520. DS3C, # RE-ENTER AFTER "UNLOAD" #
  521. DS4A, # RE-ENTER AFTER *HLLOAD* #
  522. DS5A, # RETRY *UATTACH*/*UGET* CALL #
  523. DS5B, # WAIT *UGET* COMPLETE #
  524. DS6A, # RE-ENTER AFTER *HLCPYDC* #
  525. DS8A, # RETRY *SETASA* CALL #
  526. DS9A, # RETRY *DROP(I)DS* CALL #
  527. DS11A, # RE-ENTER AFTER "NORMAL" UNLOAD #
  528. DS11B, # RE-ENTER AFTER "FORCED" LOAD #
  529. DS11C, # RE-ENTER AFTER "UNLOAD" #
  530. DSEND; # END OF LIST #
  531.  
  532.  
  533. SWITCH DSENTR:DSLABEL
  534. DS1A:DS1A,
  535. DS2A:DS2A,
  536. DS3A:DS3A,
  537. DS3B:DS3B,
  538. DS3C:DS3C,
  539. DS4A:DS4A,
  540. DS5A:DS5A,
  541. DS5B:DS5B,
  542. DS6A:DS6A,
  543. DS8A:DS8A,
  544. DS9A:DS9A,
  545. DS11A:DS11A,
  546. DS11B:DS11B,
  547. DS11C:DS11C;
  548.  
  549.  
  550. ARRAY MSGMB [0:0] S(5);
  551. BEGIN # MESSAGE BUFFER #
  552. ITEM MSG$LINE C(00,00,28) = [" CATALOG *FCT* PROBLEM. "];
  553. ITEM MSG$ZERO U(03,48,12) = [0]; # ZERO-BYTE TERMINATOR #
  554. END
  555.  
  556.  
  557. BASED
  558. ARRAY CLEAR [0:0] S(1);
  559. BEGIN
  560. ITEM CLN U(00,36,24); # CLEAR *DRD* ASSIGNMENT #
  561. ITEM RESETDRD U(00,36,24); # NEW *HLRQ* ADDRESS #
  562. END
  563. CONTROL EJECT;
  564.  
  565. #
  566. * STEP 1 - INITIALIZE.
  567. #
  568.  
  569. P<HLRQ> = HLRQADR;
  570. P<TDAM> = LOC(HLR$TDAM[0]);
  571.  
  572. GOTO DSENTR[HLR$HPS[0]];
  573.  
  574. DS1A: # BEGIN DESTAGE #
  575.  
  576. #
  577. * INITIALIZE *HLRQ* FIELDS. NOTE THAT *HLR$VOLAUP* IS
  578. * INITIALIZED IN STEP 5 SINCE IT HAS INPUT TO *DSALLO*.
  579. #
  580.  
  581. HLR$RESP[0] = ERRST"NOERR";
  582. HLR$PRU[0] = 0;
  583. HLR$1STVOL[0] = 0;
  584. HLR$NEWASA[0] = 0;
  585.  
  586. IF TDAMFC[0] EQ TDAMFCODE"STAGE"
  587. THEN
  588. BEGIN # NO RESOURCES - END #
  589. GOTO ENDALL;
  590. END
  591.  
  592.  
  593. #
  594. * STEP 1 - END.
  595. #
  596.  
  597. CONTROL EJECT;
  598.  
  599. #
  600. * STEP 2 - ALLOCATE CARTRIDGE SPACE.
  601. * - THE ALLOCATED AU ARE USED IN STEP 6 TO STORE
  602. * FILE DATA. ANY UNUSED AU ARE MADE AVAILABLE
  603. * FOR RE-USE IN STEP 7 IF NO ERRORS OCCUR.
  604. * IF ERRORS OCCUR IN STEP 6, THE PROCEDURE
  605. * *HLCPYDC* WILL MAKE ANY UNFLAWED AU AVAILABLE
  606. * FOR RE-USE. IF ERRORS OCCUR ELSEWHERE,
  607. * STEP 10 WILL MAKE THESE AU AVAILABLE.
  608. #
  609.  
  610. NEXTVOL: # CHOOSE CARTRIDGE AND AUS #
  611. DS2A: # RETRY *DSALLO* CALL #
  612. HLR$HPS[0] = DSLABEL"DS2A"; # IF WAIT FOR INITERLOCK #
  613.  
  614.  
  615. DSALLO(HLRQADR);
  616.  
  617. HLR$AUUD [0] = HLR$VOLAU [0] ; # IN CASE OF ERROR #
  618. IF HLR$RESP[0] EQ ERRST"WAIT"
  619. THEN # *HLRQ* IS ON CATALOG WAIT #
  620. BEGIN
  621. HLR$RESP[0] = 0;
  622. RETURN;
  623. END
  624.  
  625. IF HLR$RESP[0] EQ ERRST"SPECIAL"
  626. THEN
  627. BEGIN
  628. ADD$LNK(HLRQADR,LCHN"HL$DRDRESW",0);
  629. HLR$RESP[0] = ERRST"NOERR";
  630. RETURN;
  631. END
  632.  
  633. IF (HLR$RESP[0] EQ ERRST"NOERR" ) ##
  634. AND (HLR$VOLLN[0] EQ 0)
  635. THEN # NO SPACE #
  636. BEGIN
  637. IF HLR$FFILE[0]
  638. THEN # ABANDON FIRST FILE #
  639. BEGIN
  640. HLR$RESP[0] = ERRST"ABANDON";
  641. HLR$ERRC[0] = ABANDON"NOSPACE";
  642. END
  643.  
  644. ELSE # RETRY OTHER FILES #
  645. BEGIN
  646. HLR$RESP[0] = ERRST"RETRY";
  647. END
  648.  
  649. END
  650.  
  651. IF HLR$RESP[0] NQ ERRST"NOERR"
  652. THEN
  653. BEGIN
  654. HLR$HPS[0] = DSLABEL"DS2A"; # IF WAIT FOR INTERLOCK #
  655. GOTO DSERR;
  656. END
  657.  
  658. #
  659. * STEP 2 - END.
  660. #
  661.  
  662. CONTROL EJECT;
  663.  
  664. #
  665. * STEP 3 - UNLOAD PREVIOUS CARTRIDGE, IF APPROPRIATE.
  666. * - CALL *HLUNLD* TO DO THE UNLOAD. THE CARTRIDGE
  667. * USAGE STATISTICS ARE RETURNED IN THE *HLRQ*
  668. * ENTRY AND USED TO UPDATE THE *FCT* IN STEP 7.
  669. * - ALL ERROR CONDITIONS ENCOUNTERED IN UNLOADING
  670. * A CARTRIDGE ARE HANDLED BY *HLUNLD*.
  671. * SINCE *DESTAGR* DOES NOT NEED THIS CARTRIDGE
  672. * TO COMPLETE DESTAGING IT DOES NOT CONCERN
  673. * ITSELF WITH WHETHER OR NOT UNLOAD ERRORS OCCURRED.
  674. #
  675.  
  676. IF HLR$UNLD[0]
  677. THEN
  678. BEGIN # UNLOAD OLD CARTRIDGE #
  679. HLR$UNLD[0] = FALSE;
  680. IF HLR$HLRQW[0] NQ 0
  681. THEN
  682. BEGIN # SWITCH CONTROL OF *DRD* TO WAITTING *HLRQ* #
  683. TEMP = HLR$DRDRA[0];
  684. TEMP1 = HLR$LRQADR[0];
  685. P<HLRQ> = HLR$HLRQW[0];
  686. HLR$DRDRA[0] = TEMP;
  687. HLR$LRQADR[0] = TEMP1;
  688. P<HLRQ> = HLRQADR;
  689. ADD$LNK(HLR$HLRQW[0],LCHN"HL$READY",0);
  690. P<LLRQ> = HLR$LRQADR[0];
  691. LLR$UCPRA[0] = HLR$HLRQW[0]; # INSURE PPU POINTS TO
  692.   NEW *HLRQ* #
  693. P<CLEAR> = HLR$DRDRA[0];
  694. RESETDRD = HLR$HLRQW[0];
  695. HLR$HLRQW[0] = 0;
  696. HLR$DRDRA[0] = 0;
  697. HLR$LRQADR[0] = 0;
  698. END
  699.  
  700. ELSE
  701. BEGIN # DO UNLOAD OF CARTRIDGE #
  702. P<LLRQ> = HLR$LRQADR[0];
  703. MSGAFDF("I","UL",0,HLRQADR);
  704. LLR$DR[0] = ERRST"NOERR";
  705. LLR$PRCNME[0] = REQTYP4"UNLD$CART";
  706. LLR$PRCST[0] = PROCST"INITIAL";
  707. HLR$HPS[0] = DSLABEL"DS3A";
  708. ADD$LNK(HLR$LRQADR[0],LCHN"LL$READY",0);
  709. RETURN;
  710.  
  711. DS3A: # RETURN FROM UNLOAD OF CARTRIDGE #
  712.  
  713. IF HLR$RESP[0] NQ RESPTYP4"OK4"
  714. THEN
  715. BEGIN
  716.  
  717. #
  718. * PROCESS UNLOAD CARTRIDGE ERROR AS FOLLOWS:
  719. * -DRIVER PLACED ORIGINAL CARTRIDGE IN OUTPUT STATION.
  720. * -ASSUME A SECOND CARTRIDGE WAS IN DESTINATION CELL.
  721. * -ATTEMPT TO MOVE THIS 2ND CARTRIDGE TO THE OUTPUT
  722. * STATION BY LOADING IT.
  723. * -IF THE LOAD SUCCEEDS, DO A SECOND UNLOAD BACK TO
  724. * THE ORIGINAL DESTINATION.
  725. #
  726.  
  727. HLLDSET((HLRQADR)); # SET UP SECOND LOAD #
  728. HLR$HPS[0] = DSLABEL"DS3B";
  729. RETURN;
  730.  
  731. DS3B: # RETURN FROM SECOND LOAD #
  732.  
  733. IF HLR$RESP[0] EQ RESPTYP4"OK4"
  734. THEN # UNLOAD 2ND CARTRIDGE #
  735. BEGIN
  736. LLR$PRCNME[0] = REQTYP4"UNLD$CART";
  737. LLR$PRCST[0] = PROCST"INITIAL";
  738. HLR$HPS[0] = DSLABEL"DS3C";
  739. ADD$LNK(HLR$LRQADR[0],LCHN"LL$READY",0);
  740. RETURN;
  741.  
  742. DS3C:
  743. END # UNLOAD OF 2ND REQUEST #
  744. END # LOAD OF 2ND REQUEST #
  745. P<CLEAR> = HLR$DRDRA[0];
  746. CLN = 0;
  747. HLR$DRDRA[0] = 0;
  748.  
  749. END # PHYSICAL CARTRIDGE UNLOAD #
  750. END # ORIGINAL UNLOAD REQUEST #
  751.  
  752. #
  753. * STEP 3 END.
  754. #
  755.  
  756. CONTROL EJECT;
  757.  
  758. #
  759. * STEP 4 - LOAD CARTRIDGE, IF APPROPRIATE.
  760. * - CALL *HLLOAD* TO DO THE LOAD AND OBTAIN
  761. * THE LARGE BUFFER. *HLLOAD* WILL UPDATE
  762. * THE *FCT* IF THE CARTRIDGE IS LOST OR HAS
  763. * AN IMPROPER LABEL.
  764. * - IF ERRORS OCCUR, STEP 11 WILL EVENTUALLY CAUSE
  765. * THE CARTRIDGE TO BE UNLOADED AND THE
  766. * ASSOCIATED LARGE BUFFER TO BE RELEASED.
  767. #
  768.  
  769. IF HLR$LOAD[0]
  770. THEN
  771. BEGIN # STEP 4 #
  772. SLOWFOR I=1 STEP 1 UNTIL MAXSMUNIT
  773. DO
  774. BEGIN # FIND *SM* #
  775. IF HLR$SM[0] EQ SM$ID[I]
  776. THEN
  777. BEGIN
  778. GOTO SMFOUND;
  779. END # *SM* FOUND #
  780. END # *SM* SEARCH COMPLETE #
  781.  
  782. SMFOUND:
  783. DRDCOUNT = 0;
  784. IF D0$ON[I]
  785. THEN
  786. BEGIN
  787. DRDCOUNT = 1;
  788. END
  789.  
  790. IF D1$ON[I]
  791. THEN
  792. BEGIN
  793. DRDCOUNT = DRDCOUNT + 1;
  794. END
  795.  
  796. IF SM$DSNUM[I] EQ 0
  797. THEN # DESTAGE DISABLED ON THIS SM #
  798. BEGIN
  799. HLR$RESP[0] = ERRST"SMDSTAGEOFF";
  800. GOTO DSINERR;
  801. END
  802.  
  803. DSTGCOUNT = SM$DSNUM[I];
  804.  
  805. TTDAMSBF = HLR$SBF[0];
  806. TFCT = HLR$FCTX[0];
  807. TFAM = HLR$FAM[0];
  808.  
  809. IF NOT SM$LLRQ1[I]
  810. THEN
  811. BEGIN
  812.  
  813. IF SM$REQRES1[I] NQ 0
  814. AND SM$REQRES1[I] NQ HLRQADR
  815. THEN
  816. BEGIN
  817. P<HLRQ> = SM$REQRES1[I];
  818. IF HLR$HPN[0] EQ HLRPN"DESTAGE"
  819. THEN
  820. BEGIN
  821. DSTGCOUNT = DSTGCOUNT - 1;
  822.  
  823. IF DSTGCOUNT EQ 0
  824. THEN # DO NOT LET A NEW DESTAGE START #
  825. BEGIN
  826. P<HLRQ> = HLRQADR; # SET ERROR TO ORGINIAL HLRQ #
  827. HLR$RESP[0] = ERRST"RSFULL";
  828. GOTO DSINERR;
  829. END
  830. END
  831.  
  832.  
  833. IF HLR$FCTX[0] NQ 0
  834. THEN
  835. BEGIN
  836. CURFCT = HLR$FCTX[0];
  837. END
  838.  
  839. ELSE
  840. BEGIN
  841. CURFCT = HLR$ASAFCT[0];
  842. END
  843.  
  844. IF (TFCT EQ CURFCT)
  845. AND (TTDAMSBF EQ HLR$SBF[0])
  846. AND (TFAM EQ HLR$FAM[0])
  847. THEN # REQUESTING CARTRIDGE MOUNTED #
  848. BEGIN
  849. NEXTHLRQ:
  850. IF HLR$HLRQW[0] EQ 0
  851. THEN
  852. BEGIN # END OF *HLRQ* WRITING CARTRIDGE #
  853. HLR$HLRQW[0] = HLRQADR;
  854. P<HLRQ> = HLRQADR;
  855. STG$MSK = 0;
  856. HLR$HPS[0] = DSLABEL"DS5A";
  857. HLR$LOAD[0] = FALSE;
  858. RETURN;
  859. END
  860. ELSE
  861. BEGIN # FIND END OF *HLRQ* WRITING #
  862. P<HLRQ> = HLR$HLRQW[0];
  863. GOTO NEXTHLRQ;
  864. END
  865. END
  866. END
  867. END # SM$LLRQ1 CHECK #
  868.  
  869. IF NOT SM$LLRQ2[I]
  870. THEN
  871. BEGIN
  872.  
  873. IF SM$REQRES2[I] NQ 0
  874. AND SM$REQRES2[I] NQ HLRQADR
  875. THEN
  876. BEGIN
  877. P<HLRQ> = SM$REQRES2[I];
  878. IF HLR$HPN[0] EQ HLRPN"DESTAGE"
  879. THEN
  880. BEGIN
  881. DSTGCOUNT = DSTGCOUNT - 1;
  882.  
  883. IF DSTGCOUNT EQ 0
  884. THEN # DO NOT LET A NEW DESTAGE START #
  885. BEGIN
  886. P<HLRQ> = HLRQADR; # SET ERROR TO ORGINIAL HLRQ #
  887. HLR$RESP[0] = ERRST"RSFULL";
  888. GOTO DSINERR;
  889. END
  890. END
  891.  
  892.  
  893. IF HLR$FCTX[0] NQ 0
  894. THEN
  895. BEGIN
  896. CURFCT = HLR$FCTX[0];
  897. END
  898.  
  899. ELSE
  900. BEGIN
  901. CURFCT = HLR$ASAFCT[0];
  902. END
  903.  
  904.  
  905. IF (TFCT EQ CURFCT)
  906. AND (TTDAMSBF EQ HLR$SBF[0])
  907. AND (TFAM EQ HLR$FAM[0])
  908. THEN # REQUESTING CARTRIDGE MOUNTED #
  909. BEGIN
  910. NEXTHLRQ1:
  911. IF HLR$HLRQW[0] EQ 0
  912. THEN
  913. BEGIN # END OF *HLRQ* WRITING CARTRIDGE #
  914. HLR$HLRQW[0] = HLRQADR;
  915. P<HLRQ> = HLRQADR;
  916. STG$MSK = 0;
  917. HLR$HPS[0] = DSLABEL"DS5A";
  918. HLR$LOAD[0] = FALSE;
  919. RETURN;
  920. END
  921. ELSE
  922. BEGIN # FIND END OF *HLRQ* WRITING #
  923. P<HLRQ> = HLR$HLRQW[0];
  924. GOTO NEXTHLRQ1;
  925. END
  926. END
  927. END
  928. END # SM$LLRQ2 CHECK #
  929.  
  930. P<HLRQ> = HLRQADR;
  931. IF (SM$REQRES1[I] NQ 0) ##
  932. AND (SM$REQRES2[I] NQ 0)
  933. THEN
  934. BEGIN
  935. HLR$RESP[0] = ERRST"RSFULL";
  936. GOTO DSINERR;
  937. END
  938.  
  939. IF DRDCOUNT EQ 1
  940. THEN
  941. BEGIN
  942. IF(SM$REQRES1[I] NQ 0) ##
  943. OR (SM$REQRES2[I] NQ 0)
  944. THEN
  945. BEGIN
  946. HLR$RESP[0] = ERRST"RSFULL";
  947. GOTO DSINERR;
  948. END
  949. END # END OF ONE *DRD* #
  950.  
  951. IF SM$REQRES1[I] EQ 0
  952. THEN # RESERVE *DRD* #
  953. BEGIN
  954. SM$REQRES1[I] = HLRQADR;
  955. SM$DSFLAG1[I] = TRUE;
  956. HLR$DRDRA[0] = LOC(SM$REQRES1[I]);
  957. END
  958.  
  959. ELSE
  960. BEGIN
  961. SM$REQRES2[I] = HLRQADR;
  962. SM$DSFLAG2[I] = TRUE;
  963. HLR$DRDRA[0] = LOC(SM$REQRES2[I]);
  964. END
  965.  
  966. HLR$HPS[0] = DSLABEL"DS4A";
  967. HLLDSET((HLRQADR)); # MOVE *HLRQ* DATA TO *LLRQ* #
  968. MSGAFDF("I","LD",0,HLRQADR);
  969. RETURN; # WAIT LOAD OF CARTRIDGE #
  970.  
  971. DS4A:
  972. HLLOAD((HLRQADR)); # CHECK RETURN CODES #
  973. DSINERR: # IF *DRD* NOT ASSIGNED #
  974. P<HLRQ> = HLRQADR;
  975. HLR$LOAD[0] = FALSE;
  976. IF HLR$RESP[0] NQ ERRST"NOERR"
  977. THEN
  978. BEGIN
  979. HLR$ERRC[0] = ERRST"SPECIAL";
  980. GOTO DSERR;
  981. END
  982.  
  983. END # STEP 4 #
  984.  
  985. CONTROL EJECT;
  986.  
  987. #
  988. * STEP 5 - ACQUIRE FILE FROM *PFM*, IF APPROPRIATE.
  989. * - ISSUE A *UATTACH* IF DIRECT ACCESS, OTHERWISE,
  990. * ISSUE A *UGET*.
  991. * - CAUSE THE *PFC* ENTRY TO BE STORED AT *HLR$PFC*.
  992. * - RELOOP IF THE *UATTACH* OR *UGET* REQUEST
  993. * CAN NOT BE PROCESSED DUE TO SOME DELAY CONDITION.
  994. * - ABANDON DESTAGE IF THE FILE HAS BEEN DESTAGED.
  995. * - CLEAR THE *HLR$VOLAUP* FIELD.
  996. #
  997.  
  998. DS5A: # RETRY *UATTACH*/*UGET* CALL #
  999. IF HLR$FVOL[0]
  1000. THEN
  1001. BEGIN # STEP 5 #
  1002. NAMEC[0] = HLR$FLNM[0];
  1003. NAMEC[2] = TDAMPFN[0];
  1004. NAMEC[1] = TDAMFAM[0];
  1005.  
  1006. P<PFC> = LOC(HLR$PFC[0]);
  1007.  
  1008. IF NOT TDAMIA[0]
  1009. THEN
  1010. BEGIN # DIRECT ACCESS FILE #
  1011. UATTACH(NAME[0],PFMSTAT,6,NAME[2],PTRD,TDAMUI[0],NAME[1], ##
  1012. TDAMPFID[0],PFC[0],TDAMCDT[0],LOC(PFMRET));
  1013. HLR$PRU[0] = 0; # START WITH SYSTEM SECTOR #
  1014. END # DIRECT ACCESS FILE #
  1015.  
  1016. ELSE
  1017. BEGIN # INDIRECT ACCESS FILE #
  1018. UGET(NAME[0],PFMSTAT,6,NAME[2],TDAMUI[0],NAME[1], ##
  1019. TDAMPFID[0],PFC[0],TDAMCDT[0],LOC(PFMRET));
  1020.  
  1021. HLR$PRU[0] = 1; # START WITH 1ST DATA SECTOR #
  1022. PFMSTAT = -1;
  1023. HLR$HPS[0] = DSLABEL"DS5B";
  1024. GLPFMFL = TRUE;
  1025. ADD$LNK(HLRQADR,LCHN"HL$PFMWAIT",0);
  1026. RETURN;
  1027.  
  1028. END # INDIRECT ACCESS FILE #
  1029. DS5B:
  1030. P<PFC> = LOC(HLR$PFC[0]);
  1031.  
  1032. #
  1033. * CHECK FOR ERROR ON UGET OR UATTACH.
  1034. #
  1035.  
  1036. IF PFMSTAT NQ 0
  1037. THEN
  1038. BEGIN
  1039. DSERPFM(HLRQADR,PFMSTAT);
  1040. IF HLR$RESP[0] NQ ERRST"NOERR"
  1041. THEN
  1042. BEGIN
  1043. HLR$HPS[0] = DSLABEL"DS5A";
  1044. GOTO DSERR;
  1045. END
  1046.  
  1047. END
  1048.  
  1049. IF TDAMASA[0] NQ PFC$AA[0]
  1050. THEN # IF FILE ALREADY DESTAGED #
  1051. BEGIN
  1052. HLR$RESP[0] = ERRST"ABANDON";
  1053. HLR$ERRC[0] = ABANDON"NEWASA";;
  1054. GOTO DSERR;
  1055. END
  1056.  
  1057. HLR$VOLAUP[0] = 0;
  1058. HLR$CSNDP[0] = "";
  1059. HLR$CCODP[0] = "";
  1060. HLR$VOLLNP[0] = 0;
  1061.  
  1062. MSGAFDF("B", "BD",0,HLRQADR);
  1063.  
  1064. END # STEP 5 #
  1065.  
  1066. CONTROL EJECT;
  1067.  
  1068. #
  1069. * STEP 6 - COPY DATA TO THE NEXT VOLUME.
  1070. * - CALL *HLCPYDC* TO EFFECT THE COPY.
  1071. * - IF NO ERROR, *HLR$AUUD* IDENTIFIES THE
  1072. * LAST AU WRITTEN. *HLR$EOI* IS SET IF
  1073. * THE DESTAGE IS COMPLETE.
  1074. #
  1075.  
  1076. P<LLRQ> = HLR$LRQADR[0];
  1077. HLR$HPS[0] = DSLABEL"DS6A";
  1078. LLR$PRCNME[0] = REQTYP4"CPY$DA";
  1079. LLR$PRCST[0] = PROCST"INITIAL";
  1080. LLR$DR[0] = 0;
  1081. ADD$LNK(HLR$LRQADR[0],LCHN"LL$READY",0);
  1082. RETURN; # START COPY #
  1083.  
  1084. DS6A: # RE-ENTER AFTER COPY COMPLETE #
  1085.  
  1086. HLCPYDC((HLRQADR)); # CHECK RETURN CODES #
  1087. IF HLR$RESP[0] NQ ERRST"NOERR"
  1088. THEN
  1089. BEGIN
  1090. GOTO DSERR;
  1091. END
  1092.  
  1093. #
  1094. * STEP 6 - END.
  1095. #
  1096.  
  1097. CONTROL EJECT;
  1098.  
  1099. #
  1100. * STEP 7 - UPDATE *FCT* ENTRY TO REFLECT NEW VOLUME.
  1101. #
  1102.  
  1103. #
  1104. * STEP 7.1 - RELEASE UNUSED AU.
  1105. #
  1106.  
  1107. USED = HLR$AUUD[0]+1-HLR$VOLAU[0];
  1108. RLSVOL(HLRQADR,HLR$FCTQ[0],HLR$AUUD[0]+1,HLR$VOLLN[0]-USED);
  1109.  
  1110.  
  1111. P<PFC> = LOC(HLR$PFC[0]);
  1112.  
  1113. IF TDAMIA[0]
  1114. THEN
  1115. BEGIN
  1116. ATEOI = (HLR$PRU[0] - 1) GQ HLR$PFC$LN[0];
  1117. END
  1118.  
  1119. ELSE
  1120. BEGIN # DIRECT FILE #
  1121. ATEOI = HLR$PRU[0] GQ HLR$PFC$LN[0];
  1122. END
  1123.  
  1124.  
  1125. #
  1126. * STEP 7.2 - ORGANIZED USED AU INTO ONE VOLUME.
  1127. * (CC=LAST, LINK=0, LENGTH=WHATEVER).
  1128. * - THE LINK FIELD IS SET TO ZERO TO FACILITATE
  1129. * ERROR CORRECTION WHEN A PARTIAL CHAIN EXISTS.
  1130. * *SSVAL* WILL TREAT A CHAIN WHICH HAS NO *PFC*
  1131. * ENTRY AND HAS CC=FIRST OR MIDDLE AND A
  1132. * LINK=0 AS IF IT WERE A NORMAL ORPHAN. THIS
  1133. * PERMITS THE NORMAL M860 SPACE MANAGEMENT
  1134. * PROCESS TO MAKE THIS SPACE AVAILABLE WITHOUT
  1135. * HUMAN INTERVENTION.
  1136. #
  1137.  
  1138. P<FCT> = HLR$FCTQ[0] + FCTQHL;
  1139. T1 = 0;
  1140. T2 = 0;
  1141. START = HLR$VOLAU[0];
  1142.  
  1143. FOR I = 0 STEP 1 UNTIL USED-1
  1144. DO
  1145. BEGIN
  1146. SETFCTX(START+I); # SET *FWD* AND *FPS* VALUES #
  1147.  
  1148. FCT$CLFG(FWD,FPS) = 0;
  1149. FCT$FBF(FWD,FPS) = 1;
  1150. FCT$CAUF(FWD,FPS) = T1;
  1151. FCT$CC(FWD,FPS) = CHAINCON"LAST";
  1152. FCT$LEN(FWD,FPS) = USED - 1 - I;
  1153. FCT$LINK(FWD,FPS) = T2;
  1154.  
  1155. T1 = 1; # ALL BUT THE FIRST AU ARE
  1156.   CONTINUATION AU #
  1157. T2 = START;
  1158.  
  1159. END
  1160.  
  1161. #
  1162. * SAVE THE ID OF THE FIRST ALLOCATED VOLUME ON THE
  1163. * CARTRIDGE IN CASE THE DESTAGE IS ABANDONED. THEN THE
  1164. * ALLOCATED SPACE CAN BE RELEASED AND REUSED.
  1165. #
  1166.  
  1167. IF HLR$1STVOL[0] EQ 0
  1168. THEN
  1169. BEGIN
  1170. HLR$1STVOL[0] = START;
  1171. END
  1172.  
  1173. HLR$VOLLN[0] = 0; # PREVENT RE-RELEASING IF FUTURE
  1174.   ERROR RECOVERY #
  1175. CONTROL EJECT;
  1176.  
  1177. #
  1178. * STEP 7.3 - SAVE NEW *FCT* ENTRY, AND GET OLD *FCT* ENTRY.
  1179. #
  1180.  
  1181. IF HLR$JOF[0]
  1182. THEN
  1183. BEGIN # GET *FCT* ENTRY FOR PREVIOUS CARTRIDGE #
  1184. RLS$FCT(HLR$FCTQ[0],0,STAT);
  1185. HLR$FCTQ[0] = 0; # PREVENT A 2ND RELEASE #
  1186. IF STAT EQ CMASTAT"NOERR"
  1187. THEN
  1188. BEGIN
  1189. ACQ$FCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0], ##
  1190. HLR$FCTXP[0],QADDR,0,STAT);
  1191. END
  1192.  
  1193. IF STAT NQ CMASTAT"NOERR"
  1194. THEN
  1195. BEGIN
  1196. DSERCAT(HLRQADR,STAT);
  1197. GOTO DSERR;
  1198. END
  1199.  
  1200. P<FCT> = QADDR + FCTQHL;
  1201.  
  1202. #
  1203. * UPDATE CARTRIDGE USAGE STATISTICS.
  1204. * UPDATE *AST* AND THE PREAMBLE TO REFLECT THE SPACE NOW AVAILABLE.
  1205. #
  1206.  
  1207. UPUSAGE(HLRQADR,QADDR);
  1208.  
  1209. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],QADDR,STAT);
  1210.  
  1211. IF STAT NQ CMASTAT"NOERR"
  1212. THEN
  1213. BEGIN
  1214. DSERCAT(HLRQADR,STAT);
  1215. RLS$FCT(QADDR,0,STAT);
  1216. GOTO DSERR;
  1217. END
  1218.  
  1219. END # GET *FCT* ENTRY FOR PREVIOUS CARTRIDGE #
  1220.  
  1221. CONTROL EJECT;
  1222.  
  1223. #
  1224. * STEP 7.4 - UPDATE LINK TO THIS VOLUME.
  1225. #
  1226.  
  1227. IF HLR$FVOL[0]
  1228. THEN # SET LINKAGE IN *HLRQ* #
  1229. BEGIN
  1230. P<ASA> = LOC(HLR$NEWASA[0]);
  1231. ASASM[0] = HLR$SM[0];
  1232. ASAFCT[0] = HLR$FCTX[0];
  1233. ASAAU[0] = HLR$VOLAU[0];
  1234.  
  1235. END
  1236.  
  1237. ELSE # SET LINKAGE IN PREVIOUS VOLUME #
  1238. BEGIN
  1239. SETFCTX(HLR$VOLAUP[0]); # SET *FWD* AND *FPS* VALUES #
  1240.  
  1241. FCT$LINK(FWD,FPS) = HLR$VOLAU[0];
  1242.  
  1243. IF HLR$JOF[0]
  1244. THEN
  1245. BEGIN
  1246. T1 = FCT$CLKOCL(FWD,FPS);
  1247. FCT$OCLNK(T1) = HLR$FCTX[0];
  1248. END
  1249.  
  1250. END
  1251.  
  1252. CONTROL EJECT;
  1253.  
  1254. #
  1255. * STEP 7.5 - UPDATE BACKLINK INFORMATION.
  1256. #
  1257.  
  1258. HLR$VOLAUP[0] = HLR$VOLAU[0];
  1259. HLR$VOLLNP[0] = USED;
  1260.  
  1261. #
  1262. * STEP 7.6 - RESTORE NEW *FCT* ENTRY, IF APPROPRIATE.
  1263. #
  1264.  
  1265. IF HLR$JOF[0]
  1266. THEN
  1267. BEGIN
  1268. RLS$FCT(QADDR,0,STAT);
  1269. IF STAT EQ CMASTAT"NOERR"
  1270. THEN
  1271. BEGIN
  1272. ACQ$FCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0], ##
  1273. HLR$FCTX[0],QADDR,0,STAT);
  1274. END
  1275.  
  1276. IF STAT NQ CMASTAT"NOERR"
  1277. THEN
  1278. BEGIN
  1279. DSERCAT(HLRQADR,STAT);
  1280. GOTO DSERR;
  1281. END
  1282.  
  1283. P<FCT> = QADDR + FCTQHL;
  1284. HLR$FCTQ[0] = QADDR;
  1285. END
  1286.  
  1287. CONTROL EJECT;
  1288.  
  1289. #
  1290. * STEP 7.7 - SET CORRECT VALUE IN *CC* FIELD.
  1291. #
  1292.  
  1293. IF HLR$FVOL[0]
  1294. THEN
  1295. BEGIN # FIRST OR ONLY VOLUME #
  1296. IF ATEOI
  1297. THEN
  1298. BEGIN
  1299. CC = CHAINCON"ONLY";
  1300. END
  1301.  
  1302. ELSE
  1303. BEGIN
  1304. CC = CHAINCON"FIRST";
  1305. END
  1306.  
  1307. END # FIRST OR ONLY VOLUME #
  1308.  
  1309. ELSE
  1310. BEGIN # MIDDLE OR LAST #
  1311. IF ATEOI
  1312. THEN
  1313. BEGIN
  1314. CC = CHAINCON"LAST";
  1315. END
  1316.  
  1317. ELSE
  1318. BEGIN
  1319. CC = CHAINCON"MIDDLE";
  1320. END
  1321.  
  1322. END # MIDDLE OR LAST #
  1323.  
  1324. SETFCTX(HLR$VOLAU[0]); # SET *FWD* AND *FPS* VALUES #
  1325.  
  1326. FCT$CC(FWD,FPS) = CC;
  1327.  
  1328. #
  1329. * STEP 7 - END.
  1330. #
  1331.  
  1332. CONTROL EJECT;
  1333.  
  1334. #
  1335. * STEP 8 - COMPLETE DESTAGING OF THIS FILE.
  1336. #
  1337.  
  1338. HLR$FVOL[0] = FALSE;
  1339.  
  1340. IF NOT ATEOI
  1341. THEN
  1342. BEGIN
  1343. GOTO NEXTVOL;
  1344. END
  1345.  
  1346. #
  1347. * STEP 8.2 - WRITE *FCT* ENTRY TO DISK.
  1348. #
  1349.  
  1350. CPUTFCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0], ##
  1351. HLR$FCTX[0],P<FCT>,HLRQADR,STAT);
  1352.  
  1353. IF STAT EQ 0
  1354. THEN
  1355. BEGIN
  1356. CFLUSH(TDAMFAM[0],TDAMSBF[0],HLRQADR,STAT);
  1357. END
  1358.  
  1359. IF STAT NQ 0
  1360. THEN
  1361. BEGIN
  1362. DSERCAT(HLRQADR,STAT);
  1363. GOTO DSERR;
  1364. END
  1365.  
  1366. #
  1367. * STEP 8.4 - ISSUE *SETASA* TO COMPLETE DESTAGE.
  1368. #
  1369.  
  1370. DS8A: # RETRY *SETASA* CALL #
  1371.  
  1372. HLR$HPS[0] = DSLABEL"DS8A"; # IF WAIT CONDITION #
  1373. NAMEC[0] = HLR$FLNM[0];
  1374. NAMEC[1] = TDAMFAM[0];
  1375.  
  1376.  
  1377. TDAMASA[0] = HLR$NEWASA[0];
  1378. TDAMAT[0] = ATAS;
  1379.  
  1380. SETASA(NAME[0],STAT,6,TDAMUI[0],NAME[1],TDAMPFID[0], ##
  1381. TDAMASI[0],TDAMCDT[0],LOC(PFMRET));
  1382.  
  1383. IF STAT NQ 0
  1384. THEN
  1385. BEGIN
  1386. DSERPFM(HLRQADR,STAT);
  1387. IF HLR$RESP[0] NQ ERRST"NOERR"
  1388. THEN
  1389. BEGIN
  1390. GOTO DSERR;
  1391. END
  1392.  
  1393. HLR$NEWASA[0] = 0; # CLEAR FOR NO FURTHER *FCT* RELEASE #
  1394. END
  1395.  
  1396. #
  1397. * STEP 8 - END.
  1398. #
  1399.  
  1400. CONTROL EJECT;
  1401.  
  1402. #
  1403. * STEP 9 - RELEASE DISK SPACE, IF REQUESTED.
  1404. #
  1405.  
  1406. IF TDAMFC[0] EQ TDAMFCODE"DESTRLS"
  1407. THEN
  1408. BEGIN # DO RELEASE PROCESSING #
  1409. DS9A: # RETRY *DROP(I)DS* CALL #
  1410. HLR$HPS[0] = DSLABEL"DS9A"; # IF NEED TO RETRY *PFM* CALL #
  1411. NAMEC[0] = HLR$FLNM[0];
  1412. NAMEC[1] = TDAMFAM[0];
  1413. IF TDAMIA[0]
  1414. THEN # INDIRECT ACCESS FILE #
  1415. BEGIN
  1416. DROPIDS(NAME[0],STAT,6,TDAMUI[0],NAME[1], ##
  1417. TDAMPFID[0],TDAMASI[0],TDAMCDT[0],LOC(PFMRET));
  1418. END
  1419.  
  1420. ELSE # DIRECT ACCESS FILE #
  1421. BEGIN
  1422. DROPDS(NAME[0],STAT,6,TDAMUI[0],NAME[1], ##
  1423. TDAMPFID[0],TDAMASI[0],TDAMCDT[0],LOC(PFMRET));
  1424. END
  1425.  
  1426. IF STAT NQ 0
  1427. THEN
  1428. BEGIN
  1429. DSERPFM(HLRQADR,STAT);
  1430. IF HLR$RESP[0] NQ ERRST"NOERR"
  1431. THEN
  1432. BEGIN
  1433. #
  1434.   THE *ASA* IS SET, THE *FCT* SPACE MUST NOT BE RELEASED.
  1435. #
  1436.  
  1437.  
  1438. IF HLR$RESP[0] EQ ERRST"WAIT"
  1439. THEN
  1440. BEGIN
  1441. HLR$RESP[0] = ERRST"NOERR";
  1442. DELAY(PFM$INTV,HLRQADR,HLRQIND);
  1443. RETURN;
  1444. END
  1445.  
  1446. ELSE # REPORT ERROR, BUT DON-T RELEASE *FCT* SPACE. #
  1447. BEGIN
  1448. #
  1449.  
  1450.   SET *ASA* WORKED - LEAVE *FCT* IN TACK.
  1451. #
  1452. HLR$RESP[0] = ERRST"ABANDON";
  1453. GOTO STARTSTEP11;
  1454. END
  1455.  
  1456. END
  1457.  
  1458. END
  1459.  
  1460. END # DO RELEASE PROCESSING #
  1461.  
  1462. HLR$TDAMFL[0] = HLR$PFC$LN[0]; # SET DAYFILE MESSAGE #
  1463. #
  1464. * STEP 9 - END.
  1465. #
  1466.  
  1467. CONTROL EJECT;
  1468.  
  1469. #
  1470. * STEP 10 - HANDLE ERRORS SPECIFIC TO THIS FILE.
  1471. #
  1472.  
  1473. DSERR: # ERROR CLEANUP #
  1474.  
  1475. STAT = HLR$RESP[0];
  1476. IF STAT NQ ERRST"NOERR"
  1477. THEN
  1478. BEGIN # STEP 10 #
  1479. IF STAT EQ ERRST"WAIT"
  1480. THEN
  1481. BEGIN
  1482. HLR$RESP[0] = ERRST"NOERR";
  1483. DELAY(PFM$INTV,HLRQADR,HLRQIND);
  1484. RETURN;
  1485. END
  1486.  
  1487. IF HLR$FCTQ[0] NQ 0
  1488. THEN # RELEASE ALLOCATED AU, IF ANY #
  1489. BEGIN
  1490.  
  1491. P<FCT> = HLR$FCTQ[0] + FCTQHL;
  1492.  
  1493. #
  1494.   RELEASE SPACE ON CURRENT CARTRIDGE.
  1495. #
  1496.  
  1497.  
  1498. START = HLR$1STVOL[0];
  1499. REPEAT WHILE START NQ 0
  1500. DO
  1501. BEGIN
  1502. SETFCTX(START);
  1503. T1 = FCT$LINK(FWD,FPS);
  1504. T2 = FCT$LEN(FWD,FPS) + 1;
  1505.  
  1506. RLSVOL(HLRQADR,HLR$FCTQ,START,T2);
  1507. P<FCT> = HLR$FCTQ[0] + FCTQHL;
  1508. START = T1;
  1509. END
  1510.  
  1511. P<FCT> = HLR$FCTQ[0] + FCTQHL;
  1512. RLSVOL(HLRQADR,HLR$FCTQ[0],HLR$VOLAU[0],HLR$VOLLN[0]);
  1513.  
  1514. END
  1515.  
  1516.  
  1517. #
  1518.   RELEASE PREVIOUS CARTRIDGE SPACE ON CURRENT FILE.
  1519. #
  1520.  
  1521. P<ASA> = LOC(HLR$NEWASA[0]);
  1522.  
  1523. #
  1524.   RECOVER FROM *ASA* IN *HLRQ*.
  1525. #
  1526.  
  1527. I = 0; # CLEAR FOR ERROR CHECK #
  1528. IF ASAFCT[0] NQ HLR$FCTX[0] ##
  1529. AND ASAFCT[0] NQ 0
  1530. THEN
  1531. BEGIN # RELEASE THE FIRST SET OF CARTRIDGE SPACE #
  1532. RLS$FCT(HLR$FCTQ[0],0,STAT);
  1533. TEMP = ASAFCT[0];
  1534. START = ASAAU[0];
  1535. USED = ASAGP[0];
  1536.  
  1537. IF STAT NQ CMASTAT"NOERR"
  1538. THEN
  1539. BEGIN
  1540. DSERCAT(HLRQADR,STAT);
  1541. GOTO DSERREND;
  1542. END
  1543.  
  1544. HLR$FCTQ[0] = 0;
  1545.  
  1546. RLSTART:
  1547.  
  1548. IF TEMP NQ HLR$FCTX[0] ##
  1549. AND TEMP NQ 0
  1550. THEN
  1551. BEGIN # START NEW FCT LOCATION #
  1552. ACQ$FCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],TEMP, ##
  1553. QADDR,0,STAT);
  1554.  
  1555. IF STAT NQ CMASTAT"NOERR"
  1556. THEN
  1557. BEGIN
  1558. DSERCAT(HLRQADR,STAT);
  1559. I = 1;
  1560. GOTO DSERREND;
  1561. END
  1562.  
  1563. P<FCT> = QADDR + FCTQHL;
  1564. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],QADDR,STAT);
  1565.  
  1566. REPEAT WHILE START NQ 0
  1567. DO
  1568. BEGIN
  1569. TEMP1 = 0;
  1570. SETFCTX(START);
  1571. T1 = FCT$LINK(FWD,FPS);
  1572. T2 = FCT$LEN(FWD,FPS) + 1;
  1573.  
  1574. #
  1575.   CHECK FOR OFF-CARTRIDGE LINK
  1576. #
  1577.  
  1578. IF FCT$CLKOCL(FWD,FPS) NQ 0
  1579. THEN
  1580. BEGIN # OFF-CARTRIDGE LINK #
  1581. IF FCT$CLKOCL(FWD,FPS) EQ 1
  1582. THEN
  1583. BEGIN
  1584. B<0,1>FCT$OCLF[0] = 0;
  1585. TEMP1 = USED * 16 + FCT$OCL[0];
  1586. END
  1587.  
  1588. ELSE
  1589. BEGIN
  1590. IF FCT$CLKOCL(FWD,FPS) EQ 2
  1591. THEN
  1592. BEGIN
  1593. B<1,1>FCT$OCLF[0] = 0;
  1594. TEMP1 = USED * 16 + FCT$OCL1[0];
  1595. END
  1596.  
  1597. ELSE
  1598. BEGIN
  1599. B<2,1>FCT$OCLF[0] = 0;
  1600. TEMP1 = USED * 16 + FCT$OCL2[0];
  1601. END
  1602. END
  1603.  
  1604. IF TEMP1 GR (PRM$ENTRC[HLR$SM[0]] + 15) ##
  1605. OR TEMP1 LS 16
  1606. THEN
  1607. BEGIN
  1608. I = 1;
  1609. GOTO DSERREND;
  1610. END
  1611.  
  1612. END
  1613.  
  1614. RLSVOL(HLRQADR,QADDR,START,T2);
  1615. P<FCT> = QADDR + FCTQHL;
  1616. START = T1;
  1617.  
  1618. IF TEMP1 NQ 0
  1619. THEN
  1620. BEGIN
  1621. TEMP = TEMP1;
  1622. P<FCT> = QADDR + FCTQHL;
  1623. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],QADDR,STAT);
  1624. RLS$FCT(QADDR,0,STAT);
  1625. IF STAT NQ CMASTAT"NOERR"
  1626. THEN
  1627. BEGIN
  1628. DSERCAT(HLRQADR,STAT);
  1629. I = 1;
  1630. GOTO DSERREND;
  1631. END
  1632. GOTO RLSTART;
  1633. END
  1634.  
  1635. END # END OF DO LOOP #
  1636.  
  1637. P<FCT> = QADDR + FCTQHL;
  1638. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],QADDR,STAT);
  1639. RLS$FCT(QADDR,0,STAT);
  1640. IF STAT NQ CMASTAT"NOERR"
  1641. THEN
  1642. BEGIN
  1643. DSERCAT(HLRQADR,STAT);
  1644. I = 1;
  1645. GOTO DSERREND;
  1646. END
  1647. END # END OF NEW *FCT* LOACTION FIND #
  1648.  
  1649. #
  1650.   RESET THE ORGINAL CURRENT CARTRIDGE FCT.
  1651. #
  1652.  
  1653.  
  1654. DSERREND:
  1655.  
  1656. IF I NQ 0 # CHECK FOR AN ERROR IN ERROR CLEAN UP #
  1657. THEN
  1658. BEGIN
  1659. MSG(MSGMB,UDFL1);
  1660. IF HLR$FCTQ[0] EQ 0 # IF NO CARTRIDGE #
  1661. THEN
  1662. BEGIN
  1663. GOTO CKSPECIAL;
  1664. END
  1665. END
  1666.  
  1667. HLR$NEWASA[0] = 0; # CLEAR FOR FURTHER RECOVERY #
  1668.  
  1669. IF HLR$FCTX[0] EQ 0
  1670. THEN
  1671. BEGIN
  1672. GOTO CKSPECIAL;
  1673. END
  1674.  
  1675. ACQ$FCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],HLR$FCTX[0], ##
  1676. QADDR,0,STAT);
  1677.  
  1678. IF STAT NQ CMASTAT"NOERR"
  1679. THEN
  1680. BEGIN
  1681. DSERCAT(HLRQADR,STAT);
  1682. HLR$AUSF[0] = 0;
  1683. HLR$AULF[0] = 0;
  1684. GOTO STARTSTEP11;
  1685. END
  1686.  
  1687. P<FCT> = QADDR + FCTQHL;
  1688. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],QADDR,STAT);
  1689. HLR$FCTQ[0] = QADDR;
  1690. END
  1691.  
  1692.  
  1693. CKSPECIAL:
  1694. IF HLR$ERRC[0] EQ ERRST"SPECIAL"
  1695. THEN
  1696. BEGIN # NO CARTRIDGE LOADED #
  1697. HLR$AUSF[0] = 0;
  1698. HLR$AULF[0] = 0;
  1699. END # CARTRIDGE NO LOAD #
  1700.  
  1701. END # STEP 10 #
  1702.  
  1703. CONTROL EJECT;
  1704.  
  1705. #
  1706. * STEP 11 - COMPLETE THIS FILE AND PROCEED WITH NEXT ONE.
  1707. * - RETURN FILE USED FOR DESTAGING.
  1708. * - CALL *DSNTDAM* TO OBTAIN NEXT FILE TO DESTAGE.
  1709. * - UPDATE *AST* TO REFLECT AVAILABLE AU, IF APPROPRIATE.
  1710. * - SWITCH TO STAGING, IF APPROPRIATE.
  1711. * - UNLOAD CARTRIDGE, IF NO MORE FILES FOR IT.
  1712. * - UPDATE *FCT* TO REFLECT USAGE COUNTS.
  1713. * - RELEASE INTERLOCKS ON SUBFAMILY CATALOGS.
  1714. #
  1715.  
  1716. STARTSTEP11:
  1717. ZSETFET(LOC(SCR$FET[0]),HLR$FLNM[0],0,0,SFETL); # RETURN FILE #
  1718. RETERN(SCR$FET[0],RCL);
  1719.  
  1720. HLR$FFILE[0] = FALSE;
  1721.  
  1722. DSNTDAM(HLRQADR);
  1723.  
  1724. #
  1725. * UPDATE THE *AST* IF DONE DESTAGING TO THIS CARTRIDGE.
  1726. #
  1727.  
  1728. FLAG = (HLR$UNLD[0])
  1729. OR (TDAMFC[0] EQ TDAMFCODE"NOREQ")
  1730. OR (TDAMFC[0] EQ TDAMFCODE"STAGE");
  1731.  
  1732. IF (HLR$FCTQ[0] NQ 0) AND ##
  1733. (FLAG OR (HLR$HPN[0] EQ HLRPN"STAGE" ) )
  1734. THEN # UPDATE THE *AST* #
  1735. BEGIN
  1736. P<FCTQ> = HLR$FCTQ[0];
  1737. UASTPRM(FCTQFAMILY[0],FCTQSUBF[0],HLR$SM[0], ##
  1738. HLR$FCTQ[0],STAT);
  1739.  
  1740. IF STAT NQ CMASTAT"NOERR"
  1741. THEN
  1742. BEGIN
  1743. DSERCAT(HLRQADR,STAT);
  1744. END
  1745.  
  1746. END
  1747.  
  1748. #
  1749. * IF THIS *HLRQ* IS TO BE USED TO DO STAGING FROM THIS CARTRIDGE,
  1750. * TRANSFER CONTROL TO *STAGER*.
  1751. #
  1752.  
  1753. IF HLR$HPN[0] EQ HLRPN"STAGE"
  1754. THEN
  1755. BEGIN
  1756. IF DSC$LKMSK NQ 0
  1757. THEN
  1758. BEGIN
  1759. CRELSLK(DSC$FAM,DSC$LKMSK,0,STAT);
  1760. DSC$LKMSK = 0;
  1761. END
  1762.  
  1763. RETURN;
  1764. END
  1765.  
  1766. #
  1767. * EXIT IF NEXT FILE IS TO GO TO THIS CARTRIDGE.
  1768. #
  1769.  
  1770. IF NOT FLAG
  1771. THEN # DESTAGE NEXT FILE TO SAME
  1772.   CARTRIDGE #
  1773. BEGIN
  1774. ADD$LNK(HLRQADR,LCHN"HL$READY",0);
  1775. RETURN;
  1776. END
  1777. IF HLR$FCTQ[0] NQ 0
  1778. THEN # RELEASE *FCT* ENTRY #
  1779. BEGIN
  1780. P<FCTQ> = HLR$FCTQ[0];
  1781.  
  1782. UPUSAGE(HLRQADR,HLR$FCTQ[0]);
  1783.  
  1784.  
  1785. RLS$FCT(HLR$FCTQ[0],0,STAT);
  1786. IF STAT NQ CMASTAT"NOERR"
  1787. THEN
  1788. BEGIN
  1789. DSERCAT(HLRQADR,STAT);
  1790. END
  1791.  
  1792. HLR$FCTQ[0] = 0;
  1793. HLR$FCTX[0] = 0;
  1794.  
  1795. END
  1796.  
  1797.  
  1798. #
  1799. * UNLOAD CARTRIDGE IF ONE WAS SUCCESSFULLY LOADED.
  1800. #
  1801.  
  1802.  
  1803. IF HLR$HLRQW[0] NQ 0
  1804. THEN
  1805. BEGIN # SWITCH CONTROL OF *DRD* TO WAITTING *HLRQ* #
  1806. TEMP = HLR$DRDRA[0];
  1807. TEMP1 = HLR$LRQADR[0];
  1808. P<HLRQ> = HLR$HLRQW[0];
  1809. HLR$DRDRA[0] = TEMP;
  1810. HLR$LRQADR[0] = TEMP1;
  1811.  
  1812. IF HLR$LRQADR[0] EQ 0
  1813. THEN
  1814. BEGIN # TELL NEXT HLRQ CARTRIDGE LOADED BAD #
  1815. HLR$RESP[0] = ERRST"TEMP";
  1816. END
  1817.  
  1818. P<HLRQ> = HLRQADR;
  1819. ADD$LNK(HLR$HLRQW[0],LCHN"HL$READY",0);
  1820. P<LLRQ> = HLR$LRQADR[0];
  1821. LLR$UCPRA[0] = HLR$HLRQW[0]; # INSURE PPU POINTS TO
  1822.   NEW *HLRQ* #
  1823. P<CLEAR> = HLR$DRDRA[0];
  1824. RESETDRD = HLR$HLRQW[0];
  1825. HLR$HLRQW[0] = 0;
  1826. HLR$DRDRA[0] = 0;
  1827. HLR$LRQADR[0] = 0;
  1828. END
  1829.  
  1830. IF HLR$LRQADR[0] NQ 0
  1831. THEN
  1832. BEGIN # DO UNLOAD OF CARTRIDGE #
  1833. P<LLRQ> = HLR$LRQADR[0];
  1834. MSGAFDF("I","UL",0,HLRQADR);
  1835. LLR$DR[0] = ERRST"NOERR";
  1836. LLR$PRCNME[0] = REQTYP4"UNLD$CART";
  1837. LLR$PRCST[0] = PROCST"INITIAL";
  1838. HLR$HPS[0] = DSLABEL"DS11A";
  1839. ADD$LNK(HLR$LRQADR[0],LCHN"LL$READY",0);
  1840. RETURN;
  1841.  
  1842. DS11A: # RETURN FROM UNLOAD OF CARTRIDGE #
  1843.  
  1844. IF HLR$RESP[0] NQ RESPTYP4"OK4"
  1845. THEN
  1846. BEGIN
  1847.  
  1848. #
  1849. * PROCESS UNLOAD CARTRIDGE ERROR AS FOLLOWS:
  1850. * -DRIVER PLACED ORIGINAL CARTRIDGE IN OUTPUT STATION.
  1851. * -ASSUME A SECOND CARTRIDGE WAS IN DESTINATION CELL.
  1852. * -ATTEMPT TO MOVE THIS 2ND CARTRIDGE TO THE OUTPUT
  1853. * STATION BY LOADING IT.
  1854. * -IF THE LOAD SUCCEEDS, DO A SECOND UNLOAD BACK TO
  1855. * THE ORIGINAL DESTINATION.
  1856. #
  1857.  
  1858. HLLDSET((HLRQADR)); # SET UP SECOND LOAD #
  1859. HLR$HPS[0] = DSLABEL"DS11B";
  1860. RETURN;
  1861.  
  1862. DS11B: # RETURN FROM SECOND LOAD #
  1863.  
  1864. IF HLR$RESP[0] EQ RESPTYP4"OK4"
  1865. THEN # UNLOAD 2ND CARTRIDGE #
  1866. BEGIN
  1867. LLR$PRCNME[0] = REQTYP4"UNLD$CART";
  1868. LLR$PRCST[0] = PROCST"INITIAL";
  1869. HLR$HPS[0] = DSLABEL"DS11C";
  1870. ADD$LNK(HLR$LRQADR[0],LCHN"LL$READY",0);
  1871. RETURN;
  1872.  
  1873. DS11C:
  1874. END # UNLOAD OF 2ND REQUEST #
  1875. END # LOAD OF 2ND REQUEST #
  1876. P<CLEAR> = HLR$DRDRA[0];
  1877. CLN = 0;
  1878. HLR$DRDRA[0] = 0;
  1879.  
  1880. END # PHYSICAL CARTRIDGE UNLOAD #
  1881.  
  1882. HLR$UNLD[0] = FALSE;
  1883. IF DSC$LKMSK NQ 0
  1884. THEN # TIME TO RELEASE INTERLOCKS #
  1885. BEGIN
  1886. CRELSLK(DSC$FAM,DSC$LKMSK,0,STAT);
  1887. DSC$LKMSK = 0;
  1888. END
  1889.  
  1890. ENDALL:
  1891.  
  1892. IF TDAMFC[0] EQ TDAMFCODE"STAGE"
  1893. THEN
  1894. BEGIN # *DSNTDAM* PROC FOUND NO ROOM - DO NOT
  1895.   RECALL DESTAGE ROUTINE #
  1896. DSC$INIT = 0;
  1897. DSC$WRESRS = 1;
  1898. HLR$HPS[0] = PROCST"COMPLETE";
  1899. RETURN;
  1900. END
  1901.  
  1902. IF TDAMFC[0] NQ TDAMFCODE"NOREQ"
  1903. THEN
  1904. BEGIN
  1905. HLR$HPS[0] = PROCST"INITIAL";
  1906. ADD$LNK(HLRQADR,LCHN"HL$READY",0);
  1907. END
  1908.  
  1909. ELSE
  1910. BEGIN
  1911. HLR$HPS[0] = PROCST"COMPLETE";
  1912. DSC$INIT = 1;
  1913. END
  1914.  
  1915. #
  1916. * END STEP 11.
  1917. #
  1918.  
  1919. RETURN;
  1920. END # DESTAGR #
  1921.  
  1922. TERM
  1923. PROC DSALLO((HLRQADR));
  1924.  
  1925. # TITLE DSALLO - ALLOCATE A VOLUME ON A M860 CARTRIDGE. #
  1926.  
  1927. BEGIN # DSALLO #
  1928.  
  1929. #
  1930. ** DSALLO - ALLOCATE A VOLUME ON A M860 CARTRIDGE.
  1931. *
  1932. * AN INITIAL CALL TO *DSALLO* SELECTS THE STORAGE MODULE
  1933. * (*SM*), CARTRIDGE GROUP, SPECIFIC CARTRIDGE, AND FIRST
  1934. * VOLUME TO USE ON THAT CARTRIDGE.
  1935. * ON SUBSEQUENT CALLS, *DSALLO* WILL ASSIGN ADDITIONAL
  1936. * VOLUMES ON THE SAME CARTRIDGE. IN A CARTRIDGE OVERFLOW
  1937. * SITUATION, NEW CARTRIDGES IN THE SAME GROUP AS THE FIRST
  1938. * CARTRIDGE WILL BE ASSIGNED IN ORDER TO ACQUIRE THE M860
  1939. * SPACE NECESSARY TO DESTAGE A LONG FILE.
  1940. *
  1941. * PROC DSALLO((HLRQADR))
  1942. *
  1943. * ENTRY (HLRQADR) - ADDRESS OF THE *HLRQ* ENTRY FOR A
  1944. * DESTAGE REQUEST.
  1945. * (HLR$FFILE) - IF FIRST FILE OF A SEQUENCE OF FILES.
  1946. * (HLR$FVOL) - IF FIRST VOLUME OF A FILE.
  1947. * (HLR$PRU) - NUMBER OF PRU DESTAGED SO FAR.
  1948. * (HLR$SH) - TRUE IF SHORT FILE.
  1949. * (HLR$TDAM) - HAS FAMILY, SUBFAMILY, FILE LENGTH.
  1950. * (HLR$XXX) - WHERE XXX REFERS TO THE FIELDS SET BY
  1951. * THE INITIAL CALL TO *DSALLO* WHICH
  1952. * SELECTED A CARTRIDGE.
  1953. * (HLR$VOLAUP) - ID OF PREVIOUS VOLUME IF *FVOL* IS FALSE.
  1954. * TOTAL AU NEEDED FOR SHORT FILES IF
  1955. * *FFILE* AND *FVOL* ARE TRUE.
  1956. *
  1957. * EXIT (HLR$CCOD) - IDENTIFIES SELECTED CARTRIDGE.
  1958. * (HLR$CSND) - IDENTIFIES SELECTED CARTRIDGE.
  1959. * (HLR$SM) - IDENTIFIES *SM* CONTAINING CARTRIDGE.
  1960. * (HLR$FCTQ) - *FCT* QUEUE ENTRY FOR CARTRIDGE.
  1961. * (HLR$Y/Z) - CUBICLE LOCATION OF SELECTED CARTRIDGE.
  1962. * (HLR$FCTX) - *FCT* INDEX OF CARTRIDGE.
  1963. * (HLR$VOLAU) - FIRST *AU* OF ALLOCATED VOLUME.
  1964. * (HLR$VOLLN) - NUMBER OF *AU* IN ALLOCATED VOLUME.
  1965. * (HLR$LOAD) - SAYS TO LOAD A NEW CARTRIDGE.
  1966. * (HLR$UNLD) - SAYS TO UNLOAD AN OLD CARTRIDGE.
  1967. * (HLR$JOF) - SAYS A CARTRIDGE OVERFLOW JUST OCCURRED.
  1968. * (HLR$RESP) - =0, REQUEST SATISFIED WITHOUT ERROR.
  1969. * =N, N IDENTIFIES THE ERROR ACTION.
  1970. * (HLR$ERRC) - REASON FOR ABANDONING A DESTAGE.
  1971. #
  1972.  
  1973.  
  1974. #
  1975. ** NOTES ABOUT THE LOGIC USED IN *DSALLO*.
  1976. *
  1977. * THE SPECIFIC PROCESSING DONE BY *DSALLO* ON A GIVEN CALL
  1978. * DEPENDS UPON WHICH OF FOUR (4) CASES EXISTS AT THE TIME OF
  1979. * THE CALL TO *DSALLO*.
  1980. *
  1981. * CASE A) INITIAL CALL (FIRST VOLUME OF THE FIRST FILE OF
  1982. * A SEQUENCE OF FILES) IN A CARTRIDGE OVERFLOW SITUATION
  1983. * (FIRST FILE IS A LONG FILE).
  1984. *
  1985. * *DSALLO* SELECTS A *SM*, GROUP, INITIAL CARTRIDGE IN
  1986. * THE GROUP, AND A VOLUME ON THE CARTRIDGE.
  1987. *
  1988. *
  1989. * CASE B) INITIAL CALL IN A NON-OVERFLOW SITUATION (FIRST
  1990. * FILE IS A SMALL FILE OR A LONG FILE WHICH IS EXPECTED
  1991. * TO FIT ON ONE CARTRIDGE).
  1992. *
  1993. * *DSALLO* SELECTS A *SM*, SPECIFIC CARTRIDGE, AND A
  1994. * VOLUME ON THAT CARTRIDGE.
  1995. *
  1996. *
  1997. * CASE C) SUBSEQUENT CALL TO CASE A) - TO SELECT THE NEXT
  1998. * CARTRIDGE IN THE GROUP AND ASSIGN A VOLUME ON THIS
  1999. * NEW CARTRIDGE.
  2000. *
  2001. *
  2002. * CASE D) SUBSEQUENT CALL TO CASES A), B) OR C) FOR THE FIRST
  2003. * FILE OF A SEQUENCE, OR ANY CALL FOR OTHER THAN THE
  2004. * FIRST FILE OF A SEQUENCE. IN THIS CASE, *DSALLO*
  2005. * ASSIGNS A VOLUME FROM THE LAST SELECTED CARTRIDGE.
  2006. *
  2007. *
  2008. * THE FOLLOWING LOGIC STEPS ARE CONDITIONALLY EXECUTED
  2009. * DEPENDING UPON THE CASE WHICH EXISTS FOR THIS CALL.
  2010. *
  2011. * STEP IF CASE ACTION
  2012. *
  2013. * 1 (A,B) SELECT A STORAGE MODULE.
  2014. *
  2015. * 1 (C,D) DETERMINE WHETHER CASE C OR D EXISTS.
  2016. * ITS CASE C) IF ITS THE FIRST FILE, A LONG FILE,
  2017. * AND NO SPACE IS LEFT. ITS CASE D) OTHERWISE.
  2018. *
  2019. * 2 (A,B,C) READ IN THE *AST* FOR THE *SM* FROM STEP 1.
  2020. *
  2021. * 3 (A,B) PICK A CARTRIDGE IF ONE WILL HOLD THE FIRST
  2022. * FILE (DETERMINES CASE B), OR PICK A CARTRIDGE
  2023. * GROUP (DETEMINES CASE A).
  2024. *
  2025. * 4 (A,C) SELECT A CARTRIDGE IN THE GROUP.
  2026. *
  2027. * 5 (C) UPDATE OFF-CARTRIDGE LINK.
  2028. * .1) UPDATE THE *FCT* FOR THE PREVIOUS CARTRIDGE
  2029. * TO LINK TO THIS NEW CARTRIDGE.
  2030. * .2) SET THE FLAG TO CAUSE AN UNLOAD OF OLD CARTRIDGE.
  2031. * .3) WRITE THE *FCT* ENTRY FOR THE OLD CARTRIDGE TO
  2032. * DISK.
  2033. *
  2034. * 6 (A,B,C) DO SETUP FOR NEW CARTRIDGE.
  2035. * .1) GET *FCT* ENTRY FOR NEW CARTRIDGE.
  2036. * .2) VERIFY THAT THE *FCT* AND *AST* ENTRIES FOR
  2037. * THIS CARTRIDGE ARE IN SYNC.
  2038. * .3) SET *HLR$FCTQ* FIELD TO POINT TO NEW *FCT* ENTRY.
  2039. * .4) SET THE *HLRQ* FIELDS IDENTIFYING THE AMOUNT OF
  2040. * SPACE LEFT ON THIS CARTRIDGE FOR
  2041. * AND LONG FILES.
  2042. * .5) SET FLAG TO LOAD THIS NEW CARTRIDGE.
  2043. *
  2044. * 7 (ALL) ALLOCATE A VOLUME OF AVAILABLE SPACE ON THIS CARTRIDGE.
  2045. *
  2046. #
  2047.  
  2048. #
  2049. * NOTES ABOUT THE ALLOCATION STRATEGY.
  2050. *
  2051. * 1. ONE ALLOCATION OBJECTIVE IS TO ALLOCATE ENOUGH EXTRA
  2052. * AU TO PROVIDE SOME CONTINGENCY IN CASE SOME STRIPES
  2053. * ARE DEMARKED. INSTALLATION PARAMETERS *CONTG$ADD*
  2054. * AND *CONTG$PER* DEFINE THE NUMBER OF EXTRA STRIPES
  2055. * TO HOPEFULLY BE PROVIDED BY THE ALLOCATION PROCESS.
  2056. * IF THESE EXTRA STRIPES (AU) ARE NOT AVAILABLE,
  2057. * ALLOCATION WILL PROCEED WITHOUT ANY EXTRA STRIPES.
  2058. *
  2059. * 2. IF A CARTRIDGE IS SELECTED BASED ON ITS *AST* ENTRY, BUT
  2060. * ITS *FCT* ENTRY THEN INDICATES THE CARTRIDGE IS UNUSABLE,
  2061. * THE *AST* AND PREAMBLE ARE UPDATED TO REFLECT THIS
  2062. * NEW CARTRIDGE STATUS. THE ALLOCATION PROCESS THEN
  2063. * REPEATS IN AN EFFORT TO FIND ANOTHER CARTRIDGE.
  2064. #
  2065.  
  2066. ITEM HLRQADR I; # *HLRQ* ADDRESS #
  2067.  
  2068. #
  2069. **** PROC DSALLO - XREF LIST BEGIN.
  2070. #
  2071.  
  2072. XREF
  2073. BEGIN
  2074. PROC ACQ$FCT; # ACQUIRE *FCT* ENTRY #
  2075. PROC ANLZAST; # IDENTIFY BEST CARTRIDGE AND
  2076.   GROUP #
  2077. PROC CRDAST; # READ AST TO MEMORY #
  2078. PROC DSERCAT; # PROCESS CATALOG ERRORS #
  2079. PROC OCTSRCH; # OPEN CATALOG SEARCH #
  2080. PROC RLSVOL; # RELEASE UNUSED AU #
  2081. PROC RLS$FCT; # RELEASE *FCT* ENTRY #
  2082. PROC UASTPRM; # UPDATE *AST* AND PREAMBLE #
  2083. END
  2084.  
  2085. #
  2086. **** PROC DSALLO - XREF LIST END.
  2087. #
  2088.  
  2089. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  2090. *CALL,COMBFAS
  2091. *CALL COMBCHN
  2092. *CALL,COMBCMD
  2093. *CALL,COMBCMS
  2094. *CALL,COMBMCT
  2095. *CALL,COMBSIT
  2096. *CALL,COMBTDM
  2097. *CALL,COMBUDT
  2098. *CALL,COMXFCQ
  2099. *CALL,COMXHLR
  2100. *CALL,COMXMSC
  2101.  
  2102.  
  2103. ITEM AU$FILE I; # AU NEEDED FOR REST OF CURRENT
  2104.   FILE #
  2105. ITEM AU$MAX I; # AU NEEDED FOR ALL SHORT FILES #
  2106. ITEM CASE$A B; # IDENTIFIES CASE A #
  2107. ITEM CASE$B B; # IDENTIFIES CASE B #
  2108. ITEM CASE$C B; # IDENTIFIES CASE C #
  2109. ITEM CASE$D B; # IDENTIFIES CASE D #
  2110. ITEM DELTAAU I; # LOOP INDEX #
  2111. ITEM EXTRAAU U; # NUMBER OF CONTINGENCY AU #
  2112. ITEM FCTQADDR U; # FCTQ ADDRESS #
  2113. ITEM FCTX I; # *FCT* INDEX OF BEST CANDIDATE #
  2114. ITEM GRX I; # GROUP INDEX OF BEST CANDIDATE #
  2115. ITEM GRSZ I; # SIZE OF BEST GROUP #
  2116. ITEM I I; # LOOP INDEX #
  2117. ITEM MAXC I; # CAPACITY OF BEST CARTRIDGE #
  2118. ITEM MAXGR I; # CAPACITY OF BEST GROUP #
  2119. ITEM MAXVOLLN U = 128; # REM (SB 128) MAXIMUM VOLUME
  2120.   LENGTH #
  2121. ITEM NOTDONE B; # LOOP TERMINATOR #
  2122. ITEM QADDR I; # ADDRESS OF *FCT* ENTRY #
  2123. ITEM STAT I; # STATUS #
  2124. ITEM SM I; # INDEX OF BEST STORAGE MODULE #
  2125. ITEM SMGR I; # INDEX OF *SM* WITH BEST GROUP #
  2126. ITEM SMOFF B; # STATUS INDICATOR #
  2127. ITEM TMP1 I; # TEMPORARY VARIABLE #
  2128. CONTROL EJECT;
  2129.  
  2130. #
  2131. * INITIALIZE FIELDS.
  2132. #
  2133.  
  2134. P<HLRQ> = HLRQADR;
  2135. P<TDAM> = LOC(HLR$TDAM[0]);
  2136. P<FCT> = HLR$FCTQ[0] + FCTQHL;
  2137.  
  2138. HLR$JOF[0] = FALSE;
  2139. HLR$VOLAU[0] = 0;
  2140. HLR$VOLLN[0] = 0;
  2141.  
  2142. #
  2143. * CALCULATE NECESSARY AU AND A CONTINGENCY AMOUNT.
  2144. #
  2145.  
  2146. TMP1 = 1 + (TDAMFLN[0] - HLR$PRU[0]-1)/INPRUS;
  2147. AU$FILE = 1 + (TMP1-1)/INSPAU; # NECESSARY AU #
  2148.  
  2149. TMP1 = TMP1 + CONTG$ADD + (TMP1*CONTG$PER -1)/100 + 1;
  2150. EXTRAAU = 1 + (TMP1-1)/INSPAU - AU$FILE;
  2151.  
  2152. TRYAGAIN: # USED IF SELECTED CARTRIDGE IS
  2153.   UNUSABLE #
  2154. CASE$A = FALSE;
  2155. CASE$B = FALSE;
  2156. CASE$C = FALSE;
  2157. CASE$D = FALSE;
  2158.  
  2159. #
  2160. * STEP 1 (CASE A OR B) - SELECT A STORAGE MODULE.
  2161. * (CASE C OR D) - DETERMINE WHETHER CASE C OR D.
  2162. #
  2163.  
  2164. IF NOT (HLR$FFILE[0] AND HLR$FVOL[0])
  2165.  
  2166. THEN # CASE C OR D #
  2167.  
  2168. BEGIN # STEP 1CD #
  2169.  
  2170. CASE$C = HLR$JOF[0] OR ##
  2171. ( NOT HLR$SH[0] ##
  2172. AND (FCT$FAULF[0] EQ 0) ##
  2173. AND HLR$FFILE[0] ##
  2174. );
  2175. CASE$D = NOT CASE$C;
  2176. FCTX = HLR$FCTX[0];
  2177.  
  2178. END # STEP 1CD #
  2179.  
  2180. ELSE # CASE A OR B #
  2181.  
  2182. CONTROL EJECT;
  2183. BEGIN # STEP 1AB #
  2184. CASE$A = TRUE; # DECIDE A OR B IN STEP 3 #
  2185. HLR$AUSF[0] = 0;
  2186. HLR$AULF[0] = 0;
  2187.  
  2188. OCTSRCH(TDAMFAM[0],TDAMSBF[0],TMP1,HLRQADR,STAT);
  2189.  
  2190. IF STAT NQ CMASTAT"NOERR"
  2191. THEN
  2192. BEGIN # *OCTSRCH* ERROR #
  2193. IF STAT EQ CMASTAT"INTLK"
  2194. THEN
  2195. BEGIN
  2196. HLR$RESP[0] = ERRST"WAIT";
  2197. RETURN;
  2198.  
  2199. END
  2200.  
  2201. ELSE
  2202. BEGIN
  2203. DSERCAT(HLRQADR,STAT);
  2204. RETURN;
  2205.  
  2206. END
  2207.  
  2208. END # *OCTSRCH* ERROR #
  2209.  
  2210. P<PREAMBLE> = OCT$PRMA[TMP1];
  2211.  
  2212. #
  2213. * STEP 1.2 - CALCULATE AU NEEDED AND PREPARE TO SEARCH
  2214. * FOR THE BEST *SM*.
  2215. #
  2216.  
  2217. AU$MAX = HLR$VOLAUP[0]; # FROM *NXTDEST* #
  2218. SM = 0;
  2219. SMGR = 0;
  2220. P<UDT$SMA> = UDTSADR;
  2221. CONTROL EJECT;
  2222.  
  2223. #
  2224. * STEP 1.3 - SEARCH PREAMBLE TO FIND STORAGE MODULE.
  2225. #
  2226.  
  2227. FOR DELTAAU = EXTRAAU STEP -1 WHILE SM EQ 0
  2228. DO
  2229. BEGIN # *SM* CONTINGENCY LOOP #
  2230. IF DELTAAU LS 0
  2231. THEN # NOT ENOUGH SPACE #
  2232. BEGIN
  2233. HLR$RESP[0] = ERRST"ABANDON";
  2234. HLR$ERRC[0] = ABANDON"NOSPACE";
  2235. RETURN;
  2236. END
  2237.  
  2238. MAXC = AU$FILE + DELTAAU -1;
  2239. MAXGR = MAXC;
  2240. SMOFF = TRUE;
  2241.  
  2242. FOR I = 1 STEP 1 UNTIL MAXSMUNIT
  2243. DO
  2244. BEGIN # *SM* SEARCH #
  2245. TMP1 = SM$ID[I];
  2246.  
  2247. IF PRM$SCW1[TMP1] EQ 0
  2248. THEN # *SM* NOT ASSIGNED TO SUBFAMILY #
  2249. BEGIN
  2250. TEST I;
  2251. END
  2252.  
  2253. IF (SM$HWOFF[I] OR NOT SM$ON[I]) ##
  2254. OR (SM$DSNUM[I] EQ 0) ##
  2255. OR (NOT D0$ON[I] AND NOT D1$ON[I])
  2256. THEN # *SM*/*DRD* NOT USABLE #
  2257. BEGIN
  2258. TEST I;
  2259. END
  2260.  
  2261. ELSE # *SM* ASSIGNED AND USABLE #
  2262. BEGIN
  2263. SMOFF = FALSE;
  2264. END
  2265.  
  2266. IF HLR$SH[0] AND (PRM$MXAUS[TMP1] GR MAXC)
  2267. THEN # FOUND *SM* WITH BETTER CARTRIDGE
  2268.   FOR SHORT FILES #
  2269. BEGIN
  2270. SM = TMP1;
  2271. MAXC = PRM$MXAUS[TMP1];
  2272. TEST I;
  2273. END
  2274.  
  2275. IF NOT HLR$SH[0] AND (PRM$MXAUGR[TMP1] GR MAXC)
  2276. THEN
  2277. BEGIN # CONSIDER CARTRIDGE OR GROUP SIZE #
  2278. IF PRM$MXAUL[TMP1] GR MAXC
  2279. THEN # CONSIDER INDIVIDUAL CARTRIDGE #
  2280. BEGIN
  2281. MAXC = PRM$MXAUL[TMP1];
  2282. SM = TMP1;
  2283. END
  2284.  
  2285. ELSE # CONSIDER GROUP SIZE #
  2286. BEGIN
  2287. IF PRM$MXAUGR[TMP1] GR MAXGR
  2288. THEN
  2289. BEGIN
  2290. MAXGR = PRM$MXAUGR[TMP1];
  2291. SMGR = TMP1;
  2292. END
  2293.  
  2294. END
  2295.  
  2296. END # CONSIDER CARTRIDGE OR GROUP SIZE #
  2297.  
  2298. END # *SM* SEARCH #
  2299.  
  2300. IF SMOFF
  2301. THEN # NO *SM* AVAILABLE #
  2302. BEGIN
  2303. HLR$RESP[0] = ERRST"ABANDON";
  2304. HLR$ERRC[0] = ABANDON"NOSM";
  2305. RETURN;
  2306. END
  2307.  
  2308. #
  2309. * MAKE FINAL *SM* DECISION.
  2310. #
  2311.  
  2312. IF SM EQ 0
  2313. THEN # TRY *SM* WITH BEST GROUP #
  2314. BEGIN
  2315. SM = SMGR;
  2316. END
  2317.  
  2318. END # *SM* CONTINGENCY LOOP #
  2319.  
  2320. HLR$SM[0] = SM;
  2321. END # STEP 1AB #
  2322.  
  2323. CONTROL EJECT;
  2324.  
  2325. #
  2326. * STEP 2 ( CASE A, B OR C) - READ IN *AST*.
  2327. #
  2328.  
  2329. IF NOT CASE$D
  2330. THEN # CASE A, B OR C #
  2331. BEGIN # STEP 2 #
  2332. CRDAST(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],ASTBADR,HLRQADR,STAT);
  2333.  
  2334. IF STAT NQ CMASTAT"NOERR"
  2335. THEN
  2336. BEGIN
  2337. DSERCAT(HLRQADR,STAT);
  2338. RETURN;
  2339. END
  2340.  
  2341. P<AST> = ASTBADR;
  2342.  
  2343. END # STEP 2 #
  2344.  
  2345. CONTROL EJECT;
  2346.  
  2347. #
  2348. * STEP 3 (CASE A OR B) - PICK CARTRIDGE (CASE B) OR
  2349. * PICK GROUP (CASE A).
  2350. #
  2351.  
  2352. IF CASE$A
  2353. THEN
  2354. BEGIN # STEP 3 #
  2355.  
  2356. FCTX = 0;
  2357. FOR DELTAAU = EXTRAAU STEP -1 WHILE FCTX EQ 0
  2358. DO
  2359. BEGIN # *AST* CONTINGENCY LOOP #
  2360. IF DELTAAU LS 0
  2361. THEN # NO SPACE #
  2362. BEGIN
  2363. HLR$RESP[0] = ERRST"ABANDON";
  2364. HLR$ERRC[0] = ABANDON"NOCARGP";
  2365. RETURN;
  2366. END
  2367.  
  2368. IF HLR$SH[0]
  2369. THEN # FIND CARTRIDGE FOR SHORT FILES #
  2370. BEGIN
  2371. GRX = 0;
  2372.  
  2373. ANLZAST(HLR$SM[0],AU$MAX,0,FCTX,DUMMY,DUMMY,DUMMY);
  2374.  
  2375. IF FCTX NQ 0 ##
  2376. AND (AST$AUSF[FCTX] LS AU$FILE)
  2377. THEN # FILE DOES NOT FIT #
  2378. BEGIN
  2379. FCTX = 0;
  2380. END
  2381.  
  2382. END
  2383.  
  2384. ELSE # FIND CARTRIDGE OR GROUP FOR LONG
  2385.   FILES #
  2386. BEGIN
  2387.  
  2388. ANLZAST(HLR$SM[0],0,AU$FILE+DELTAAU,DUMMY,FCTX,GRX,GRSZ);
  2389.  
  2390. END
  2391.  
  2392. IF FCTX NQ 0
  2393. THEN # CASE B #
  2394. BEGIN
  2395. CASE$B = TRUE;
  2396. CASE$A = FALSE;
  2397. END
  2398.  
  2399. ELSE # CASE A OR NO SPACE #
  2400. BEGIN
  2401. IF GRX NQ 0
  2402. THEN # CASE A #
  2403. BEGIN
  2404. CASE$A = TRUE;
  2405. FCTX = GRX*MAXGRT;
  2406. END
  2407.  
  2408. END
  2409.  
  2410. END # *AST* CONTINGENCY LOOP #
  2411.  
  2412. END # STEP 3 #
  2413.  
  2414. CONTROL EJECT;
  2415.  
  2416. #
  2417. * STEP 4 (CASE A OR C) - PICK CARTRIDGE IN GROUP.
  2418. #
  2419.  
  2420. IF CASE$A OR CASE$C
  2421. THEN
  2422. BEGIN # STEP 4 #
  2423. GRX = (FCTX/MAXGRT)*MAXGRT;
  2424. FCTX = 0;
  2425. MAXC = 0;
  2426. FOR DELTAAU = EXTRAAU STEP -1 WHILE FCTX EQ 0
  2427. DO
  2428. BEGIN # CARTRIDGE CONTINGENCY LOOP #
  2429. IF DELTAAU LS 0
  2430. THEN # NO SPACE #
  2431. BEGIN
  2432. HLR$RESP[0] = ERRST"ABANDON";
  2433. HLR$ERRC[0] = ABANDON"GRFULL";
  2434. RETURN;
  2435. END
  2436.  
  2437. FOR I = 0 STEP 1 UNTIL MAXGRT-1
  2438. DO
  2439. BEGIN # SEARCH GROUP FOR BEST CARTRIDGE #
  2440. IF (GRX+I EQ HLR$FCTX[0])
  2441. THEN # DO NOT PICK THIS CARTRIDGE #
  2442. BEGIN
  2443. TEST I;
  2444. END
  2445.  
  2446. TMP1 = AST$AULF[GRX+I];
  2447. IF ((TMP1 LS AU$FILE+DELTAAU) ##
  2448. AND AST$NOCLF[GRX+I]) ##
  2449. OR NOT AST$AAF[GRX+I]
  2450. THEN # CARTRIDGE NOT USABLE #
  2451. BEGIN
  2452. TEST I;
  2453. END
  2454.  
  2455. IF TMP1 GR MAXC
  2456. THEN # PICK THIS CARTRIDGE #
  2457. BEGIN
  2458. FCTX = GRX+I;
  2459. MAXC = TMP1;
  2460. END
  2461.  
  2462. END # SEARCH FOR BEST CARTRIDGE #
  2463.  
  2464. END # CARTRIDGE CONTINGENCY LOOP #
  2465.  
  2466. END # STEP 4 #
  2467.  
  2468. CONTROL EJECT;
  2469.  
  2470. #
  2471. * STEP 5 (CASE C) - PREPARE FOR CARTRIDGE OVERFLOW.
  2472. * .1 SET FLAG TO UNLOAD OLD CARTRIDGE.
  2473. * .2 FORCE *FCT* FOR PREVIOUS CARTRIDGE TO DISK.
  2474. * .3 SET JUST OVERFLOWED FLAG IN *HLRQ* ENTRY.
  2475. #
  2476.  
  2477.  
  2478. IF CASE$C AND (NOT HLR$JOF[0])
  2479. THEN
  2480. BEGIN # STEP 5 #
  2481.  
  2482. HLR$FCTXP[0] = HLR$FCTX[0];
  2483. HLR$CSNTPS[0] = HLR$CSNTCU[0];
  2484.  
  2485. #
  2486. * SELECT AN AVAILABLE *OCL* FIELD IN THE *FCT* HEADER
  2487. * AND UPDATE THE PREVIOUS VOLUME TO LINK TO THE NEW
  2488. * CARTRIDGE VIA THIS *OCL* FIELD.
  2489. #
  2490.  
  2491. NOTDONE = TRUE;
  2492. FOR I = 0 STEP 1 WHILE NOTDONE
  2493. DO
  2494. BEGIN # SET LINK TO NEW CARTRIDGE #
  2495. IF I EQ 3
  2496. THEN # NO OFF-CARTRIDGE LINK AVAILABLE
  2497.   #
  2498. BEGIN
  2499. HLR$RESP[0] = ERRST"ABANDON";
  2500. HLR$ERRC[0] = ABANDON"NOOVERF";
  2501. RETURN;
  2502. END
  2503.  
  2504. IF B<I,1>FCT$OCLF[0] EQ 1
  2505. THEN # THIS LINK FIELD IN USE #
  2506. BEGIN
  2507. TEST I;
  2508. END
  2509.  
  2510. #
  2511. * HAVING FOUND AN AVAILABLE LINK, UPDATE THE
  2512. * LINKAGE TO THE NEW CARTRIDGE.
  2513. #
  2514.  
  2515. B<I,1>FCT$OCLF[0] = 1;
  2516.  
  2517. SETFCTX(HLR$VOLAUP[0]);
  2518. FCT$CLKOCL(FWD,FPS) = I+1;
  2519. NOTDONE = FALSE;
  2520. END # SET LINK TO NEW CARTRIDGE #
  2521.  
  2522. #
  2523. * COMPLETE REST OF STEP 5.
  2524. #
  2525.  
  2526. HLR$UNLD[0] = TRUE;
  2527. HLR$JOF[0] = TRUE;
  2528. HLR$1STVOL[0] = 0; # INDICATE O VOLUMES TO RELEASE #
  2529.  
  2530. RLS$FCT(HLR$FCTQ[0],0,STAT);
  2531.  
  2532. IF STAT NQ CMASTAT"NOERR"
  2533. THEN
  2534. BEGIN
  2535. DSERCAT(HLRQADR,STAT);
  2536. RETURN;
  2537. END
  2538.  
  2539. END # STEP 5 #
  2540.  
  2541. CONTROL EJECT;
  2542.  
  2543. #
  2544. * STEP 6 (CASE A, B OR C) - DO NEW CARTRIDGE SETUP.
  2545. *
  2546. * .1 GET *FCT* ENTRY.
  2547. * .2 VERIFY *FCT* AND *AST* ENTRIES AGREE.
  2548. * .3 COMPLETE SETUP.
  2549. #
  2550.  
  2551. IF NOT CASE$D
  2552. THEN
  2553. BEGIN # STEP 6 #
  2554.  
  2555. FCTQADDR = CHN$BOC[LCHN"FCT$FRSPC"];
  2556.  
  2557. IF FCTQADDR EQ 0
  2558. THEN
  2559. BEGIN
  2560. HLR$RESP[0] = ERRST"SPECIAL";
  2561. RETURN;
  2562. END
  2563.  
  2564.  
  2565. ACQ$FCT(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],FCTX,QADDR,0, STAT);
  2566.  
  2567. IF STAT NQ CMASTAT"NOERR"
  2568. THEN
  2569. BEGIN
  2570. DSERCAT(HLRQADR,STAT);
  2571. RETURN;
  2572.  
  2573. END
  2574.  
  2575. P<FCT> = QADDR + FCTQHL;
  2576.  
  2577. IF FCT$LCF[0] OR FCT$EEF[0] OR FCT$IAF[0]
  2578. THEN # CLEAR ALLOCATION AUTHORIZED FLAG
  2579.   IN *AST* ENTRY #
  2580. BEGIN
  2581. AST$AAF[FCTX] = FALSE;
  2582. UASTPRM(TDAMFAM[0],TDAMSBF[0],HLR$SM[0],0,STAT);
  2583.  
  2584. RLS$FCT(QADDR,0,TMP1);
  2585.  
  2586. IF STAT NQ CMASTAT"NOERR"
  2587. THEN
  2588. BEGIN
  2589. DSERCAT(HLRQADR,STAT);
  2590. RETURN;
  2591. END
  2592.  
  2593. IF TMP1 NQ CMASTAT"NOERR"
  2594. THEN
  2595. BEGIN
  2596. DSERCAT(HLRQADR,TMP1);
  2597. RETURN;
  2598. END
  2599.  
  2600. GOTO TRYAGAIN; # TRY FOR ANOTHER
  2601.   CARTRIDGE/GROUP/SM #
  2602. END
  2603.  
  2604. HLR$FCTQ[0] = QADDR;
  2605. CONTROL EJECT;
  2606.  
  2607. #
  2608. * STEP 6.3 - COMPLETE SETUP.
  2609. #
  2610.  
  2611. HLR$FCTX[0] = FCTX;
  2612. HLR$AUSF[0] = AST$AUSF[FCTX];
  2613. HLR$AULF[0] = AST$AULF[FCTX];
  2614. HLR$LOAD[0] = TRUE;
  2615. HLR$CSND[0] = FCT$CSND[0];
  2616. HLR$CCOD[0] = FCT$CCOD[0];
  2617. HLR$Z[0] = FCT$Z[0];
  2618. HLR$Y[0] = FCT$Y[0];
  2619.  
  2620. END # STEP 6 #
  2621.  
  2622. CONTROL EJECT;
  2623.  
  2624. #
  2625. * STEP 7 (ALL CASE$S) - ALLOCATE A VOLUME.
  2626. #
  2627.  
  2628. IF HLR$SH[0]
  2629. THEN # USE *AU* FOR SHORT FILES #
  2630. BEGIN
  2631. TMP1 = FCT$FAUSF[0];
  2632. END
  2633.  
  2634. ELSE # USE *AU* FOR LONG FILES #
  2635. BEGIN
  2636. TMP1 = FCT$FAULF[0];
  2637. END
  2638.  
  2639. IF TMP1 EQ 0
  2640. THEN # NO SPACE LEFT #
  2641. BEGIN
  2642. RETURN;
  2643. END
  2644.  
  2645. SETFCTX(TMP1);
  2646.  
  2647. HLR$VOLAU[0] = TMP1;
  2648.  
  2649. #
  2650. * CALCULATE AU NEEDED IN THIS VOLUME (MAX OF MAXVOLLN).
  2651. #
  2652.  
  2653. AU$FILE = AU$FILE + EXTRAAU;
  2654. IF AU$FILE GR MAXVOLLN
  2655. THEN
  2656. BEGIN
  2657. AU$FILE = MAXVOLLN;
  2658. END
  2659.  
  2660. #
  2661. * CONCATENATE ADJACENT FREE VOLUMES INTO ONE LARGER
  2662. * VOLUME. IF THE TOTAL EXCEEDS MAXVOLLN AU, RELEASE THE
  2663. * EXTRA AU SO THE FINAL VOLUME IS MAXVOLLN AU.
  2664. #
  2665.  
  2666. NOTDONE = TRUE;
  2667. FOR I = 0 WHILE NOTDONE
  2668. DO
  2669. BEGIN
  2670. HLR$VOLLN[0] = HLR$VOLLN[0] + FCT$LEN(FWD,FPS) + 1;
  2671. TMP1 = FCT$LINK(FWD,FPS);
  2672.  
  2673. IF (HLR$VOLLN[0] GQ AU$FILE ) ##
  2674. OR ( HLR$VOLAU[0] + HLR$VOLLN[0] NQ TMP1 )
  2675. THEN # NO MORE CONCATENATION
  2676.   POSSIBLE/NEEDED #
  2677. BEGIN
  2678. NOTDONE = FALSE;
  2679. TEST I;
  2680. END
  2681.  
  2682. #
  2683. * ADD NEXT FREE VOLUME INTO THE ONE TO BE USED.
  2684. #
  2685.  
  2686. SETFCTX(TMP1);
  2687. TEST I;
  2688. END
  2689.  
  2690.  
  2691. #
  2692. * UPDATE POINTER TO FREE SPACE TO REFLECT SELECTION
  2693. * OF THE ABOVE SELECTED *AU*.
  2694. #
  2695.  
  2696. EXTRAAU = 0;
  2697. IF HLR$VOLLN[0] GR MAXVOLLN
  2698. THEN
  2699. BEGIN
  2700. EXTRAAU = HLR$VOLLN[0] - MAXVOLLN;
  2701. HLR$VOLLN[0] = MAXVOLLN;
  2702. END
  2703.  
  2704. IF HLR$SH[0]
  2705. THEN
  2706. BEGIN
  2707. FCT$FAUSF[0] = TMP1;
  2708. HLR$AUSF[0] = HLR$AUSF[0] - HLR$VOLLN[0] - EXTRAAU;
  2709. END
  2710.  
  2711. ELSE
  2712. BEGIN
  2713. FCT$FAULF[0] = TMP1;
  2714. HLR$AULF[0] = HLR$AULF[0] - HLR$VOLLN[0] - EXTRAAU;
  2715. END
  2716.  
  2717. #
  2718. * AFTER DONE WITH CONCATENATION, RELEASE EXTRA AU.
  2719. #
  2720.  
  2721. RLSVOL(HLRQADR,HLR$FCTQ[0],HLR$VOLAU[0]+MAXVOLLN,EXTRAAU);
  2722.  
  2723. #
  2724. * STEP 7 END.
  2725. #
  2726.  
  2727. RETURN;
  2728. END # DSALLO #
  2729.  
  2730. TERM
  2731. PROC DSERCAT((HLRQADR),(ERRSTAT));
  2732.  
  2733. # TITLE DSERCAT - PROCESS DESTAGE CATALOG ACCESS ERRORS. #
  2734.  
  2735. BEGIN # DSERCAT #
  2736.  
  2737. #
  2738. ** DSERCAT - PROCESS DESTAGE CATALOG ACCESS ERRORS.
  2739. *
  2740. * *DSERCAT* VERIFIES THAT THE ERROR RESPONSES FROM CATALOG
  2741. * ACCESS ROUTINES ARE EXPECTED ONES. IF SO, AN APPROPRIATE
  2742. * ERROR CODE IS RETURNED TO THE *HLRQ*. IF NOT, AN ABORT IS DONE.
  2743. *
  2744. * PROC DSERCAT((HLRQADR))
  2745. *
  2746. * ENTRY (HLRQADR) - ADDRESS OF *HLRQ* ENTRY FOR DESTAGE
  2747. * REQUEST.
  2748. * (ERRSTAT) - ERROR STATUS RETURNED BY A CATALOG
  2749. * ACCESS REQUEST.
  2750. *
  2751. * EXIT (HLR$RESP) - ERROR STATE.
  2752. * (VALUES DEFINED IN *COMXMSC*)
  2753. * = ERRST"ABANDON".
  2754. *
  2755. * MESSAGES * EXEC ABNORMAL, DSERCAT.*
  2756. #
  2757.  
  2758. ITEM HLRQADR U; # *HLRQ* ENTRY ADDRESS #
  2759. ITEM ERRSTAT I; # CATALOG ACCESS ERROR CODE #
  2760.  
  2761. #
  2762. **** PROC DSERCAT - XREF LIST BEGIN.
  2763. #
  2764.  
  2765. XREF
  2766. BEGIN
  2767. PROC ABORT; # ABORT #
  2768. PROC MESSAGE; # ISSUE MESSAGE #
  2769. END
  2770.  
  2771. #
  2772. **** PROC DSERCAT - XREF LIST END.
  2773. #
  2774.  
  2775. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  2776. *CALL,COMBFAS
  2777. *CALL,COMBCMS
  2778. *CALL,COMBTDM
  2779. *CALL,COMXHLR
  2780. *CALL,COMXMSC
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786. P<HLRQ> = HLRQADR;
  2787.  
  2788. IF ERRSTAT EQ CMASTAT"CIOERR"
  2789. THEN # IF READ/WRITE ERROR #
  2790. BEGIN
  2791. HLR$RESP[0] = ERRST"ABANDON";
  2792. HLR$ERRC[0] = ABANDON"CATIOERR";
  2793. RETURN;
  2794. END
  2795.  
  2796. FE$RTN[0] = "DSERCAT."; # ABORT ON FATAL ERROR #
  2797. MESSAGE(FEMSG,UDFL1);
  2798. ABORT;
  2799. END
  2800.  
  2801. TERM
  2802. PROC DSERPFM((HLRQADR),(ERRSTAT));
  2803.  
  2804. # TITLE DSERPFM - PROCESS DESTAGE *PFM* ERRORS. #
  2805.  
  2806. BEGIN # DSERPFM #
  2807.  
  2808. #
  2809. ** DSERPFM - PROCESS DESTAGE *PFM* ERRORS.
  2810. *
  2811. * *DSERPFM* PROCESSES ERROR RESPONSES RETURNED TO *DESTAGR* FROM
  2812. * *PFM* AND RETURNS A STATUS IN THE *HLRQ* ENTRY OF THE
  2813. * DESTAGE REQUEST.
  2814. *
  2815. * PROC DSERPFM((HLRQADR),(ERRSTAT))
  2816. *
  2817. * ENTRY (HLRQADR) - ADDRESS OF *HLRQ* ENTRY FOR DESTAGE
  2818. * REQUEST.
  2819. * (ERRSTAT) - *PFM* ERROR CODE.
  2820. *
  2821. * EXIT (HLR$RESP) - ERROR STATE.
  2822. * (VALUES DEFINED IN *COMXMSC*)
  2823. * = ERRST"NOERR".
  2824. * = ERRST"WAIT".
  2825. * = ERRST"ABANDON".
  2826. *
  2827. * IF THE ERROR STATE INDICATES A DELAY CONDITION
  2828. * (*ERRST"WAIT"*) THEN THE DESTAGE REQUEST HAS BEEN
  2829. * ADDED TO THE *HLRQ* DELAY CHAIN AND WILL BE PUT
  2830. * BACK ON THE *HLRQ* READY CHAIN AFTER A DELAY TIME
  2831. * HAS EXPIRED.
  2832. *
  2833. * MESSAGES * EXEC ABNORMAL, DSERPFM.*
  2834. #
  2835.  
  2836. ITEM HLRQADR U; # *HLRQ* ENTRY ADDRESS #
  2837. ITEM ERRSTAT I; # *PFM* ERROR CODE #
  2838.  
  2839. #
  2840. **** PROC DSERPFM - XREF LIST BEGIN.
  2841. #
  2842.  
  2843. XREF
  2844. BEGIN
  2845. PROC ABORT; # ABORT #
  2846. PROC DELAY; # TIMED DELAY #
  2847. PROC MESSAGE; # ISSUE MESSAGE #
  2848. PROC PFMEC; # CONVERT *PFM* ERROR RESPONSE #
  2849. END
  2850.  
  2851. #
  2852. **** PROC DSERPFM - XREF LIST END.
  2853. #
  2854.  
  2855. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  2856. *CALL,COMBFAS
  2857. *CALL,COMBTDM
  2858. *CALL,COMXHLR
  2859. *CALL,COMXIPR
  2860. *CALL,COMXMSC
  2861. *CALL,COMSPFM
  2862.  
  2863. ITEM ACTION I; # ERROR PROCESSING ACTION #
  2864.  
  2865. SWITCH DPFMER:ERRST # DESTAGE ERROR STATES #
  2866. DPNOERR:NOERR, # NO ERROR #
  2867. DPDELAY:WAIT, # DELAY CONDITION #
  2868. DPFATAL:FATAL, # FATAL ERROR #
  2869. DPFATAL:RESTART, # RESPONSE INVALID FROM *PFMEC* #
  2870. DPFATAL:PERM, # RESPONSE INVALID FROM *PFMEC* #
  2871. DPABAN:ABANDON, # ABANDON DESTAGE #
  2872. DPSPEC:SPECIAL; # SPECIAL CONDITION #
  2873.  
  2874. CONTROL EJECT;
  2875.  
  2876. P<HLRQ> = HLRQADR;
  2877.  
  2878. PFMEC(ERRSTAT,ACTION);
  2879. HLR$RESP[0] = ACTION;
  2880. GOTO DPFMER[ACTION];
  2881.  
  2882. DPABAN: # ABANDON DESTAGE REQUEST #
  2883. IF ERRSTAT EQ FTL
  2884. THEN # RESPONSE INVALID FOR DESTAGE #
  2885. BEGIN
  2886. GOTO DPFATAL;
  2887. END
  2888.  
  2889. HLR$ERRC[0] = ABANDON"PFMERR";
  2890. RETURN;
  2891.  
  2892. DPDELAY: # DELAY DESTAGE REQUEST #
  2893. HLR$RESP[0] = ERRST"WAIT";
  2894. RETURN;
  2895.  
  2896. DPSPEC: # RESPONSE INVALID FOR DESTAGE #
  2897.  
  2898. DPFATAL: # FATAL DESTAGE ERROR #
  2899. FE$RTN[0] = "DSERPFM."; # ABORT ON FATAL ERROR #
  2900. MESSAGE(FEMSG,UDFL1);
  2901. ABORT;
  2902.  
  2903. DPNOERR: # NO ERRORS #
  2904.  
  2905. RETURN;
  2906. END # DSERPFM #
  2907.  
  2908. TERM
  2909. PROC DSNTDAM((HLRQADR));
  2910.  
  2911. # TITLE DSNTDAM - SELECT NEXT FILE TO DESTAGE. #
  2912.  
  2913. BEGIN # DSNTDAM #
  2914.  
  2915. #
  2916. ** DSNTDAM - SELECT NEXT FILE TO DESTAGE.
  2917. *
  2918. * *DSNTDAM* ANALYZES THE RESULTS OF THE PREVIOUS DESTAGE
  2919. * AND ADVANCES TO THE NEXT FILE TO BE DESTAGED. *DSNTDAM*
  2920. * ADVANCES TO THE NEXT SUBFAMILY IF A SUBFAMILY RUNS OUT
  2921. * OF FILES.
  2922. *
  2923. * PROC DSNTDAM
  2924. *
  2925. * ENTRY HLRQADR - ADRRESS OF *HLRQ* ENTRY.
  2926. * FET/BUFFER FOR SCRATC"I" SET UP FOR READ.
  2927. * FET/BUFFER FOR SCRATCH SET UP FOR WRITE.
  2928. * FET/BUFFER FOR *MVOCOM* SET UP FOR WRITE.
  2929. *
  2930. * EXIT (HLR$TDAM) HAS *TDAM* REQUEST FOR NEXT FILE.
  2931. * THE FOLLOWING *HLRQ* FIELDS ARE INITIALIZED.
  2932. * - SH/FFILE/FVOL(TRUE)/VOLAUP.
  2933. #
  2934.  
  2935. ITEM HLRQADR U; # ADDRESS OF *HLRQ* ENTRY #
  2936.  
  2937. #
  2938. ***** PROC DSNTDAM - XREF LIST BEGIN.
  2939. #
  2940.  
  2941. XREF
  2942. BEGIN
  2943. FUNC XCOD C(10); # BINARY TO OCTAL DISPLAY #
  2944. PROC BLOWUP;
  2945. PROC CRELSLK; # RELEASE CATALOG INTERLOCK #
  2946. PROC MESSAGE; # ISSUE A DAYFILE MESSAGE #
  2947. PROC MSGAFDF; # ISSUE ACCOUNT-DAYFILE MESSAGE #
  2948. PROC READ; # READ A FILE #
  2949. PROC READW; # READ FILE TO WORKING BUFFER #
  2950. PROC RENAME; # RENAME A FILE #
  2951. PROC RETERN; # RETURN A FILE #
  2952. PROC REWIND; # REWIND A FILE #
  2953. PROC STNTDAM; # GET FILE TO STAGE #
  2954. PROC WRITER; # WRITE RECORD MARK #
  2955. PROC WRITEW; # WRITE DATA FROM WORKING BUFFER #
  2956. PROC ZSETFET; # SET UP A FET #
  2957. END
  2958.  
  2959. #
  2960. **** PROC DSNTDAM - XREF LIST END.
  2961. #
  2962.  
  2963. DEF PRUPAU #(INSPAU*PRUBLK)#;
  2964.  
  2965. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  2966. *CALL,COMBFAS
  2967. *CALL,COMBBZF
  2968. *CALL,COMBCPR
  2969. *CALL,COMBTDM
  2970. *CALL COMBMAT
  2971. *CALL,COMBUDT
  2972. *CALL COMXCTF
  2973. *CALL,COMXHLR
  2974. *CALL,COMXMFD
  2975. *CALL,COMXMSC
  2976.  
  2977.  
  2978.  
  2979.  
  2980. ITEM ACTION U; # CONTROLS MAIN LOOP PROCESSING #
  2981. ITEM AU U; # FILE SIZE #
  2982. ITEM I U; # LOOP COUNTER #
  2983. ITEM J U; # SCRATCH 1 INDEX #
  2984. ITEM K U; # SCRATCH 2 INDEX #
  2985. ITEM LOOP U; # LOOP INDEX #
  2986. ITEM SF U; # SUBFAMILY INDEX #
  2987. ITEM STAT U; # FET STATUS #
  2988. ITEM STATS U; # WRITE FET STATUS #
  2989. ITEM TAKEIT B; # IF 1ST FILE ABANDONED, DO 2ND #
  2990.  
  2991.  
  2992. CONTROL EJECT;
  2993. P<HLRQ> = HLRQADR;
  2994. P<TDAM> = LOC(HLR$TDAM[0]);
  2995. P<MVPREAM> = LOC(MCF$PRM[0]);
  2996.  
  2997. SF = TDAMSBF[0];
  2998. ACTION = HLR$RESP[0];
  2999. HLR$RESP[0] = ERRST"NOERR";
  3000. TAKEIT = FALSE;
  3001. J = HLR$SCROS1[0];
  3002.  
  3003. #
  3004. ** PROCESS *ABANDON* STATUS.
  3005. * - WRITE *TDAM* ENTRY WITH REASON TO *MOVCOM* FILE.
  3006. * - ISSUE DAYFILE MESSAGE WITH FILE ID AND REASON.
  3007. #
  3008.  
  3009. IF ACTION EQ ERRST"NOERR" ##
  3010. OR ACTION EQ ERRST"ABANDON"
  3011. THEN # ISSUE A MESSAGE #
  3012. BEGIN
  3013. IF ACTION EQ ERRST"ABANDON"
  3014. THEN
  3015. BEGIN
  3016. STAT = HLR$ERRC[0];
  3017. ACTION = ERRST"NOERR";
  3018. TDAMABR[0] = HLR$ERRC[0]; # SAVE ABANDON REASON #
  3019. WRITEW(MCF$FET[0],TDAM[0],TDAMLEN,STATS);
  3020. END
  3021.  
  3022. ELSE
  3023. BEGIN
  3024. STAT = ABANDON"OK";
  3025. DSTCNT = DSTCNT + 1;
  3026. END
  3027.  
  3028. MSGAFDF("E", "ED", STAT,HLRQADR);
  3029.  
  3030. END
  3031.  
  3032. FOR LOOP = LOOP STEP 1
  3033. DO
  3034. BEGIN # MAIN LOOP #
  3035.  
  3036. #
  3037. ** PROCESS *TOTAL DESTAGE DISABLE* CASE.
  3038. *
  3039. * - CLOSE ALL SUB FAMILIES.
  3040. *
  3041. #
  3042.  
  3043.  
  3044. IF (NOT GLBDSFL AND ACTION NQ ERRST"NXTSUBF") # #
  3045. OR (ACTION EQ ERRST"SMDSTAGEOFF")
  3046. THEN # CLOSE OUT SUB FAMILY #
  3047. BEGIN
  3048. STATS = 0;
  3049. IF HLR$ERRC[0] NQ ERRST"SPECIAL"
  3050. THEN # FILE REPORT ALREADY WROTE #
  3051. BEGIN
  3052. READW(SCR1$FET[J],TDAM[0],TDAMLEN,STATS);
  3053. END
  3054.  
  3055. IF STATS NQ 0
  3056. THEN
  3057. BEGIN
  3058. WRITER(SCR2$FET[J],RCL);
  3059. RENAME(SCR2$FET[J],SCRNMU[SF]);
  3060. HLR$ERRC[0] = 0;
  3061. HLR$UNLD[0] = HLR$FCTQ[0] NQ 0;
  3062. CLEARBUF[J] = 0;
  3063. SCR$HLRQ[SF] = 0;
  3064.  
  3065. SLOWFOR I = 0 STEP 1 UNTIL MAXSF
  3066. DO
  3067. BEGIN # CLEAR WAIT DRD FLAG ON ALL SUB FAMILYS #
  3068. SCR$WTDRD[I] = FALSE;
  3069. END
  3070.  
  3071. ACTION = ERRST"NXTSUBF";
  3072. END
  3073.  
  3074. ELSE
  3075. BEGIN
  3076. STAT = ABANDON"CLOSEDS";
  3077. TDAMABR[0] = ABANDON"CLOSEDS";
  3078. WRITEW(MCF$FET[0],TDAM[0],TDAMLEN,STATS);
  3079. MSGAFDF("E", "ED", STAT,HLRQADR);
  3080. ACTION = ERRST"SMDSTAGEOFF";
  3081. END
  3082.  
  3083. HLR$ERRC[0] = 0;
  3084. END
  3085.  
  3086. #
  3087. ** PROCESS *NOERR* CASE.
  3088. *
  3089. * - GET NEXT *TDAM* ENTRY.
  3090. * - IF NEXT FILE OK TO DESTAGE, RETURN.
  3091. * OTHERWISE, DEFER ITS DESTAGE BY SETTING
  3092. * ITS STATUS TO "RETRY".
  3093. * - IF NO MORE FILES, CLOSE THE SCRATCH FILE
  3094. * CONTAINING FILES TO BE RETRIED AND
  3095. * RENAME IT TO THE ORIGINAL NAME FOR THAT SF.
  3096. * - IF *DOSTG* FLAG IS SET, ASSIGN *HLRQ* ENTRY TO STAGE
  3097. * A FILE. OTHERWISE, GET THE NEXT FILE FROM THE
  3098. * NEXT SUBFAMILY AND CONTINUE DESTAGING.
  3099. #
  3100.  
  3101. IF ACTION EQ ERRST"NOERR"
  3102.  
  3103. THEN
  3104. BEGIN # GET NEXT *TDAM* ENTRY #
  3105. READW(SCR1$FET[J],TDAM[0],TDAMLEN,STAT);
  3106.  
  3107. IF STAT EQ OK
  3108. THEN
  3109. BEGIN # DESTAGE OR RETRY THIS FILE #
  3110. AU = 1 + (TDAMFLN[0]-1)/PRUPAU;
  3111. HLR$SH[0] = TDAMFLN[0] LS MVPR$LB[0];
  3112. IF HLR$FFILE[0] OR TAKEIT # ACCEPT 1ST FILE OF SEQUENCE #
  3113.  
  3114. OR (HLR$SH[0] # SHORT FILE WHICH SHOULD FIT #
  3115. AND (AU LS HLR$AUSF[0]) ) ##
  3116.  
  3117. OR (NOT HLR$SH[0] # LONG FILE WHICH SHOULD FIT #
  3118. AND (AU LS HLR$AULF[0]) ) ##
  3119.  
  3120. THEN # DESTAGE FILE #
  3121. BEGIN
  3122. HLR$HPS[0] = PROCST"INITIAL";
  3123. HLR$FVOL[0] = TRUE;
  3124. RETURN;
  3125. END
  3126.  
  3127. ELSE # RETRY FILE #
  3128. BEGIN
  3129. ACTION = ERRST"RETRY";
  3130. TEST LOOP;
  3131. END
  3132.  
  3133. END # DESTAGE OR RETRY THIS FILE #
  3134.  
  3135. ELSE # CLOSE FILE OF TDAM-S TO BE
  3136.   RETRIED #
  3137. BEGIN
  3138. WRITER(SCR2$FET[J],RCL);
  3139. RENAME(SCR2$FET[J],SCRNMU[SF]);
  3140. CLEARBUF[J] = 0;
  3141. SCR$HLRQ[SF] = 0;
  3142.  
  3143. IF HLR$DOSTG[0] AND (HLR$LRQADR[0] NQ 0) ##
  3144. AND (HLR$ERRC[0] NQ ERRST"SPECIAL")
  3145. THEN # GET FILE TO BE STAGED #
  3146. BEGIN
  3147. DSC$INIT = 1;
  3148. STNTDAM(HLRQADR);
  3149. RETURN;
  3150. END
  3151.  
  3152. HLR$ERRC[0] = 0;
  3153. HLR$UNLD[0] = HLR$FCTQ[0] NQ 0;
  3154.  
  3155. SLOWFOR I = 1 STEP 1 UNTIL MAXSMUNIT
  3156. DO
  3157. BEGIN # FIND MATCHING *SM* #
  3158.  
  3159. IF HLR$SM[0] EQ SM$ID[I]
  3160. THEN
  3161. BEGIN # CLEAR FOR THE NEXT SUBFAMILY #
  3162.  
  3163. SLOWFOR K = 0 STEP 1 UNTIL MAXSF
  3164. DO
  3165. BEGIN # CHECK FOR PENDING REQUEST #
  3166.  
  3167. IF B<K>SM$DSRFW0[I] NQ 0
  3168. THEN
  3169. BEGIN # CLEAR REQUEST #
  3170. B<K>SM$DSRFW0[I] = 0;
  3171. SCR$WTDRD[K] = FALSE;
  3172. GOTO DRDOPEN;
  3173. END
  3174. END # CHECK FOR PENDING REQUEST #
  3175. END # CLEAR OF SUBFAMILY #
  3176. END # CLEAR OF DRD #
  3177.  
  3178. IF DSC$WRESRS NQ 0
  3179. THEN # FORCE A DESTAGE RESTART #
  3180. BEGIN
  3181. DSC$INIT = 1;
  3182. END
  3183.  
  3184. #
  3185. * CHECK FOR AN OTHER *SM* WAITING A RESTART.
  3186. *
  3187. #
  3188.  
  3189.  
  3190. SLOWFOR I = 1 STEP 1 UNTIL MAXSMUNIT
  3191. DO
  3192. BEGIN # FIND *SM* #
  3193. IF HLR$SM[0] NQ SM$ID[I]
  3194. THEN
  3195. BEGIN # DESTAGE WAITING *DRD* #
  3196.  
  3197. SLOWFOR J = 0 STEP 1 UNTIL MAXSF
  3198. DO
  3199. BEGIN # CHECK FOR DESTAGE WAITING #
  3200.  
  3201. IF B<J>SM$DSRFW0[I] NQ 0
  3202. THEN
  3203. BEGIN
  3204. B<J>SM$DSRFW0[I] = 0;
  3205. SCR$WTDRD[J] = FALSE;
  3206. DSC$INIT = 1;
  3207. GOTO DRDOPEN;
  3208. END
  3209. END # COMPLETED CHECK OF WAITING #
  3210. END # DESTAGE WAITNG *DRD* #
  3211. END # FIND *SM* #
  3212.  
  3213. DRDOPEN:
  3214. ACTION = ERRST"NXTSUBF";
  3215. TEST LOOP;
  3216. END
  3217.  
  3218. END # GET NEXT *TDAM* ENTRY #
  3219.  
  3220. #
  3221. ** PROCESS *RETRY* STATUS.
  3222. *
  3223. * - SAVE *TDAM* ENTRY ON SCRATCH FILE.
  3224. * - ADD FILE LENGTH TO REQUIREMENTS.
  3225. #
  3226.  
  3227. IF ACTION EQ ERRST"RETRY"
  3228.  
  3229. THEN
  3230. BEGIN # RETRY CASE #
  3231. WRITEW(SCR2$FET[J],TDAM[0],TDAMLEN,STAT);
  3232. AU = 1 + (TDAMFLN[0]-1)/PRUPAU;
  3233. IF HLR$SH[0]
  3234. THEN
  3235. BEGIN
  3236. SCR$AUS[SF] = SCR$AUS[SF] + AU;
  3237. END
  3238.  
  3239. ELSE
  3240. BEGIN
  3241. SCR$AUL[SF] = SCR$AUL[SF] + AU;
  3242. END
  3243.  
  3244. ACTION = ERRST"NOERR"; # GET NEXT FILE TO DESTAGE #
  3245. TEST LOOP;
  3246. END # RETRY CASE #
  3247.  
  3248. #
  3249. *
  3250. * PROCESS A *RESOURES* BEING CASE.
  3251. * - HOLD UP *DESTAGING* UNTIL RESOURSES
  3252. * ARE AVAILABLE.
  3253. *
  3254. #
  3255.  
  3256.  
  3257. IF ACTION EQ ERRST"RSFULL"
  3258. THEN
  3259. BEGIN
  3260. NEXTENTR:
  3261. WRITEW(SCR2$FET[J],TDAM[0],TDAMLEN,STAT);
  3262. AU = 1 + (TDAMFLN[0]-1)/PRUPAU;
  3263. IF HLR$SH[0]
  3264. THEN
  3265. BEGIN
  3266. SCR$AUS[SF] = SCR$AUS[SF] + AU;
  3267. END
  3268.  
  3269. ELSE
  3270. BEGIN
  3271. SCR$AUL[SF] = SCR$AUL[SF] + AU;
  3272. END
  3273.  
  3274. READW(SCR1$FET[J],TDAM[0],TDAMLEN,STAT);
  3275.  
  3276. IF STAT EQ 0
  3277. THEN
  3278. BEGIN
  3279. GOTO NEXTENTR;
  3280. END
  3281.  
  3282. ELSE
  3283. BEGIN
  3284. WRITER(SCR2$FET[J],RCL);
  3285. RENAME(SCR2$FET[J],SCRNMU[SF]);
  3286. CLEARBUF[J] = 0;
  3287. SCR$HLRQ[SF] = 0;
  3288. END
  3289. SLOWFOR I=1 STEP 1 UNTIL MAXSMUNIT
  3290. DO
  3291. BEGIN # SET *SM* FOR DESTAGE RECALL #
  3292. IF HLR$SM EQ SM$ID[I]
  3293. THEN
  3294. BEGIN
  3295. B<(SF)>SM$DSRFW0[I] = 1;
  3296. SCR$WTDRD[SF] = TRUE; # HOLD DESTAGE ON THIS SUBFAMILY #
  3297. GOTO SMFOUND;
  3298. END
  3299. END # END OF SET *DESTAGE* RECALL #
  3300.  
  3301. SMFOUND:
  3302. ACTION = ERRST"NXTSUBF";
  3303. HLR$ERRC[0] = 0;
  3304. HLR$UNLD[0] = HLR$FCTQ[0] NQ 0;
  3305. TEST LOOP;
  3306. END
  3307. #
  3308. ** PROCESS *NXTSUBF* CASE.
  3309. *
  3310. * - LOOK FOR NEXT SUBFAMILY WITH FILES TO BE DESTAGED.
  3311. * IF ONE IS FOUND, PREPARE TO PROCESS ITS FILES.
  3312. * IF NONE FOUND, TERMINATE DESTAGING.
  3313. #
  3314.  
  3315. IF ACTION EQ ERRST"NXTSUBF"
  3316. THEN # FIND NEXT SUBFAMILY TO BE
  3317.   DESTAGED #
  3318. BEGIN # NEXT SUBFAMILY CASE #
  3319. SLOWFOR I = 0 STEP 1 UNTIL MAXSF
  3320. DO
  3321. BEGIN # LOOK FOR NEXT SUBFAMILY #
  3322. IF NOT SCR$WTDRD[I] ##
  3323. AND (SCR$AUS[I] NQ 0 OR SCR$AUL[I] NQ 0)
  3324. AND (SCR$HLRQ[I] EQ 0)
  3325. THEN
  3326. BEGIN # PREPARE SCRATCH FILES #
  3327. SF = I;
  3328. SBI[SF] = "0" + I;
  3329. SCI[SF] = "0" + I;
  3330.  
  3331. SLOWFOR J = 0 STEP SCCBL WHILE J LS MAT$SPACE ##
  3332. [MAT$ENTRY"SCR$BUF"]
  3333. DO
  3334. BEGIN # FIND FREE SET OF SCRATCH BUFFERS #
  3335. IF CLEARBUF[J] EQ 0
  3336. THEN
  3337. BEGIN # SCRATCH FILES FREE #
  3338. HLR$SCROS1[0] = J;
  3339. K = J + SFETL + MAT$FWA[MAT$ENTRY"SCR$BUF"];
  3340. ZSETFET(LOC(SCR1$FET[J]),SCRNM[SF],K,MCFBUFL,SFETL);
  3341. ZSETFET(LOC(SCR2$FET[J]),SCRNMX[SF],K + MCFBUFL
  3342. + SFETL, MCFBUFL,RFETL);
  3343. REWIND(SCR1$FET[J],RCL);
  3344. REWIND(SCR2$FET[J],RCL);
  3345. READ(SCR1$FET[J],RCL);
  3346. HLR$VOLAUP[0] = SCR$AUS[I];
  3347. SCR$HLRQ[SF] = HLRQADR;
  3348. SCR$AUS[I] = 0;
  3349. SCR$AUL[I] = 0;
  3350. HLR$FFILE[0] = TRUE;
  3351.  
  3352. IF NOT GLBDSFL
  3353. THEN
  3354. BEGIN # DESTAGING CLOSED #
  3355. ACTION = ERRST"SMDSTAGEOFF"; # TO GIBDSFL CHECK #
  3356. END
  3357.  
  3358. ELSE
  3359. BEGIN # CHECK FIRST FILE #
  3360. ACTION = ERRST"NOERR"; # GET FIRST FILE #
  3361. END
  3362. TEST LOOP;
  3363. END # SCRATCH BUFFER #
  3364. END # FREE SCRATCH BUFFER #
  3365.  
  3366.  
  3367. END
  3368.  
  3369. END # LOOK FOR NEXT SUBFAMILY #
  3370.  
  3371.  
  3372.  
  3373. #
  3374. * CHECK IF ALL DESTAGES ARE COMPLETE.
  3375. #
  3376.  
  3377.  
  3378. SLOWFOR I = 0 STEP 1 UNTIL MAXSF
  3379. DO
  3380. BEGIN
  3381. IF SCR$HLRQ[I] NQ 0 OR SCR$WTDRD[I]
  3382. THEN
  3383. BEGIN # DESTAGES NOT COMPLETE #
  3384. TDAMFC[0] = TDAMFCODE"STAGE";
  3385. RETURN;
  3386. END
  3387. END
  3388. #
  3389. * IF NO SUBFAMILY WAS FOUND, TERMINATE DESTAGING.
  3390. #
  3391.  
  3392. TDAMFC[0] = TDAMFCODE"NOREQ";
  3393.  
  3394. WRITER(MCF$FET[0],RCL);
  3395.  
  3396. REWIND(MCF$FET[0],RCL);
  3397. RETERN(MCF$FET[0],RCL);
  3398.  
  3399. RETURN;
  3400. END # NEXT SUBFAMILY CASE #
  3401.  
  3402. END # MAIN LOOP #
  3403.  
  3404. END # DSNTDAM #
  3405.  
  3406. TERM
  3407. PROC DSSETUP(FAM,ERRSTAT);
  3408.  
  3409. # TITLE DSSETUP - DESTAGING INITIALIZATION PROCESSOR. #
  3410.  
  3411. BEGIN # DSSETUP #
  3412.  
  3413. #
  3414. ** DSSETUP - DESTAGING INITIALIZATION PROCESSOR.
  3415. *
  3416. * *DSSETUP* READS THE *MVOCOM* FILE CREATED BY *SSMOVE* AND WRITES
  3417. * ( UP TO 8 ) SCRATCH FILES ( ONE FOR EACH SUBFAMILY WITH FILES
  3418. * TO BE DESTAGED ). *DSSETUP* THEN CALLS *DSNTDAM* TO PREPARE
  3419. * THE *HLRQ* ENTRY FOR THE FIRST FILE TO BE DESTAGED.
  3420. * THE *MVOCOM* FILE IS ALSO INITIALIZED BY REWRITING
  3421. * THE PREAMBLE BACK TO IT.
  3422. *
  3423. * PROC DSSETUP(FAM,ERRSTAT)
  3424. *
  3425. * ENTRY *MOVCOM* FILE HAS BEEN GENERATED BY *SSMOVE*.
  3426. * (FAM) = FAMILY TO BE PROCESSED.
  3427. *
  3428. * EXIT SCRATCH FILES WRITTEN AND REWOUND FOR EACH AFFECTED
  3429. * SUBFAMILY. *HLRQ* ENTRY ESTABLISHED FOR FIRST FILE.
  3430. * (ERRSTAT) =0, IF NO PROBLEMS.
  3431. *
  3432. * MESSAGES * UNABLE TO READ MVOCOM, FM=FFFFFFF.*.
  3433. * * UNABLE TO WRITE SCRATCH, FM=FFFFFFF.*.
  3434. *
  3435. #
  3436.  
  3437. ITEM FAM C(7); # FAMILY NAME #
  3438. ITEM ERRSTAT U; # REPLY STATUS #
  3439.  
  3440. #
  3441. **** PROC DSSETUP - XREF LIST BEGIN.
  3442. #
  3443.  
  3444. XREF
  3445. BEGIN
  3446. PROC ABORT; # ABNORMAL TERMINATION #
  3447. PROC BLOWUP;
  3448. PROC BZFILL; # BLANK OR ZERO FILL ITEM #
  3449. PROC HLRQENQ; # *HLRQ* ENQUEUER #
  3450. PROC MESSAGE; # ISSUE MESSAGE #
  3451. PROC MSG; # ISSUE MESSAGE #
  3452. PROC PFD; # PERMANENT FILE REQUEST DELAYS #
  3453. PROC READ; # READ A FILE #
  3454. PROC READW; # READ DATA TO WORKING BUFFER #
  3455. PROC RETERN; # RETURN FILE #
  3456. PROC REWIND; # REWIND A FILE #
  3457. PROC RMVBLNK; # REMOVE EXCESS BLANKS #
  3458. PROC SETPFP; # SWITCH TO GIVEN SUBFAMILY #
  3459. PROC WRITER; # WRITE END OF RECORD #
  3460. PROC WRITEW; # WRITE DATA FROM WORKING BUFFER #
  3461. PROC ZSETFET; # INITIALIZES A FET #
  3462. END
  3463.  
  3464. #
  3465. **** PROC DSSETUP - XREF LIST END.
  3466. #
  3467.  
  3468. DEF LISTCON #0#; # DO NOT LIST COMMON DECKS #
  3469. *CALL,COMBFAS
  3470. *CALL,COMBBZF
  3471. *CALL,COMBFET
  3472. *CALL COMBMAT
  3473. *CALL,COMXCTF
  3474. *CALL,COMBPFP
  3475. *CALL,COMBPFS
  3476. *CALL,COMBTDM
  3477. *CALL,COMXMFD
  3478. *CALL,COMXMSC
  3479.  
  3480.  
  3481. ITEM AU U; # FILE SIZE IN AU #
  3482. ITEM I I; # LOOP COUNTER #
  3483. ITEM J I; # LOOP COUNTER #
  3484. ITEM K I; # BUFFER POINTER #
  3485. ITEM MCFCATM C(40) = " UNKNOWN FAMILY - XXXXXXX.;";
  3486. ITEM MCFUNPR C(40) = " UNABLE TO PROCESS MOVE REQUEST FILE.;"
  3487. ;
  3488. ITEM OPEN B; # CONTROL OPENING OF NEW SCRATCH
  3489.   FILE #
  3490. ITEM PREVSF U; # PREVIOUS SUBFAMILY #
  3491. ITEM PRUPAU U; # NUMBER OF PRU PER AU #
  3492. ITEM STAT I; # STATUS #
  3493. ITEM STATW I; # WRITE STATUS #
  3494. CONTROL EJECT;
  3495.  
  3496. #
  3497. * INITIALIZE SUBFAMILY SCRATCH FILE ENTRIES.
  3498. #
  3499.  
  3500. PRUPAU = INSPAU*PRUBLK;
  3501.  
  3502. SLOWFOR I = 0 STEP 1 UNTIL MAXSF
  3503. DO
  3504. BEGIN
  3505. SCR$AUS[I] = 0;
  3506. SCR$AUL[I] = 0;
  3507. END
  3508.  
  3509. #
  3510. * VERIFY *FAM* IS A KNOWN FAMILY.
  3511. #
  3512.  
  3513. OPEN = FALSE;
  3514. FOR I = 0 STEP 1 WHILE I LS FAMCNT AND NOT OPEN
  3515. DO
  3516. BEGIN
  3517. OPEN = MRFTFAM[I] EQ FAM;
  3518. END
  3519.  
  3520. IF NOT OPEN
  3521. THEN # UNKNOWN FAMILY #
  3522. BEGIN
  3523. ERRSTAT = 1;
  3524. BZFILL(FAM,TYPFILL"BFILL",7);
  3525. C<18,7>MCFCATM = FAM;
  3526. MSG(MCFCATM,UDFL1);
  3527. MSG(MCFUNPR,UDFL1);
  3528. RETURN;
  3529. END
  3530.  
  3531. #
  3532. * SWITCH TO SPECIFIED FAMILY.
  3533. #
  3534.  
  3535. PFP$WRD0[0] = 0;
  3536. PFP$FAM[0] = FAM;
  3537. PFP$UI[0] = DEF$UI;
  3538. PFP$FG1[0] = TRUE;
  3539. PFP$FG4[0] = TRUE;
  3540. SETPFP(PFP);
  3541.  
  3542. IF PFP$STAT[0] NQ 0
  3543. THEN
  3544. BEGIN
  3545. FE$RTN[0] = "DSSETUP";
  3546. MESSAGE(FEMSG,UDFL1);
  3547. ABORT;
  3548. END
  3549.  
  3550.  
  3551. #
  3552. * ATTACH *MVOCOM* FILE GENERATED BY *SSMOVE*.
  3553. #
  3554.  
  3555. PFD("ATTACH", MVOCOM,0,"M","W","RC",STAT,0);
  3556.  
  3557. IF STAT NQ OK
  3558. THEN
  3559. BEGIN
  3560. MOVMLINE[0] = MCFATTERR;
  3561. BZFILL(FAM,TYPFILL"BFILL",7);
  3562. MOVMFAM[0] = FAM;
  3563. RMVBLNK(MOVMSG[0],38);
  3564. MESSAGE(MOVMSG[0],UDFL1);
  3565. ERRSTAT = 1;
  3566. RETURN;
  3567. END
  3568.  
  3569. #
  3570. * READ *MVOCOM* FILE PREAMBLE.
  3571. #
  3572.  
  3573. J = LOC(MCF$FET[0]);
  3574. ZSETFET(J,MVOCOM,LOC(MCF$BUF[0]),MCFBUFL,SFETL);
  3575. FET$EP[0] = TRUE;
  3576.  
  3577. READ(MCF$FET[0],NRCL);
  3578. READW(MCF$FET[0],MCF$PRM[0],MVPRML,STAT);
  3579.  
  3580. IF STAT NQ OK
  3581. THEN
  3582. BEGIN
  3583. MOVMLINE[0] = MCFRDERR;
  3584. FAM = MRFTFAM[0];
  3585. BZFILL(FAM,TYPFILL"BFILL",7);
  3586. MOVMFAM[0] = FAM;
  3587. RMVBLNK(MOVMSG[0],38);
  3588. MESSAGE(MOVMSG[0],UDFL1);
  3589. RETERN(MCF$FET[0],RCL);
  3590. ERRSTAT = 1;
  3591. RETURN;
  3592. END
  3593.  
  3594.  
  3595. #
  3596. * SET UP SCRATCH FILE NAMES.
  3597. #
  3598.  
  3599.  
  3600. SLOWFOR I = 0 STEP 1 UNTIL MAXSF
  3601. DO
  3602. BEGIN # SET SCRATCH FILE NAMES #
  3603. NAMESCR[I] = "SCRATC";
  3604. SCRNMX[I] = "SCRBBB";
  3605. END
  3606.  
  3607.  
  3608. #
  3609. * COPY *MVOCOM* TO SCRATCH FILES.
  3610. #
  3611.  
  3612. P<FETSET> = LOC(MCF$FET[0]);
  3613. P<TDAM> = LOC(MCF$REQ[0]);
  3614. P<MVPREAM> = LOC(MCF$PRM[0]);
  3615. K = MAT$FWA[MAT$ENTRY"SCR$BUF"];
  3616. P<SCR1$FET> = K;
  3617. P<SCR2$FET> = K + SFETL + MCFBUFL + 1;
  3618. PREVSF = 8;
  3619.  
  3620. SLOWFOR I =0 STEP 1 WHILE STAT EQ 0
  3621. DO
  3622. BEGIN # TRANSFER TDAM ENTRIES FROM *MVOCOM* TO SCRATCH #
  3623. READW(MCF$FET[0],MCF$REQ[0],TDAMLEN,STAT);
  3624.  
  3625. IF STAT EQ CIOERR
  3626. THEN
  3627. BEGIN # TERMINATE PROCESSING *MVOCOM* FILE #
  3628. IF FET$AT[0] NQ OK
  3629. THEN
  3630. BEGIN # READ ERROR #
  3631. MOVMLINE[0] = MCFRDERR;
  3632. FAM = MRFTFAM[0];
  3633. BZFILL(FAM,TYPFILL"BFILL",7);
  3634. MOVMFAM[0] = FAM;
  3635. RMVBLNK(MOVMSG[0],38);
  3636. MESSAGE(MOVMSG[0],UDFL1);
  3637. END # READ ERROR #
  3638.  
  3639. RETERN(MCF$FET[0],RCL);
  3640. ERRSTAT = 1;
  3641. RETURN;
  3642. END # TERMINATE *MVOCOM* PROCESSING #
  3643.  
  3644. J = TDAMSBF[0];
  3645.  
  3646. #
  3647. * CLOSE OUT PREVIOUS SCRATCH FILE, IF APPROPRIATE.
  3648. #
  3649.  
  3650. IF (I NQ 0) # NOT 1ST PASS #
  3651. AND (J NQ PREVSF OR STAT NQ 0) # FOUND A NEW SUBFAMILY #
  3652. THEN # CLOSE OUT SCRATCH FILE FOR
  3653.   PREVIOUS SUBFAMILY #
  3654. BEGIN
  3655. OPEN = TRUE;
  3656. WRITER(SCR1$FET[0],RCL);
  3657. END
  3658.  
  3659. IF STAT NQ 0
  3660. THEN
  3661. BEGIN
  3662. TEST I;
  3663. END
  3664.  
  3665. #
  3666. * OPEN NEW SCRATCH FILE, IF APPROPRIATE.
  3667. #
  3668.  
  3669. IF (I EQ 0) OR (OPEN)
  3670. THEN
  3671. BEGIN
  3672. SBI[0] = "0" + J;
  3673. PREVSF = J;
  3674. ZSETFET(K,SCRNM[0],K+SFETL, ##
  3675. MCFBUFL,SFETL); ##
  3676. REWIND(SCR1$FET[0],RCL);
  3677. OPEN = FALSE;
  3678. END
  3679.  
  3680. AU = 1 + (TDAMFLN[0]-1)/PRUPAU;
  3681. IF TDAMFLN[0] LS MVPR$LB[0]
  3682. THEN
  3683. BEGIN
  3684. SCR$AUS[TDAMSBF[0]] = SCR$AUS[TDAMSBF[0]] + AU;
  3685. END
  3686.  
  3687. ELSE
  3688. BEGIN
  3689. SCR$AUL[TDAMSBF[0]] = SCR$AUL[TDAMSBF[0]] + AU;
  3690. END
  3691.  
  3692. WRITEW(SCR1$FET[0],MCF$REQ[0],TDAMLEN,STATW);
  3693. END # TRANSFER TDAM ENTRIES FROM *MVOCOM* TO SCRATCH #
  3694.  
  3695. #
  3696. * COMPLETE SETTING UP FOR DESTAGING OF FILES.
  3697. * - WRITE PREAMBLE BACK TO *MVOCOM* FILE.
  3698. * - COMPLETE INITIALIZATION.
  3699. #
  3700.  
  3701. REWIND(MCF$FET[0],RCL);
  3702. WRITEW(MCF$FET[0],MCF$PRM[0],MVPRML,STATW);
  3703. DSC$INIT = 1;
  3704. ERRSTAT = 0;
  3705. CLEARBUF[0] = 0;
  3706. DSC$FAM = FAM;
  3707. DSC$LKMSK = 0;
  3708. DSC$LKTYP = 0;
  3709. RETURN;
  3710.  
  3711. END # DSSETUP #
  3712.  
  3713. TERM
1) , 2) , 5)
HLRQADR
3) , 4)
HLRQADR),(ERRSTAT