ASMB,L,C,R
      HED DBIDS UTILITY SUBROUTINE FOR RDBA-IMAGE/1000
      NAM DBIDS,7 92069-16229 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-18229
*     RELOC:     92069-16229
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  If DS is a utility subroutine for the RDBA-DBMS subroutines which ac-
*  cepts the BASE parameter from the DBMS call and determines if the data 
*  base is on a remote machine.  If the data base is local, it returns
*  at P+2.  If remote at P+3. 
* 
*  The calling sequence for DBIDS is: 
* 
*         CLA  (for DBOPN meaning data base is not already open)
*            or 
*         CCA  (for all other subroutines, data base is already open) 
*         JSB DBIDS 
*          DEF *+2       return point 
*          DEF BASE      base parameter from call 
*        <error return> 
*        <local data base return> 
*        <remote data base return>
* 
A     EQU 0 
B     EQU 1 
* 
      ENT DBIDS 
      EXT #NODE,.ENTP,AIRUN,DBFRT 
* 
*  Get true parameter and return point addresses. 
* 
BASE  NOP 
* 
DBIDS NOP 
      STA SAVE      Save A reg. for later.
      NOP           Note: this NOP is necessary for .ENTP 
      JSB .ENTP 
       DEF BASE 
* 
*  If A register was zero at entry, the node number is in the first word
*  of the BASE parameter. 
* 
      LDA SAVE
      SZA 
      JMP NOPEN 
* 
*  Call from DBOPN, get node number from BASE and join with non-opens for 
*  the comparison.
* 
      LDB BASE,I
      JMP JOIN
* 
*  Call is not from DBOPN, ask DBFRT to find the Run Table for this data
*  base and to set it up as the current Run Table.
* 
NOPEN JSB DBFRT 
       DEF *+2
       DEF BASE,I 
* 
      SSA           Did DBFRT succeed?
      JMP EXIT        No - invalid BASE parameter.
* 
*  Get node number from 6th word of DBCB. 
* 
      LDA AIRUN 
      ADA DBDSN 
      LDB A,I 
* 
*  If node number is two blanks, a -1, or this node's number, data base is
*  local, else data base is remote. 
* 
JOIN  CPB BLNKS 
      JMP LOCAL 
      CPB #NODE 
      JMP LOCAL 
      INB,SZB 
* 
      ISZ DBIDS     Remote return 
LOCAL ISZ DBIDS     Local return
EXIT  JMP DBIDS,I 
* 
*  Constants and variables. 
* 
DBDSN DEC 5 
BLNKS ASC 1,
* 
SAVE  NOP 
      END 
      END$
                                                  