ASMB,L,C,R HED DBFCB IMAGE/1000 UTILITY SUBROUTINE NAM DBFCB,7 92069-16162 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-18162 * RELOC: 92069-16162 * * PRGMR: CEJ * ALTERED: JANUARY 22, 1980 FOR SORTED CHAINS FEATURE - CEJ * * ******************************************************************* * * * * Find dCB is a subroutine which sets up a data set DCB for an FMP call. * * DBFCB does a serial search on the DCB pointer table comparing the com- * bination data base/data set number passed to it by the caller to that * which is currently associated with the DCBs. If a match is found, the * address fo the DCB which matches is passed back to the caller. In the * process of the search, DBFCB also saves the address of the first DCB * it found which is unused and the first which is assigned to another * data base. If no match is found, then if an unused DCB was found, the * data set specified by the number passed to DBFCB is opened in the DCB * and the DCB assigned to it. If no unused DCB was found, but a DCB * assigned to another data base was, DBFCB closes the data set in the * DCB and opens the desired data set in it. If no DCB was found which * was assigned to another data base, DBFCB takes the last DCB in the * table, closes it and reuses the DCB for the desired data set. DBFCB * then returns the assigned DCB's address to the caller. * * Should an FMP error occur while DBFCB was attempting to assign an DCB * to a data set, DBFCB halts execution and returns the FMP error code * to the caller. * * The calling sequence for DBFCB is: * * JSB DBFCB * DEF *+4 return point * DEF BASE data base number * DEF SET data set number * DEF DCBAD returned DCB address * * Any FMP error code DBFCB encounters 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 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,DBDCP,DBDMX,DBDSZ,OPEN ENT DBFCB A EQU 0 B EQU 1 * BASE NOP SET NOP DCBAD NOP * * Get true adress of parameters and return point * DBFCB NOP JSB .ENTR DEF BASE * * Initialize search parameters. * CLA STA UNUSD Zero unused and non-base DCB address STA NBASE save areas. * LDA BASE,I Put data base number in high ALF,ALF order byte of BASE. STA BASE * LDA DBDMX Loop counter = negative number of CMA,INA STA CONTR entries in DCB pointer table. LDA DBDCP Get DCB pointer table address STA NEXT * LDA BASE Set up the combination IOR SET,I base/set number. STA NUMBR * * BEGIN SEARCH * The first word of each two word entry in the DCB pointer table defines * which data base/data set combination the DCB currently belongs to. * Search each entry in the table for a match to the combination base/set * passed by the caller in NUMBR, saving the address of the first unused * DCB and the first DCB assigned to a data base other than the current * one. * FCB1 LDA NEXT,I Get base/set number from DCB pointer SZA,RSS table entry, if zero - there is no JMP FCB3 DCB pointer in this entry. * CPA NUMBR Compare number to the one given. JMP FCB6 Same - DCB found. * INA,SZA Different - if this entry first empty JMP FCB2 entry (-1 in number) found, LDB UNUSD save its address in UNUSD. SZB JMP FCB3 LDB NEXT STB UNUSD JMP FCB3 * FCB2 AND HIBYT Or if this entry first assigned CPA BASE to a different data base, RSS save its address in NBASE. JMP FCB21 * LDA NEXT Else save address as last STA LAST DCB for this base in table. JMP FCB3 * FCB21 LDB NBASE SZB JMP FCB3 LDB NEXT STB NBASE * FCB3 ISZ NEXT Continue on with search until ISZ NEXT a match is found or the ISZ CONTR end of the table is found. JMP FCB1 * * We fall through search to this point if no match occurred. Set up a * DCB for the desired data set in either 1) the first unused DCB, 2) the * first DCB assigned to a different data base, or 3) the last DCB (in * that order). * LDA UNUSD If an unused entry - SZA,RSS use it else, * LDA NBASE If a DCB assigned to a different data base, SZA,RSS use it, * LDA LAST else, use the last allocated DCB. STA NEXT * * Now that we have the DCB, let's open the data set in it. First we * have to get the data set information from the Run Table. * CCA Get true address of data set's ADA SET,I control block = CLB (data set # - 1 ) * DSLNG + MPY DSLNG LDB AIRUN address of data set control block table + ADB DBSTP ADA B,I ADA AIRUN address of Run Table. * * Set up FMP OPEN call * STA OPNAM Put address of name into call. ADA DSCRN Put address of CRN into call. STA OPCRN LDB AIRUN Put negative security code into call. ADB DBSCD STB OPSCD LDA NEXT Finally, put DCB address into call. INA LDA A,I STA OPDCB * * Perform FMP OPEN call * JSB OPEN DEF *+8 OPDCB ABS *-* DEF ERROR OPNAM ABS *-* DEF D3 Open file in update, non-exclusive mode. OPSCD ABS *-* OPCRN ABS *-* DEF DBDSZ * SSA,RSS If any error, JMP FCB5 CCB set DCB to unused STB NEXT,I JMP FCB7 and return unsuccessful to caller. * FCB5 LDA NUMBR else put base/set number into STA NEXT,I DCB entry in pointer table. * * We rejoin processing with found DCB. Set up the return parameters * and return. * FCB6 ISZ NEXT Put DCB address in return parameter DCBAD. LDB NEXT,I STB DCBAD,I CLA Zero to error code. FCB7 JMP DBFCB,I Return. * * Constants and variables. * D3 EQU ZERO+3 HIBYT OCT 177400 * UNUSD NOP NBASE NOP NEXT NOP LAST NOP ERROR EQU LAST * NUMBR NOP CONTR NOP END