ASMB,L,C,R HED DBBAM IMAGE/1000 UTILITY SUBROUTINE NAM DBBAM,7 92069-16148 REV.2026 800122 * * ******************************************************************* * (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1979. ALL RIGHTS RESERVED. * NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, REPRODUCED, OR * TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITHOUT THE PRIOR WRITTEN * CONSENT OF HEWLETT-PACKARD COMPANY. ******************************************************************* * * * SOURCE: 92069-18148 * RELOC: 92069-16148 * * PRGMR: CEJ * ALTERED: JANUARY 22, 1980 FOR SORTED CHAINS FEATURE - CEJ * * ******************************************************************* * * * * Build Automatic Master is a utility subroutine for DBPUT. It pro- * vides the service of creating a new automatic master entry for a spe- * cified key value. The process for building an auto-master entry is * identical to that of building a manual master entry except for the * fact that the only item in the auto-master is the key item and its value * is passed to us by DBPUT rather than the user. It must be called * before any of the values passed back from DBHRD have been altered. * * DBBAM does alter the Free Record Table but does not post it after ad- * ding the new entry as DBPUT will if it successfully completes. * * The calling sequence for DBBAM is: * * JSB DBBAM * DEF *+6 return point * DEF BASE,I data base number from first word of * user supplied BASE parameter * DEF MNUM automatic master's data set number * DEF KVAL key item value * DEF READ READ flag from DBHRD * DEF RECRD doubleword record number from DBHRD * * Any error code encountered by DBBAM is returned in the A register. * SKP *********************************************************************** * * * Run Table for IMAGE/1000 Local machine. * * * * The Run Table is comprised of the following sections: * * * * 1) Data Base Control Block * * 2) Item Table * * 3) Data Set Control Block Table * * 4) Data Set Info Table * * A) Record Definition Table * * B) Path Table * * 5) Sort Table * * 6) Free Record Table * * * * These sections appear in the order described. Details of each * * section follow. * * * *********************************************************************** *** *** * * * Data Base Control Block - one 59 word entry per data base * * * *** *** DBCBS DEC 59 Control Block Size DBNAM DEC 0 Data Base name - 3 words DEC 1 DEC 2 DBSCD DEC 3 Data Base Security Code (FMP) DBCRN DEC 4 Data Base Cartridge Number (FMP) DBDSN DEC 5 Data Base node number (DS/1000) DBRSN DEC 6 Data Base resource number DBICT DEC 7 Data Item Count DBITP DEC 8 Data item table pointer DBSCT DEC 9 Data set count DBSTP DEC 10 Data set control block table pointer DBSOP DEC 11 Sort table pointer DBFRP DEC 12 Free record table pointer DBLMD DEC 13 Data Base lock flag and open mode DBLFG EQU DBLMD 1st byte: lock flag DBMOD EQU DBLMD 2nd byte: open mode DBLVL DEC 14 Access level words - 3 words per level DBFRL EQU DBLVL Free record table length DBOPT DEC 15 Optimal number of DCBs DBMAX DEC 16 Maximum size of a data entry DCBWS DEC 17 DCB storage area * ZERO EQU DBNAM base of zero for future equates *** *** * * * Data Item Table - one 7-word entry per item * * * *** *** ITELN EQU ZERO+7 item table entry length ITNME EQU ZERO item name - 3 words ITINF EQU ZERO+3 item write/read level and type ITRDL EQU ITINF 1st nibble: item read level ITWRL EQU ITINF 2nd nibble: item write level ITTYP EQU ITINF 2nd byte: item type ITSET EQU ZERO+4 set count and 1st set number ISSCT EQU ITSET 1st byte: set count ITSNO EQU ITSET 2nd byte: set number ITWRC EQU ZERO+5 write/read bits and element count ITECT EQU ITWRC 2nd byte: element count ITLNG EQU ZERO+6 item length in words *** *** * * * Data Set Control Block Table - one 17 word entry per set * * * *** *** DSLNG EQU ZERO+17 table entry length DSNME EQU ZERO set name - 3 words DSCRN EQU ZERO+3 cartridge reference number DSINF EQU ZERO+4 W/R bits, set type and media length DSTYP EQU DSINF 1st byte, 2nd nibble: set type DSMDL EQU DSINF 2nd byte: media record length DSDRL EQU ZERO+5 data record length DSFPC EQU ZERO+6 field and path counts DSFCT EQU DSFPC 1st byte: # fields per entry DSPCT EQU DSFPC 2nd byte: # paths per entry DSITP EQU ZERO+7 data set info table entry pointer DSCAP EQU ZERO+8 doubleword data set capacity DSCPN EQU ZERO+10 current path info DSCCT EQU DSCPN 1st byte: search item number DSPAN EQU DSCPN 2nd byte: path # of search item DSRCN EQU ZERO+11 doubleword current record number DSBWN EQU ZERO+13 doubleword previous record number DSFWN EQU ZERO+15 doubleword next record number *** *** * * * Data Set Info Table - one Record Definition Table and one Path * * Table per data set * * * *** *** * * * Record Definition Table - one 1-byte entry per field * * * *** *** RDLNG EQU ZERO+1 entry length (number of words) RDINF EQU ZERO field info (two fields per word) RDIT1 EQU RDINF 1st byte: item # for field n RDIT2 EQU RDINF 2nd byte: item # for field n+1 *** *** * * * Path Table - one 2-word entry per path * * * *** *** PTLNG EQU ZERO+2 entry length PTINF EQU ZERO path information - item & set numbers PTSIN EQU PTINF 1st byte: detail's search item # for path PTDSN EQU PTINF 2nd byte: related set's number PTSRT EQU ZERO+1 sort item for path *** *** * * * Sort Table - one 1-word entry per item and set * * * *** *** STITS EQU ZERO beginning of item entries STSTS NOP beginning of set entries *** *** * * * Free Record Table - one 4-word entry per set * * * *** *** FRLNG EQU ZERO+4 length of entry FRRCT EQU ZERO doubleword free record count FRPTR EQU ZERO+2 doubleword first free record * * *********************************************************************** *** *** * * A EQU 0 B EQU 1 * ENT DBBAM EXT .DDS,.ENTR,.MVW,AIRUN,DBDME,DBFDS,DBMST,DBRBL EXT DBRBP,DBRED,DBWRT * BASE NOP MNUM NOP KVAL NOP READ NOP RECRD NOP * * Get true parameter and return point addresses. * DBBAM NOP JSB .ENTR DEF BASE * * First thing we need to do is determine if the data set has a free re- * cord in which to create the new entry. If not, return error number * 106 to the caller. The free record count is the first doubleword of * the data set's FRT entry. FRT entry address = * (data set # - 1) * 4 + pointer to FRT from DBCB (12th word) + * address of Run Table. * CCA ADA MNUM,I ALS,ALS LDB AIRUN ADB DBFRP ADA B,I ADA AIRUN STA FRADR * DLD FRADR,I SZB,RSS SZA RSS JMP E106 * * We know (think) that a free record is there. Ask DBMST to get that * free record and build the new entry's blank (except entry type and * synonyn pointers) media record and zero out the data record. * JSB DBMST DEF *+5 DEF BASE,I DBMST needs everything DEF MNUM,I passed to us except DEF READ,I the key item value. DEF RECRD,I * SZA Did DBMST encounter an error? JMP BAM3 Yes - pass it to caller. * LDA RECRD,I No - did it get our new entry? SSA (i.e. is RECRD # >= 0?) JMP E160 No - but the R.T. says it's there! * * Now, get the DBCB for MNUM, then get its data record length (key item * length from the 6th word of the DSCB) and its media record length (from * the low order byte of the 5th word). * JSB DBFDS Ask DBFDS to get the DSCB for us. DEF *+5 DEF MNUM,I It needs: data set reference DEF TEMP1 returns: data set number DEF TEMP2 accessibility flag DEF MADR DSCB pointer * LDA TEMP1 Just a check for a SZA,RSS screwy Run Table. JMP E160 * LDB MADR Get DSCB true address. ADB AIRUN ADB DSDRL Bump to key item length. LDA B,I STA MVLEN * ADB M1 Back up to media record length LDA B,I AND LOBYT Get the length LDB A in B register. * * Determine the address of the data record in the record buffer by: * Data record address = media record length + address of record * buffer. * Then move the key item value into the data record. * ADB DBRBP LDA KVAL JSB .MVW DEF MVLEN DEC 0 * * Write the new record to disc. If any error pass it to caller. Else * decrement the auto-master free record count. * JSB DBWRT DEF *+4 DEF BASE,I DBWRT needs: data base # DEF MNUM,I data set # DEF RECRD,I record number * SZA Any error? JMP BAM3 Yes! * JSB .DDS DEF FRADR,I NOP * * Now, if the new entry is a synonym chain foot (entry type is first word * of the media record < 0) we need to update the old end of synonym chain * foot to point forward to this record. The old synonym chain foot's * record is in the 2nd & 3rd words of the new entry's media record. * LDA DBRBP,I SSA,RSS If it's not a synonym, CLA,RSS return successful to caller. RSS JMP BAM3 * LDB DBRBP INB Save off the old synonym DLD B,I chain foot. DST SYNYM * JSB DBRED Read in old synonym DEF *+4 chain foot DEF BASE,I DEF MNUM,I DEF SYNYM * SZA Any error? JMP BAM2 Yes - delete new entry. * LDA DBRBP No - set its forward synonym ADA D3 STA TEMP1 pointer to new record's #. DLD RECRD,I DST TEMP1,I * JSB DBWRT Then write it out to disc. DEF *+4 DEF BASE,I DEF MNUM,I DEF SYNYM * SZA Any error? JMP BAM2 Yes - remove new entry. * * Synonym update successful. Get the new entry back into the record * buffer for DBPUT. * JSB DBRED DEF *+4 DEF BASE,I DEF MNUM,I DEF RECRD,I * SZA,RSS JMP BAM3 * * On an error after the new record was written, this part deletes the * newly created auto-master entry by calling DBDME with the new record * number. We will ignore any more errors. * BAM2 STA TEMP1 Save error code. * CCA Let DBDME know it has to read entry. JSB DBDME DEF *+4 DEF BASE,I DEF MNUM,I DEF RECRD,I * LDA TEMP1 Return original error JMP BAM3 code to user. * * Other error returns. * E106 LDA D106 Master set full. RSS E160 LDA D160 Corrupt Run Table. * * Return to caller * BAM3 JMP DBBAM,I * * Constants and variables * M1 DEC -1 D3 EQU ZERO+3 D106 DEC 106 D160 DEC 160 LOBYT OCT 377 * FRADR NOP TEMP1 NOP TEMP2 NOP MADR NOP MVLEN NOP SYNYM BSS 2 END