ASMB,L,C,R
      HED BAPS3 - REMOTE DATA BASE ACCESS PROGRAM SEGMENT 3 
      NAM BAPS3,5 92069-16259 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-18263
*     RELOC:     92069-16259
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
      COM DABUF(2174),RQBUF(21) 
      COM RECRQ,RECDA,SEGNM 
* 
*  Segment three of the Remote Data Base Access Program.  This segment
*  has the following sequence of operations.
* 
*  1)  Determine the tyep of IMAGE call and branch to the appropriate call
*      handler. 
* 
*      A)  DBPUT
* 
*          I )  Perform the DBPUT call. 
* 
*          II)  Go to 2.
* 
*      B)  DBDEL
* 
*          I )  Perform the DBDEL call. 
* 
*          II)  Go to 2.
* 
*  2)  Send the RDBA reply (no data). 
* 
*  3)  Return to class get in main. 
* 
      SKP 
**********************************************************************
***                                                                ***
*                  Standard DS/1000 equates                          *
***                                                                ***
#STR  EQU 0 
#SEQ  EQU 1 
#SRC  EQU 2 
#DST  EQU 3 
#RDB  EQU 4 
#EC1  EQU 4 
#EC2  EQU 5 
#ENO  EQU 6 
#REP  EQU 7 
***                                                                ***
**********************************************************************
**********************************************************************
*                                                                    *
*  DS/1000 RDBA Communications consist of two descriptive buffers:   *
*          1) Request buffer                                         *
*          2) Reply buffer                                           *
*  These two static buffers are as described below.                  *
*                                                                    *
**********************************************************************
***                                                                ***
*                                                                    *
*  Request buffer - one buffer of from 12 to 21 words per RDBA call  *
*                                                                    *
***                                                                ***
RBSTR EQU #STR      DS/1000 stream word 
RBSEQ EQU #SEQ      DS/1000 sequence number 
RBSRC EQU #SRC      DS/1000 source node number
RBDST EQU #DST      DS/1000 destination node number 
RBIDX EQU #RDB      RDBA call Index 
RBMOD EQU #RDB+1    RDBA call mode
RBID  EQU #RDB+2    RDBA call item or set number
*                                  or for a DBOPN, the level code word
RBITM EQU #RDB+3    Search item number for DBFND
RBMRT EQU #RDB+5    For DBOPN, the max. returned RT size
RBLEN EQU #RDB+6    Word size of ibase parameter
RBBAS EQU #RDB+7    Ibase parameter 
* 
MAXRQ DEC 21        Maximum request buffer length 
***                                                                ***
***                                                                ***
*                                                                    *
*  Reply buffer - one buffer of either 17 or 18 words per RDBA call  *
*                                                                    *
***                                                                  *
* RBSTR EQU #STR    DS 1000 stream word 
* RBSEQ EQU #SEQ    DS/1000 sequence number 
* RBSRC EQU #SRC    DS/1000 source node number
* RBDST EQU #DST    DS/1000 destination node number 
RBEC1 EQU #EC1      DS/1000 1st error code word 
RBEC2 EQU #EC2      DS/1000 2nd error code word 
RBEC3 EQU #ENO      DS/1000 error node number upon an error 
RBSTA EQU #REP      RDBA call status array
RBNUM EQU #REP+10   RDBA data base number for DBOPN 
* 
RPLEN DEC 17        Standard reply buffer length
*                                  18 for DBOPN 
***                                                                ***
**********************************************************************
      ENT BAPS3 
      EXT BP.GT,DBDEL,DBPUT 
      EXT RDEXT 
* 
A     EQU 0 
B     EQU 1 
DAADR DEF DABUF 
* 
*  Put our name suffix into SEGNM in common.  That way, if another request
*  comes though for this segment, RDBAP (the main) will not reload us.
* 
BAPS3 LDA SUFIX 
      STA SEGNM 
* 
*  Determine the type of IMAGE call being made by the index calculated
*  in the main and jump to the proper handling routine.  Remember that
*  this index is: 45 - (RDBA Index).
* 
      LDB RQBUF+RBIDX 
      ADB JMPTB 
      JMP B,I 
* 
JMPTB DEF *+1 
      JMP E159        RDBA Index within [45,44] 
      JMP E159          should not happen 
      JMP DEL       RDBA Index = 43, DBDEL
      JMP PUT       RDBA Index = 42, DBPUT
      JMP E159
      JMP E159
      JMP E159        RDBA Index within [41,36] 
      JMP E159          should not happen.
      JMP E159
      JMP E159
      SKP 
* 
*  A remote DBPUT.
*  The request buffer contains the following information: 
* 
PTMOD EQU RQBUF+RBMOD   Put mode
PTSET EQU RQBUF+RBID    Data set number 
PTBAS EQU RQBUF+RBBAS   Data base parameter 
* 
*  The status array is the 8th through 17th words of the reply buffer.
* 
PTSTA EQU RQBUF+RBSTA 
* 
*  The item list starts in the 2nd word of the data buffer. 
* 
PTLST EQU DABUF+1 
* 
*  The values for the items in the item list immediately follow the item
*  list in the data buffer.  The first word of the data buffer contains 
*  the length of the item list.  Therefore, the address of the value buf- 
*  fer is the address of the data buffer plus the length of the item list 
*  plus one.
* 
PUT   LDA DAADR 
      ADA DABUF 
      INA 
      STA PTBUF 
* 
*  Perform the DBPUT call.
* 
      JSB DBPUT 
       DEF *+7
       DEF PTBAS
       DEF PTSET
       DEF PTMOD
       DEF PTSTA
       DEF PTLST
       DEF PTBUF,I
* 
*  There is no return data, so set the length of returned data to zero, 
*  and jump to the exit routine.
* 
      CLB 
      JMP EXIT
* 
*  Constants and variables
* 
PTBUF NOP 
      SKP 
* 
*  A remote DBDEL.
*  The information in the request buffer is as follows: 
* 
DEMOD EQU RQBUF+RBMOD   Delete mode 
DESET EQU RQBUF+RBID    Data set number 
DEBAS EQU RQBUF+RBBAS   Data base parameter 
* 
*  The status array is the 8th through 17th words of the reply buffer.
* 
DESTA EQU RQBUF+RBSTA 
* 
*  There is no data associated with either the request or reply.
* 
*  Perform the DBDEL call.
* 
DEL   JSB DBDEL 
       DEF *+5
       DEF DEBAS
       DEF DESET
       DEF DEMOD
       DEF DESTA
* 
*  Set the returned data length to zero and jump to the exit routine. 
* 
      CLB 
      JMP EXIT
      SKP 
* 
*  The only DS error is when the RDBA index for this segment is in error. 
* 
E159  LDB M159
      CLA 
      STA RECDA     Set the data length to zero.
      JMP EXIT2 
* 
*  This is the exit routine for segment 3 of RDBAP.  Its purpose is to
*  call the necessary subroutines in order to send the RDBA reply to the
*  orginiating node and to terminate the program, saving resources.  All
*  DS replies are sent through RDEXT. 
* 
EXIT  STB RECDA     Set returned data length. 
      CLA 
      CLB           Set the error code to zero. 
EXIT2 DST ERROR 
* 
      JSB RDEXT     Then, let RDEXT send the reply. 
       DEF *+6
       DEF RQBUF    It needs: reply buffer
       DEF RPLEN              reply length
       DEF DABUF              data buffer 
       DEF RECDA              data length 
       DEF ERROR              error code
      NOP            <error return, ignore> 
* 
      JMP BP.GT     Return to class get in main.
* 
*  Constants and variables. 
* 
M159  DEC -159
* 
SUFIX ASC 1,3 
* 
ERROR BSS 2 
      END BAPS3 
                                                                                  