ASMB,L,C,R
      HED RBPUT SUBROUTINE OF RDBA-IMAGE/1000 
      NAM RBPUT,7 92069-16221 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-18221
*     RELOC:     92069-16221
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  This is the remote DBPUT handler.  Its function is to transform the
*  DBPUT parameters into those needed for RDBA then to send the request 
*  to the remote machine through DBMST. 
* 
*  The calling sequence for RBPUT is: 
* 
*         JSB RBPUT 
*          DEF *+7           return point 
*          DEF BASE          data base parameter from DBPUT call
*          DEF SET           data set parameter from DBPUT call 
*          DEF MODE          mode from DBPUT call 
*          DEF STAT          status array from DBPUT call 
*          DEF LIST          item list from DBPUT call
*          DEF BUF           item values from DBPUT 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 RBPUT 
      EXT .ENTR,.MVW,AIRUN,DBRBP,RBCST,RBMST,RBPIL
* 
BASE  NOP 
SET   NOP 
MODE  NOP 
STAT  NOP 
LIST  NOP 
BUF   NOP 
* 
*  Get true parameter and return point addresses. 
* 
RBPUT NOP 
      JSB .ENTR 
       DEF BASE 
* 
*  Make sure the open mode is within [1,3] and if mode 1, that the data 
*  base is locked to the user.  Open mode is in the low order byte of 
*  the 14th word of the DBCB, lock flag is high order byte of same word.
* 
      LDB AIRUN 
      ADB RDMOD 
      LDA B,I 
      AND LOBYT 
* 
      CPA D1
      JMP RPUT1     Open mode = 1.
      CPA D3
      JMP RPUT2     Open mode = 3 
      JMP E104      Improper open mode for a Put. 
* 
RPUT1 LDA B,I       Is data base locked?
      SSA,RSS         (i.e. lock flag negative?)
      JMP E159        No - Data base not enabled. 
* 
*  Make sure the DBPUT mode is 1. 
* 
RPUT2 LDA MODE,I
      CMA,INA 
      INA,SZA 
      JMP E115      Invalid DBPUT mode. 
* 
*  Ask RBCST to check the validity of the set reference and, if valid, to 
*  return the set's number and Set Table entry address (relative to begin-
*  ning of Run Table).
* 
      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 RBPIL to process the item list the user gave us, building an item
*  number list in the data (record) buffer and to return to us the com- 
*  bined length of all the items in the list. 
* 
      JSB RBPIL 
       DEF *+4
       DEF LIST,I   RBPIL needs: item list
       DEF STADR                 set' entry address 
       DEF MVLEN        returns: combined item length 
      JMP E101      Invalid item list return
* 
*  Move the values for the items from BUF into the data buffer starting 
*  in the word which immediately follows the item number list in the data 
*  buffer.
* 
      LDB DBRBP     B = record buffer address 
      ADB DBRBP,I     + length of item list 
      INB             + 1 (for length word) 
* 
      LDA BUF 
      JSB .MVW
       DEF MVLEN
       DEC 0
* 
*  Calculate the length of the outgoing data = length of item number list 
*  + 1 (for length word) + length of item values. 
* 
      LDA DBRBP,I 
      INA 
      ADA MVLEN 
      STA OUTDA 
* 
*  Ask RBMST to build the request buffer, send the request, and await the 
*  reply. 
* 
      JSB RBMST 
       DEF *+11 
       DEF D42      RBMST needs: RDBA Index 
       DEF MODE,I                DBPUT mode 
       DEF STNUM                 data set number
       DEF D0                    dummy
       DEF BASE,I                data base parameter
       DEF STAT,I                status array 
       DEF DBRBP,I               outgoing data buffer 
       DEF OUTDA                 outgoing data length 
       DEF DBRBP,I               incoming data buffer 
       DEF D0                    incoming data length 
      NOP             <error return>
RPUT3 JMP RBPUT,I     <normal return> 
* 
*  Error return points. 
* 
E100  LDB D100      Invalid set reference.
      RSS 
E101  LDB D101      Invalid item list.
      RSS 
E104  LDB D104      Open mode not valid for a Put.
      RSS 
E115  LDB D115      Invalid DBPUT mode. 
      RSS 
E159  LDB D159      Data base not locked in mode 1. 
* 
      STB STAT,I
      JMP RPUT3 
* 
*  Constants and variables. 
* 
D0    EQU ZERO
D1    EQU ZERO+1
D3    EQU ZERO+3
D7    EQU ZERO+7
D42   DEC 42
D100  DEC 100 
D101  DEC 101 
D104  DEC 104 
D115  DEC 115 
D159  DEC 159 
* 
LOBYT OCT 377 
* 
STADR NOP 
STNUM NOP 
OUTDA NOP 
MVLEN NOP 
      END 
                                                                                                                                                                                                                        