VSR TITLE 'DMSVSR (CMS) VM/370 - RELEASE 6' 00001000 *. 00002000 * MODULE NAME - 00003000 * 00004000 * DMSVSR - ROUTINE TO RELEASE VSAM SYSTEM 00005000 * 00006000 * FUNCTION - 00007000 * 00008000 * TO CLEAN UP AND RELEASE CMS/VSAM 00009000 * 00010000 * COMMAND LINE FORMAT - 00011000 * 00012000 * GPR 1 POINTS TO ... 00013000 * 00014000 * PLIST DS 0F 00015000 * DC CL8'DMSVSR' 00016000 * DC X'FFFFFFFF' 00017000 * 00018000 * ATTRIBUTES - 00019000 * 00020000 * NUCLEUS RESIDENT, RE-ENTRANT 00021000 * 00022000 * ENTRY POINT - 00023000 * 00024000 * DMSVSR 00025000 * 00026000 * ENTRY CONDITIONS - 00027000 * 00028000 * GPR 1 POINTS TO DMSVSR COMMAND LINE (AS ABOVE). 00029000 * GPR 14 = RETURN REGISTER 00030000 * GPR 15 = ADDRESS OF DMSVSR 00031000 * 00032000 * EXIT CONDITIONS - 00033000 * 00034000 * NORMAL RETURN: 00035000 * GPR 14 = RETURN REGISTER 00036000 * GPR 15 = 0 00037000 * 00038000 * ERROR RETURN: 00039000 * GPR 14 = RETURN REGISTER 00040000 * GPR 15 = 1 (IF DOS MODE WAS NOT IN EFFECT 00041000 * OR RECURSIVE CALL TO DMSVSR) 00042000 * 00043000 * DATA CLEARED AS NEEDED IN NUCON, CMSCVT & BGCOM CONTROL BLOCKS 00044000 * 00045000 * CALLS TO OTHER ROUTINES - 00046000 * 00047000 * $$BACLOS - TO CLOSE ALL OPEN ACB'S 00048000 * 00049000 * EXTERNAL REFERENCES - 00050000 * 00051000 * DMSFREE - TO OBTAIN FREE STORAGE 00052000 * DMSFRET - TO RELEASE FREE STORAGE 00053000 EJECT 00054000 * TABLES / WORK AREAS - 00055000 * 00056000 * 'VSRWORK' AREA FOR MODULE RE-ENTRANCY 00057000 * 00058000 * REGISTER USAGE 00059000 * 00060000 * GPR 0 CONTAINS SIZE REQUEST FOR DMSFRET 00061000 * GPR 1 IS USED FOR SVC CALLS, DMSFRET 00062000 * GPR 2 THRU 7 ARE USED FOR WORK REGISTERS. 00063000 * GPR 8 = VSR WORK AREA FOR REENTRANCY 00064000 * GPR 11 = RETURN-REGISTER (R14) SAVED 00065000 * GPR 12 = ADDRESSABILITY 00066000 * GPR 13 = SAVE-AREA PROVIDED BY DMSITS (SVC-INTERRUPT HANDLER) 00067000 * GPR 14 = RETURN REGISTER 00068000 * GPR 15 = LINKING/WORK REGISTER 00069000 * 00070000 * GPR 9 - 10 ARE NOT USED. 00071000 * 00072000 * NOTES - 00073000 * 00074000 * DMSVSR IS CALLED WHEN NECESSARY TO CLOSE ANY VSAM FILES WHICH 00075000 * MAY BE OPEN, AND TO "RESET" CMS/VSAM. 00076000 * 00077000 * OPERATION - 00078000 * 00079000 * 1. IF DOS MODE NOT IN EFFECT OR RECURSIVE CALL OR PPEND=0, 00080000 * EXITS IMMEDIATELY WITH A RETURN CODE OF 1. 00081000 * 00082000 * 2. CALL VSAM AUTOMATIC CLOSE ($$BACLOS) TO CLEANUP ANY 00083000 * OPEN ACB'S. 00084000 * 00085000 * 3. CLEARS 'PPEND' (ADDRESS OF ANCHOR-TABLE) IN BGCOM. 00086000 * 00087000 * 4. CLEAR THE VSAM RESOURCE TABLE IN NUCON. 00088000 * 00089000 * 5. IF A VSAM SAVED SYSTEM IS PRESENT, IT IS PURGED. 00090000 * 00091000 * 6. IF THE OS VSAM INTERFACE (DMSVIP) HAS BEEN INITIALIZED, 00092000 * PREVIOUSLY ALLOCATED FREE STORAGE AREAS ARE RELEASED, 00093000 * THE ADDRESS OF THE INTERFACE BOOTSRAP (DMSVIB) IS RESTORED 00094000 * TO THE CVT CELL AND THE DOS ENVIRONMENT IS SET OFF. 00095000 * 00096000 * 7. RETURNS TO FREE STORAGE LIST OF ACB(S) CREATED BY DMSVIP, 00097000 * IF IT WAS NOT RELEASED BY DMSVIP. 00098000 * 00099000 * 8. RETURNS TO CALLER. 00100000 * 00101000 * RESPONSES - 00102000 * 00103000 * NONE 00104000 * 00105000 * ERROR MESSAGES - 00106000 * 00107000 * NONE 00108000 *. 00109000 EJECT 00110000 DMSVSR CSECT , TRANSIENT (OR MAY BE IN CMS NUC) @V305106 00111000 USING NUCON,R0 @V305106 00112000 USING DMSVSR,R12 @V305106 00113000 LR R12,R15 ADDRESSABILITY IN R11 @V305106 00114000 TM DOSFLAGS,DOSMODE ARE WE IN 'DOS MODE' ? @V305106 00115000 BZ ERROR1 IF NOT, THERE'S NOTHING WE CAN DO@V305106 00116000 SR R2,R2 @V305106 00117000 C R2,AVSRWORK IS THIS A RECURSIVE CALL? @V305106 00118000 BNZ ERROR1 YES, A DEFINITE NO-NO... @V305106 00119000 L R3,ABGCOM REFRENCE BGCOM @V305106 00120000 USING BGCOM,R3 ADDRESS TEMPORARILY @V305106 00121000 C R2,PPEND IS PPEND ZERO ? @V305106 00122000 BE ERROR1 IF ZERO, JUST EXIT WITH R.C. = 1 @V305106 00123000 DROP R3 @V305106 00124000 SPACE 1 00125000 LR R2,R14 HOLD R14 FOR A MINUTE... @V305106 00126000 LA R0,FREESIZ PREPARE TO GET FREE STOR WORKAREA@V305106 00127000 DMSFREE DWORDS=(0),TYPCALL=BALR MAKES ME REENTRANT @V305106 00128000 LR R8,R1 USE R8 FOR STORAGE MAP @V305106 00129000 STCM R8,7,AVSRWORK+1 SAVE THE WORK ADDR IN NUCON @V305106 00130000 XC 0(FREESIZ*8,R8),0(R8) AND CLEAR IT OUT... @V305106 00131000 USING VSRWORK,R8 @V305106 00132000 ST R2,SAVE14 SAVE R14 = RETURN REGISTER @V305106 00133000 SPACE 1 00134000 OI DOSFLAGS,DOSSVC WON'T GET TOO FAR WITHOUT IT.. @V305106 00135000 LA R1,AUTOCLOS PREP TO FETCH VSAM 'AUTOCLOSE' @V305106 00136000 STM R0,R13,REGSAV SAVE OUR IDENTITY @V305106 00137000 SVC SVC2 FETCH $$BACLOS @V305066 00138000 B EXIT AND EXIT UPON RETURN @V305106 00139000 SPACE 1 00140000 $$BEOJ4 DS 0D ACT LIKE DOS EOJ ROUTINE @V305106 00141000 ENTRY $$BEOJ4 @V305106 00142000 DC CL8'$$BEOJ4' @V305106 00143000 L R8,AVSRWORK RESTORE WORK ADDRESSBILITY @V305106 00144000 LM R0,R13,REGSAV RESTORE OUR IDENTITY @V305106 00145000 SPACE 1 00146000 VSR2ND EQU * GET RID OF ANCHOR TABLE @V305106 00147000 SR R15,R15 CLEAR R15, @V305106 00148000 L R2,ABGCOM REFERENCE BGCOM @V305106 00149000 USING BGCOM,R2 ... @V305106 00150000 ST R15,PPEND CLEAR 'PPEND' @V305106 00151000 LH R3,PIB2PTR GET ADDR OF PIB EXT @V305174 00152000 AH R3,PIK GET PIB OF TASK @V305174 00153000 NI ACFLDSP(R3),255-AUTCLFL TURN OFF AUTO CLOSE IN @V305174 00154000 * PROGRESS FLAG IF ON 00155000 DROP R2 THAT'S ALL THERE IS TO IT. @V305106 00156000 SPACE 1 00157000 VSR3RD EQU * CLEAR THE VSAM RESOURCE TABLE @V305106 00158000 SR R1,R1 CLEAR R1 FOR MVCL @V305106 00159000 L R2,ARURTBL ADDRESS OF RESOURCE TABLE @V305106 00160000 LA R3,RURLENG LENGTH IN BYTES @V305106 00161000 MVCL R2,R0 CLEAR ENTIRE TABLE (R0 IMMATL) @V305106 00162000 SPACE 00163000 VSR4TH EQU * PURGE VSAM SHARED SEG(S) - IF ANY@V305106 00164000 TM VSAMFLG1,VSAMRUN IS VSAM RUNNING ? @V305106 00165000 BZ VSR5TH IF NOT, AVOID NEEDLESS CALLS. @V305106 00166000 L R6,ASYSNAMS GET A(SAVED SYS TABLE) @V305106 00167000 USING SYSNAMES,R6 AND MAP IT... @V305106 00168000 LA R1,CMSVSAM POINT TO SAVED VSAM NAME @V305106 00169000 LA R2,PURGESYS R2=8 TO PURGE THE CMSVSAM SYSTEM @V305066 00170000 DC X'83120064' PURGE THE SHARED SYSTEM @V305106 00171000 SR R1,R1 AND @V305106 00172000 ST R1,AVSAMSYS CLEAR VSAMSYS ADDRESS (IN NUCON) @V305106 00173000 NI VSAMFLG1,255-VSAMRUN CLEAR THE VSAM-RUN FLAGBIT @V305106 00174000 L R0,=A(X'FFFFFF') 00FFFFFF INTO R0, @V305106 00175000 SR R1,R1 CLEAR R1, AND RESET @V305106 00176000 STM R0,R1,ADIKQLAB ADIKQLAB/NDIKQLAB=DEFAULT VALUES@V305106 00177000 EJECT 00178000 VSR5TH EQU * DETERMINE WHO CLEANING UP AFTER @V305106 00179000 TM VSAMFLG1,VSAMSERV AMS STILL LOADED? @V305106 00180000 BZ VSR6TH NO, CONTINUE.. @V305106 00181000 L R6,ASYSNAMS POINT TO SAVED SYSTEM TABLE @V305106 00182000 USING SYSNAMES,R6 @V305106 00183000 LA R3,CMSAMS GET NAME OF AMS SYSTEM @V305106 00184000 LA R4,PURGESYS SET THE PURGE CODE @V305066 00185000 DC X'83340064' PURGE SAVED AMS SYSTEM @V305106 00186000 SR R3,R3 AND... @V305106 00187000 ST R3,AAMSSYS CLEAR AMS ADDRESS IN NUCON @V305106 00188000 NI VSAMFLG1,255-VSAMSERV & CLEAR 'AMS ACTIVE' FLAG @V305106 00189000 VSR6TH EQU * @V305106 00190000 ICM R1,15,ACBLIST GET POSSIBLE LIST OF ACB(S) .. @V305106 00191000 BZ VSR7TH IF NOT CREATED BY DMSVIP, BRANCH @V305106 00192000 LR R0,R1 EQUALIZE REGISTERS @V305106 00193000 SRL R0,24 ISOLATE LGTH OF LIST (NO. DWORDS)@V305106 00194000 XC ACBLIST,ACBLIST ZERO OUT LIST ADDRESS @V305106 00195000 DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR REL FREED LIST@V305106 00196000 VSR7TH EQU * @V305106 00197000 TM VSAMFLG1,VIPINIT OS VSAM USER (INTERFACE INIT)? @V305106 00198000 BZ SVC11 IF NOT, SKIP ALL OVERHEAD... @V305106 00199000 L R5,AVIPWORK GET ADDR OF INTFC WORK AREA @V305106 00200000 L R6,VIPOVFL(,R5) LOAD POSSIBLE OVERFLOW BLK ADDR @V305106 00201000 LTR R6,R6 ANY? @V305106 00202000 BZ FRETWORK NO, GO RELEASE WORK AREA STORAGE @V305106 00203000 OCHAIN L R7,OVFLNEXT(,R6) LOAD ADDR OF NEXT BLOCK, IF ANY@V305106 00204000 LR R1,R6 PRIME LOC REG FOR DMSFRET @V305106 00205000 LA R0,NINE NINE DOUBLEWORDS OF STORAGE @V305106 00206000 DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR REL FREED STOR@V305106 00207000 LTR R7,R7 WAS THIS LAST ON CHAIN? @V305106 00208000 BZ FRETWORK YES @V305106 00209000 LR R6,R7 NO, CONTINUE @V305106 00210000 B OCHAIN RELEASING OVERFLOW BLOCKS @V305106 00211000 FRETWORK LR R1,R5 PRIME LOC REG FOR DMSFRET @V305106 00212000 LA R0,CON37 37 DOUBLEWORDS @V305066 00213000 DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR REL DMSVIP WK@V305106 00214000 XC AVIPWORK(4),AVIPWORK ZERO WORK AREA POINTER @V305106 00215000 NI VSAMFLG1,255-VIPINIT ALSO THE VIPINIT FLAGBIT @V305106 00216000 L R3,ADMSVIB ADDR OF INTFC BOOTSTRAP INTO WORK@V305106 00217000 L R4,ACMSCVT ADDRESS SIMULATED CVT @V305106 00218000 USING CMSCVT,R4 @V305106 00219000 ST R3,CVTAVIB RESTORE BOOTSTRAP ADDRESS IN CVT @V305106 00220000 DROP R4 @V305106 00221000 SPACE 1 00222000 DOSOFF NI VSAMFLG1,255-VSAMSOS CLEAR OS AMSERV FLAG @VM03001 00223000 LA R1,DOSLIST POINT TO DMSSET PLIST @V305106 00224000 SVC 202 SET DOS OFF @V305106 00225000 DC AL4(*+4) ... @V305106 00226000 EJECT 00227000 EXIT L R2,SAVE14 FINALLY, RESTORE RETURN-REGISTER @V305106 00228000 LR R1,R8 POINT AT FREE STOR AREA @V305106 00229000 LA R0,FREESIZ AND NO. DWORDS FOR LENGTH @V305106 00230000 DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR FREE 'VSRWORK'@V305106 00231000 SR R15,R15 CLEAR RETURN-CODE @V305106 00232000 ST R15,AVSRWORK CLEAR A(WORKAREA) FOR RECUR CK @V305106 00233000 BR R2 AND EXIT. @V305106 00234000 SPACE 00235000 ERROR1 TM VSAMFLG1,VSAMSOS IS IT OS AMSERV USER ? @VM03082 00236000 BZ ERREXIT NO, JUST EXIT @VM03082 00237000 NI VSAMFLG1,255-VSAMSOS CLEAR OS AMSERV FLAG @VM03082 00238000 LA R1,DOSLIST POINT TO DMSSET PLIST @VM03082 00239000 SVC 202 GO SET DOS OFF @VM03082 00240000 DC AL4(*+4) ... @VM03082 00241000 ERREXIT LA R15,ERR1 SET RETURN CODE OF 1 @VM03082 00242000 BR R14 EXIT FORTHWITH (R14 INTACT) @V305106 00243000 SVC11 TM VSAMFLG1,VSAMSOS IS IT OS AMSERV USER ? @VM03001 00244000 BO DOSOFF YES, GO SET DOS OFF THEN... @VM03001 00245000 SVC 11 ELSE RETURN AFTER SVC 2 ABOVE @VM03001 00246000 EJECT 00247000 * PLEASE PLACE ALL FIELDS WHICH ARE MODIFIED HERE... 00248000 * AND LET'S KEEP DMSVSR RE-ENTRANT. INSERT ANYWHERE WITHIN 00249000 * 'VSRWORK' DSECT AFTER 'SAVE14' FIELD. THANK YOU 00250000 SPACE 1 00251000 VSRWORK DSECT @V305106 00252000 DS 0D @V305106 00253000 REGSAV DS 14F DMSVSR REGISTER SAVE AREA @V305106 00254000 SAVE14 DS F @V305106 00255000 DS 0D @V305106 00256000 FREESIZ EQU (*-VSRWORK)/8 @V305106 00257000 SPACE 2 00258000 DMSVSR CSECT @V305106 00259000 DS 0D KEEP ALL STATIC FIELDS HERE. @V305106 00260000 AUTOCLOS DC CL8'$$BACLOS' VSAM AUTOMATIC CLOSE ROUTINE @V305106 00261000 DOSLIST DC CL8'SET' SET DOS OFF FOR OS USERS @V305106 00262000 DC CL8'DOS' @V305106 00263000 DC CL8'OFF' @V305106 00264000 DC 8X'FF' @V305106 00265000 SPACE 00266000 RURLENG EQU 32*4 LENGTH OF VSAM RESOURCE TABLE @V305106 00267000 VIPOVFL EQU 228 @V305106 00268000 OVFLNEXT EQU 64 @V305106 00269000 ACFLDSP EQU 15 DISP OF AUTO CLOSE FLG IN PIB @V305174 00270000 AUTCLFL EQU X'10' AUTO CLOSE IN PROGRESS FLAG @V305174 00271000 SVC2 EQU 2 SVC 2 @V305066 00272000 CON37 EQU 37 @V305066 00273000 PURGESYS EQU 8 PURGESYS CODE @V305066 00274000 NINE EQU 9 NINE @V305066 00275000 ERR1 EQU 1 ERROR CODE 1 @V305066 00276000 ELEVEN EQU 11 SVC 11 @V305066 00277000 LTORG OTHER CONSTANTS @V305106 00278000 EJECT 00279000 NUCON @V305106 00280000 BGCOM @V305106 00281000 EJECT 00282000 CMSCVT @V305106 00283000 SYSNAMES @V305106 00284000 SPACE 00285000 PRINT NOGEN CERTAINLY DON'T NEED EXPANSION OF ... 00286000 REGEQU @V305106 00287000 SPACE 00288000 END 00289000