Type ASSEMBLE
Source Lines : 642
Fixes Applied : 1
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [R09009DS]
Module
DMSSBD (DMSSBD - BASIC DIRECT ACCESS METHOD)
Function
THE CMS BDAM MACRO ROUTINE IS USED TO ACCESS DATA SET RECORDS DIRECTLY BY ITEM NUMBER. IT CONVERTS RECORD IDENTIFICATIONS GIVEN BY OS BDAM MACROS INTO ITEM NUMBERS AND USES THESE ITEM NUMBERS TO ACCESS RECORDS. THE CMS BDAM MACRO ROUTINE SUPPORTS ALL THE RELEASE 20 OS BDAM MACRO FUNCTIONS EXCEPT THOSE LISTED AS RESTRICTIONS.
Attributes
REENTRANT, NUCLEUS RESIDENT
Operation
FOR RELATIVE BLOCK, RELATIVE TRACK AND ACTUAL ADDRESSES, THE LOW ORDER TWO BYTES OF A RECORD IDENTIFICATION ARE USED FOR AN ITEM NUMBER. FOR RELATIVE TRACK ADDRESS AND ACTUAL KEY, THE LOW ORDER BYTE OF THE RELATIVE TRACK ADDRESS IS USED TO ACCESS A TABLE OF KEYS WHICH IF NOT ALREADY IN CORE IS BROUGHT IN AND SEARCHED FOR THE CORRECT KEY. CMS DOES NOT SUPPORT ACTUAL KEY I/O SO THE CMS BDAM ROUTINE SIMULATES IT. IN CMS, ALL KEYS ARE KEPT AT THE END OF THEIR DATA FILE. WHEN THE DATA FILES IS OPENED, EITHER THE KEYS ARE ACCESSED FROM THE END OF V0016 THE DATA FILE AS IN THE CASE OF A FIXED FILE OR A V0016 VARIABLE FILE THAT IS ONLY BEING READ OR TWO NEW V0016 FILES ARE CREATED WITH THE SAME V0016 FILETYPE, BUT WITH FILENAMES OF $KEYTEMP AND $KEYSAVE. BOTH THESE FILES CONTAIN ALL THE KEYS IN THE ORIGINAL DATA FILE. $KEYTEMP IS USED FOR UPDATING KEYS AND $KEYSAVE IS USED TO SAVE ALL THE KEYS IN CASE OF A RE-IPL OR SYSTEM CRASH. FOR EVERY ITEM IN THE ORIGINAL FILE THERE IS A CORRESPONDING KEY SPACE IN THE $KEYTEMP FILE. EACH ITEM IN THE $KEYTEMP FILE IS A KEY TABLE THAT CONTAINS 256 KEYS. WHEN THE DATA FILE IS CLOSED, THE $KEYTEMP FILE IS WRITTEN AT THE END OF THE DATA FILE, AND THE $KEYTEMP AND $KEYSAVE FILES ARE ERASED. THE CMS BDAM ROUTINE GETS CONTROL FROM THE CMS BSAM ROUTINE WHICH IN TURN GETS CONTROL FROM AN OS READ OR WRITE MACRO. UPON ENTRY TO DMSSBD, A CHECK IS MADE TO SEE IF DYNAMIC BUFFERING IS NEEDED. IF SO, A KEY BUFFER AND OR DATA BUFFER IS ACQUIRED OR RETURNED DEPENDING ON WHETHER A READ OR WRITE IS REQUESTED. NEXT THE RELATIVE OR ACTUAL ADDRESS IS CHECKED TO MAKE SURE IT DOES NOT EXCEED TWO BYTES. THIS ADDRESS IS CONVERTED INTO AN ITEM NUMBER AND, IF KEYS ARE NOT INVOLVED, THE FEEDBACK OPTION IS TAKEN CARE OF AND CONTROL IS PASSED BACK TO DMSSBS. IF KEYS ARE ACCESSED AND THE KEY TABLE CONTAINING THE KEY WANTED IS NOT IN CORE, IT IS BROUGHT IN AND SEARCHED OR UPDATED. IF A SEARCH IS SPECIFIED, THE ITEM NUMBER OF THE KEY TABLE CONTAINING THE KEY IS COMBINED WITH THE POSITION NUMBER OF THE KEY IN THE TABLE TO FORM THE ITEM NUMBER OF THE DATA. IF THE EXTENDED SEARCH OPTION IS NOT SPECIFIED, ONLY ONE KEY TABLE OF 256 KEYS IS SEARCHED. IF THE EXTENDED SEARCH OPTION IS SPECIFIED, THE LIMIT PARAMETER IN THE DCB IS CONVERTED TO A NUMBER OF KEY TABLES AND THAT NUMBER OF KEY TABLES IS SEARCHED FOR A MATCHING KEY. AFTER THE KEY TABLE HAS BEEN READ, UPDATED OR SEARCHED, THE ITEM NUMBER, IF FEEDBACK IS REQUESTED, IS STORED IN THE CORRECT FEEDBACK ADDRESS AND CONTROL IS RETURNED TO DMSSBS. CORE FOR THE KEY TABLE AND ITS CONTROL PARAMETERS IS ACQUIRED THE FIRST TIME A KEY IS ACCESSED. THE ADDRESS OF THIS CORE IS STORED IN THE FCB AND THE CORE IS NOT FREED UP UNTIL THE DATA SET IS CLOSED. THE FORMAT OF THE DISK KEY TABLE AND THE IN-CORE KEY TABLE AND CONTROL WORDS IS DESCRIBED BELOW. KEY TABLE | KEYLENGTH | ----------------- | LST KEY | N IS 256 ----------------- | 2ND KEY | ----------------- | | ----------------- | NTH KEY | ----------------- IN-CORE KEY TABLE AND CONTROL WORDS KEYTABL DSECT KEYLNGTH DS 1F KEY LENGTH ENDDATA DS 1F LAST DATA ITEM IN FILE KEYOP DS 2F COMMAND NAME KEYNAME DS 2F FILENAME OF KEY FILE KEYTYPE DS 2F FILETYPE OF KEY FILE KEYMODE DS 1H FILEMODE OF KEY FILE KEYTBLNO DS 1H ITEM NUMBER OF KEY TABLE KEYTBLAD DC A(KEYTABLE) ADDRESS OF KEY TABLE TBLLNGTH DS 1F BYTE SIZE OF KEY TABLE KEYFORM DC C'F' FORMAT OF KEY TABLE KEYCHNG DC X'00' BYTE TO SIGNIFY CHANGE IN KEY TBL KEYCOUT DC X'0001' NUMBER OF TABLES PER ITEM DS IF USED BY RDBUF FOR RESIDUAL COUNTS KEYTABLE DS 0F TABLE OF KEYS RESTRICTIONS THE FOUR METHODS OF ACCESSING BDAM RECORDS ARE: 1. RELATIVE BLOCK RRR -- 2. RELATIVE TRACK TTR -- 3. RELATIVE TRACK AND KEY TT KEY - - 4. ACTUAL ADDRESS MBBCCHHR -- THE RESTRICTIONS ON THESE METHODS ARE: . BDAM SPANNED RECORDS ARE NOT SUPPORTED IN CMS. . THE R AND RU OPTIONS OF READ AND WRITE (ADDED IN OS RELEASE 19) ARE NOT SUPPORTED. . SINCE CMS FILES ONLY HAVE A TWO-BYTE RECORD IDENTIFIER, ONLY THE BDAM IDENTIFIERS UNDERLINED ABOVE CAN BE USED TO REFERENCE RECORDS. . CMS BDAM FILES ARE ALWAYS CREATED WITH 255 RECORDS ON THE 1ST LOGICAL TRACK AND 256 RECORDS ON ALL OTHER LOGICAL TRACKS REGUARDLESS OF THE BLOCKSIZE. IF BDAM METHODS 2, 3 OR 4 ARE USED AND THE RECFM IS U OR V, THE BDAM USER MUST EITHER WRITE 255 RECORDS ON THE 1ST TRACK AND 256 RECORDS ON EVERY TRACK THEREAFTER OR HE MUST NOT UPDATE THE TRACK INDICATOR UNTIL A NO SPACE FOUND MESSAGE IS RETURNED ON A WRITE. FOR METHOD 3 (WRITE ADD), THIS IS WHEN NO MORE DUMMY RECORDS CAN BE FOUND ON A WRITE REQUEST. FOR METHODS 2 AND 4, THIS WILL NOT OCCUR, AND THE TRACK INDICATOR WILL ONLY BE UPDATED WHEN THE RECORD INDICATOR REACHES 256 AND OVERFLOWS INTO THE TRACK INDICATOR. . TWO FILES WITH KEYS AND THE SAME FILETYPE CANNOT BE OPEN AT THE SAME TIME. IF A PROGRAM THAT IS UPDATING KEYS DOES NOT CLOSE THE FILE IT IS UPDATING FOR SOME REASON, E.G., A SYSTEM CRASH OR A RE-IPL, THE ORIGINAL KEYS FOR A VARIABLE OR UNDEFINED DATA V0016 FILE WILL BE IN A TEMPORARY FILE V0016 WITH THE SAME FILETYPE AND A FILENAME OF $KEYSAVE. THE KEYS FOR A FIXED DATA FILE WILL BE V0016 INTACT AT THE END OF THE DATA FILE. TO FINISH THEV0016 UPDATE, RUN THE UPDATE PROGRAM AGAIN. V0016 . ONCE A FILE IS CREATED USING KEYS, THE FILE MUST NOT BE ADDED TO WITHOUT USING KEYS AND SPECIFYING THE ORIGINAL KEY LENGTH. . THE MINIMUM DCBLRECL FOR A CMS BDAM FILE WITH KEYV0016 IS 8 BYTES. V0016
Calls to Other Routines
DMSBRD, DMSFRE, DMSBWR, DMSFNS, DMSSVT