ASMB,L,C,R
      HED RBUPD SUBROUTINE OF RDBA-IMAGE/1000 
      NAM RBUPD,7 92229-16220 REV.1912 790222 
* 
* 
******************************************************************* 
* (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-18220
*     RELOC:     92069-16220
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  This is the remote DBUPD handler.  It transforms the DBUPD parameters
*  into those needed for RDBA, then calls RBMST to build the request, and 
*  send it to the remote machine
* 
*  The calling sequence for RBUPD is: 
* 
*         JSB RBUPD 
*          DEF *+7         return point 
*          DEF BASE        data base parameter from DBUPD call
*          DEF SET         data set parameter from DBUPD call 
*          DEF MODE        mode from DBUPD call 
*          DEF STAT        status array from DBUPD call 
*          DEF LIST        item list from DBUPD call
*          DEF BUF         item values from DBUPD 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 RBUPD 
      EXT .ENTR,.MVW,AIRUN,DBRBP,RBCST,RBMST,RBPIL
* 
BASE  NOP 
SET   NOP 
MODE  NOP 
STAT  NOP 
LIST  NOP 
BUF   NOP 
* 
*  Get true address of parameters and return point. 
* 
RBUPD NOP 
      JSB .ENTR 
       DEF BASE 
* 
*  Make sure the data base was opened with a mode within [1,3].  Open 
*  mode is in low order byte of 14th word of DBCB.  Also, check that if 
*  the data base is open in mode 1 the data base is locked to the user. 
*  Lock flag is in high order byte of 14th word of DBCB.
* 
      LDB AIRUN 
      ADB RDMOD 
      LDA B,I 
      AND LOBYT 
      CPA D1        Mode = 1? 
      JMP RUPD1       Yes 
      CPA D3          No - mode = 3?
      JMP RUPD2         Yes 
      JMP E104           No -Invalid mode for Update. 
* 
RUPD1 LDA B,I       Open mode = 1,
      SSA,RSS         is data base locked?
      JMP E159        No - cannot do Update.
* 
*  Make sure the mode for DBUPD is 1. 
* 
RUPD2 LDA MODE,I
      CMA,INA 
      INA,SZA 
      JMP E115        No - illegal DBUPD mode.
* 
*  Ask RBCST to check the set reference for validity, and if valid, to
*  return us the set's number and set table entry address (relative to
*  beginning 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 given to us by the user in order to 
*  build an item number list in the data (record) buffer and return us the
*  combined length of the data items in the list. 
* 
      JSB RBPIL 
       DEF *+4
       DEF LIST,I   RBPIL needs: item list
       DEF STADR                 set's entry address
       DEF CM/MV        returns: combined data lengths
      JMP E101      Invalid item list return. 
* 
*  Move the item values given to us by the user into the record buffer
*  immediately following the item number list.
* 
      LDB DBRBP     B = address of record buffer
      ADB DBRBP,I     + length of item list 
      INB             + 1 (for length word) 
      LDA BUF 
* 
      JSB .MVW
       DEF CM/MV
       DEC 0
* 
*  Calculate the length of outgoing data in the record buffer = 
*  length of item list + 1 (for length word) + length of item values. 
* 
      LDA DBRBP,I 
      INA 
      ADA CM/MV 
      STA OUTDA 
* 
*  Ask RBMST to build the request, send it and wait for the reply.
* 
      JSB RBMST 
       DEF *+11 
       DEF D41      RBMST needs: RDBA Index 
       DEF MODE,I                DBUPD 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 D0                    incoming data buffer 
       DEF D0                    incoming data length 
      NOP             <error return>
RUPD3 JMP RBUPD,I     <normal return> 
* 
*  Error return points. 
* 
E100  LDB D100      Invalid set reference 
      RSS 
E101  LDB D101      Invalid item list.
      RSS 
E104  LDB D104      Invalid open mode for an Update.
      RSS 
E115  LDB D115      Invalid DBUPD mode. 
      RSS 
E159  LDB D159      Data base not locked with open mode 1.
* 
      STB STAT,I
      JMP RUPD3 
* 
*  Constants and variables. 
* 
D0    EQU ZERO
D1    EQU ZERO+1
D3    EQU ZERO+3
D7    EQU ZERO+7
D41   DEC 41
D100  DEC 100 
D101  DEC 101 
D104  DEC 104 
D115  DEC 115 
D159  DEC 159 
* 
LOBYT OCT 377 
* 
STNUM NOP 
STADR NOP 
CM/MV NOP 
OUTDA NOP 
      END 
                                                                                                                                                                                                