ASMB,L,C,R HED DBCIX IMAGE/1000 UTILITY SUBROUTINE NAM DBCIX,7 92069-16158 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-18158 * RELOC: 92069-16158 * * PRGMR: CEJ * ALTERED: JANUARY 22, 1980 FOR SORTED CHAINS FEATURE - CEJ * * ******************************************************************* * * * * Compute IndeX computes the index of a data item value within a data * set's data record. This index is relative to the beginning of the * data record. The index is computed by: * * Index = 0 + word length of all items in record previous to specified * data item. * * The calling sequence for DBCIX is: * * JSB DBCIX * DEF *+4 return point * DEF ITEM data item number * DEF DSADR address of data set' data set control block * table entry relative to start of Run Table * DEF INDEX returned data item's index, <0 if item * not in set's Record Definition Table * 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 ITSCT 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 * * *********************************************************************** *** *** * * EXT .ENTR,AIRUN,DBFDI ENT DBCIX A EQU 0 B EQU 1 * ITEM NOP DSADR NOP INDEX NOP * * Get true addresses of parameters and return points. * DBCIX NOP JSB .ENTR DEF ITEM * * Initialize computation parameters. * CLA STA TOTAL Set internal index to zero. CMA STA INDEX,I Set index to -1. * * Get number of items in data set's data record and true address of * data set's record definition table. * LDB DSADR,I Get true address of data set's entry. ADB AIRUN * ADB DSFCT Increment to field count LDA B,I # fields/entry is first byte ALF,ALF of this word. AND LOBYT CMA,INA Negate it and save for later. STA CONTR * INB Increment to info table pointer LDA B,I Calculate info table's address ADA AIRUN STA IFADR * * ENTER MAIN LOOP * Now, for each field (item) in the data set's entry, up until the spe- * cified item, add the field's word length to get the specified item's * index into the data record. * CIX1 CCA Set working with first byte flag. STA FIRST LDA IFADR,I Get first item in info table entry ALF,ALF in first byte of this word. AND LOBYT * CIX2 CPA ITEM,I If this is the specified item, JMP CIX4 we are done. STA ITMNO Else, save item number. * JSB DBFDI Call DBFDI to get data item's entry DEF *+5 address in item table DEF ITMNO DEF NUMBR DEF FLAG DEF DIADR * LDA NUMBR If item # returned = 0, SZA,RSS return to caller unsuccessful. JMP DBCIX,I (Run Table corrupt!!) * LDA DIADR Else, get true address of item ADA AIRUN table entry. ADA ITLNG Bump to length word. LDB A,I Get length from entry ADB TOTAL and add to TOTAL. STB TOTAL * ISZ CONTR Repeat above processing for RSS next item, if one JMP DBCIX,I ISZ FIRST this time item is in 2nd byte JMP CIX3 LDA IFADR,I of entry in info table. AND LOBYT JMP CIX2 * CIX3 ISZ IFADR After processing both items in word, JMP CIX1 bump to next word and continue processing. * * Come here when index completely computed (i.e. item found in record * definition table). * CIX4 LDA TOTAL Set returned index. STA INDEX,I JMP DBCIX,I and return. * * Constants and variables * LOBYT OCT 377 * FIRST NOP CONTR NOP IFADR NOP ITMNO NOP NUMBR NOP FLAG NOP TOTAL NOP DIADR NOP END