ASMB,L,C,R
      HED RBGET SUBROUTINE OF RDBA-IMAGE/1000 
      NAM RBGET,7 92069-16219 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-18219
*     RELOC:     92069-16219
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  This is the remote DBGET handler.  Its function is to transform the
*  DBGET parameters into the RDBA request parameters and to send the re-
*  quest to the remote machine through RBMST. 
* 
*  The calling sequence for RBGET is: 
* 
*         JSB RBGET 
*          DEF *+8          return point
*          DEF BASE         data base parameter from DBGET call 
*          DEF SET          data set parameter from DBGET call
*          DEF MODE         mode parameter from DBGET call
*          DEF STAT         status array from DBGET call
*          DEF LIST         item list from DBGET call 
*          DEF BUF          item value buffer from DBGET call 
*          DEF ARG          ARG parameter from DBGET 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 RBGET 
      EXT .ENTR,.MVW,AIRUN,DBRBP,RBCST,RBMST,RBPIL
* 
BASE  NOP 
SET   NOP 
MODE  NOP 
STAT  NOP 
LIST  NOP 
BUF   NOP 
ARG   NOP 
* 
*  Get true parameter and return point addresses. 
* 
RBGET NOP 
      JSB .ENTR 
       DEF BASE 
* 
*  Make sure the Get mode is within [1..7]. 
* 
      LDA MODE,I
      SZA,RSS       Is mode > 0?
      JMP E115
      SSA 
      JMP E115        No - illegal mode 
* 
      CMA,INA       Is mode <= 7? 
      ADA D7
      SSA 
      JMP E115        No - illegal mode.
* 
*  Ask RBCST to check the validity of the data set and to return us the 
*  set's number and set table entry address (relative to beginning of the 
*  Run Table) if valid. 
* 
      JSB RBCST 
       DEF *+4
       DEF SET,I    RBCST needs: set reference
       DEF DSNUM        returns: set number 
       DEF DSADR                 set's Set Table entry address
      JMP E100      Invalid set return. 
* 
*  Ask RBPIL to process the item list the user gave us and to build an
*  item number list in the data (record) buffer.  It also returns the com-
*  bined length of the data items.
* 
      JSB RBPIL 
       DEF *+4
       DEF LIST,I   DBPIL needs: item list
       DEF DSADR                 set's Set Table entry address] 
       DEF INDA         returns: combined length of items 
      JMP E101      Illegal item list return
* 
*  Set the outgoing data length to the length of the item list + 1 (for 
*  the length word).
* 
      LDA DBRBP,I 
      INA 
      STA OUTDA 
* 
*  If this is a mode 4 Get, the IARG parameter contains a doubleword in-
*  teger which we have to move into the data buffer.  For a mode 7 or 8 
*  Get, IARG is a key item value which also must be moved.  Check for these 
*  cases. 
* 
      LDB MODE,I
      CPB D4
      JMP RGET1     Mode = 4
* 
      CPB D7
      RSS           Mode = 7
      JMP RGET3 
* 
*  Get the length of the key item value from the set's Set Table entry
*  6th word (for a 1000) or 11th word (for a 3000) and put it into the
*  MVLEN. 
* 
      LDB AIRUN 
      ADB DSADR 
      ADB RS1KL 
* 
      LDA B,I 
      STA MVLEN 
      JMP RGET2 
* 
*  For mode 4, set the move length to 2.
* 
RGET1 LDB D2
      STB MVLEN 
* 
*  Get the address in the data buffer into which ARG is to be moved.  This
*  is the address of the data buffer + the length of the item list (in
*  OUTDA).
* 
RGET2 LDB DBRBP 
      ADB OUTDA 
* 
*  Get the address of ARG and move its value into the data buffer.
* 
      LDA ARG 
      JSB .MVW
       DEF MVLEN
       DEC 0
* 
*  Add the length of ARG to the outgoing data length. 
* 
      LDA MVLEN 
      ADA OUTDA 
      STA OUTDA 
* 
*  Ask RBMST to build the request, sent it, and await the reply.
* 
RGET3 JSB RBMST 
       DEF *+11 
       DEF D40      RBMST needs: RDBA Index 
       DEF MODE,I                DBGET mode 
       DEF DSNUM                 data set number
       DEF INDA                  length of data expected. 
       DEF BASE,I                data base parameter
       DEF STAT,I                status array 
       DEF DBRBP,I               outgoing data buffer 
       DEF OUTDA                 outgoing data length 
       DEF BUF,I                 incoming data buffer 
       DEF INDA                  incoming data length 
      NOP             <error return>
RGET4 JMP RBGET,I 
* 
*  Error return points. 
* 
E100  LDB D100      Invalid data set
      RSS 
E101  LDB D101      Invalid item list.
      RSS 
E115  LDB D115      Illegal DBGET mode. 
* 
      STB STAT,I
      JMP RGET4 
* 
*  Constants and variables. 
* 
D2    EQU ZERO+2
D4    EQU ZERO+4
D7    EQU ZERO+7
D8    EQU ZERO+8
D40   DEC 40
D100  DEC 100 
D101  DEC 101 
D115  DEC 115 
* 
DSNUM NOP 
DSADR NOP 
MVLEN NOP 
* 
INDA  NOP 
OUTDA NOP 
      END 
          