ASMB,L,C,R
      HED RBFND SUBROUTINE OF RDBA-IMAGE/1000 
      NAM RBFND,7 92069-16218 REV.1912 790130 
* 
* 
******************************************************************* 
* (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-18218
*     RELOC:     92069-16218
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  This is the remote DBFND call handler.  Its function is to transform 
*  the DBFND call into the remote request parameters, then send the re- 
*  quest to the remote machine through RBMST. 
* 
*  The calling sequence for RBFND is: 
* 
*         JSB RBFND 
*          DEF *+7         return point 
*          DEF BASE        data base parameter from DBFND call
*          DEF SET         data set parameter from DBFND call 
*          DEF MODE        mode from DBFND call 
*          DEF STAT        status array from DBFND call 
*          DEF ITEM        data item parameter from DBFND call
*          DEF ARG         key item value from DBFND call 
* 
**********************************************************************
*                                                                    *
*  Run Table for local machine in Remote Data Base Access            *
*                                                                    *
*  The local copy of the Run Table used by the RDBA master subrou-   *
*  tines consists of the following sections:                         *
*                                                                    *
*    1) Data Base Control Block                                      *
*    2) Data Item Table                                              *
*    3) Data Set Table                                               *
*    4) Sort Table                                                   *
*                                                                    *
*  These sections are in the order stated.  Details of each section  *
*  follow.                                                           *
*                                                                    *
**********************************************************************
***                                                                ***
*                                                                    *
*  Data Base Control Block - one 17 word entry per data base         *
*                                                                    *
***                                                                ***
RDCBS DEC 17        DBCB size 
* 
RDNAM DEC 0         data base name - three words
      DEC 1 
      DEC 2 
RDRBN DEC 3         remote data base number 
      DEC 4 
RDDSN DEC 5         DS node number
      DEC 6 
RDITC DEC 7         data item count 
RDITP DEC 8         data item table pointer 
RDDSC DEC 9         data set count
RDDSP DEC 10        data set table pointer
RDSOP DEC 11        sort table pointer
      DEC 12
RDLMD DEC 13        lock flag/open mode 
RDLFG EQU RDLMD     1st byte: lock flag 
RDMOD EQU RDLMD     2nd byte: open mode 
      DEC 14
RDCBC DEC 15        # of DCBs desired = 0 
RDMDL DEC 16        maximum data length 
* 
ZERO  EQU RDNAM     base of zero for future equates 
***                                                                ***
*                                                                    *
*  Data Item Table - one 5 word entry per item in a 1000 data base   *
*                                                                    *
***                                                                ***
RI1LN EQU ZERO+5    length of a 1000 entry
* 
RI1NM EQU ZERO      item name - 3 words 
RI1NO EQU ZERO+3    item number 
RI1IL EQU ZERO+4    item length 
***                                                                ***
*                                                                    *
*  Data Set Table - one 6 word entry per set in a 1000 data base     *
*                                                                    *
***                                                                ***
RS1LN EQU ZERO+6    length of a 1000 entry
* 
RS1NM EQU ZERO      set name - 3 words
RS1NO EQU ZERO+3    set number
RS1EL EQU ZERO+4    entry length (in words) 
RS1KL EQU ZERO+5    key item length for a master
***                                                                ***
*                                                                    *
*  Sort Table - one 1 word entry per item and per set.  Each entry   *
*               is a pointer to the respective item or set table     *
*               entry relative to the start of the Run Table         *
*                                                                    *
***                                                                ***
A     EQU 0 
B     EQU 1 
* 
      ENT RBFND 
      EXT .ENTR,AIRUN,RBCIT,RBCST,RBMST 
* 
BASE  NOP 
SET   NOP 
MODE  NOP 
STAT  NOP 
ITEM  NOP 
ARG   NOP 
* 
*  Get true parameter and return point addresses. 
* 
RBFND NOP 
      JSB .ENTR 
       DEF BASE 
* 
*  Ask RBCST to check the validity of the set reference and to return us
*  the set's number, if valid.
* 
      JSB RBCST 
       DEF *+4
       DEF SET,I    RBCST needs: set reference
       DEF STNUM        returns: set number 
       DEF STADR                 set's Set Table entry address
      JMP E100      Invalid set return. 
* 
*  Ask RBCIT to check the item reference and to return us the item's number 
*  and Item Table entry address (relative to beginning of Run Table) if 
*  valid. 
* 
      JSB RBCIT 
       DEF *+4
       DEF ITEM,I   RDCIT needs: item reference 
       DEF ITNUM        returns: item number
       DEF ITADR                 item's Item Table entry address
      JMP E101      Invalid item return.
* 
*  Get the item's length from the 5th word of the item's Item Table entry 
*  and store as the outgoing data length. 
* 
      LDA ITADR 
      ADA AIRUN 
      ADA RI1IL 
      LDA A,I 
      STA OUTDA 
* 
*  Check that the mode is valid (i.e. equal to 1).
* 
      LDA MODE,I
      CMA,INA 
      INA,SZA 
      JMP E115
* 
*  Ask RBMST to prepare the request, send it, and receive the reply for us. 
* 
      STA INDA      Incoming data length is zero. 
* 
      JSB RBMST 
       DEF *+11 
       DEF D39      RBMST needs: RDBA Index 
       DEF MODE,I                DBFND mode 
       DEF STNUM                 data set number
       DEF ITNUM                 data item number 
       DEF BASE,I                data base parameter
       DEF STAT,I                status array 
       DEF ARG,I                 outgoing data buffer 
       DEF OUTDA                 outgoing data length 
       DEF ARG,I                 incoming data buffer 
       DEF INDA                  incoming data length 
      NOP             <error return>
RFND1 JMP RBFND,I     <normal return> 
* 
*  Error return points
* 
E100  LDB D100      Invalid data set. 
      RSS 
E101  LDB D101      Invalid item. 
      RSS 
E115  LDB D115      Invalid mode
* 
      STB STAT,I
      JMP RFND1 
* 
*  Constants and variables. 
* 
D39   DEC 39
D100  DEC 100 
D101  DEC 101 
D115  DEC 115 
* 
STNUM NOP 
STADR NOP 
ITNUM NOP 
ITADR NOP 
* 
OUTDA NOP 
INDA  NOP 
      END 
                                                                                                                                                                                                        