*M*      GETUSER# SUBROUTINE MODULE USED BY KEYIN & RBBAT
*
GETUSER#:     EQU %
              DEF GETUSER#:         MODULE BIAS
***********************************************************************
*P*      NAME:    GETUSER#
*P*
*P*      PURPOSE: TO PROVIDE A MODULE WITH A SUBROUTINE THAT IS COMMON
*P*               TO BOTH KEYIN AND RBBAT.  THE SUBROUTINE DERIVES A
*P*               USER # GIVEN A SYSID.
*P*
*P*      DESCRIPTION:  LOADED WITH THE KEYIN OVERLAY AND THE RBBAT
*P*               GHOST; CONTAINS 1 SUBROUTINE:  GETUSER#.
***********************************************************************
*
UFLAGS   SET      1                 PICK-UP UH:FLG BIT DEFINITIONS
         SYSTEM   UTS
*
*
*
         DEF      GETUSER#          SUBR TO DERIVE USER # GIVEN A SYSID
*
*
*
         REF      SMUIS             MAX # OF USERS IN SYSTEM
         REF      UH:FLG            'BAT' FLAG
         REF      UB:US             USER'S STATE
         REF      SNULL             'NULL' STATE SYMBOL
         REF      PLB:USR           BATCH USER'S USER #
         REF      PLH:SID           BATCH USER'S SYSID
         REF      LPART             # BATCH PARTITIONS
         PAGE
GETUSER# RES      0
***********************************************************************
*F*      NAME:    GETUSER#
*F*
*F*      PURPOSE: SUBROUTINE TO DERIVE A USER # GIVEN A SYSID.
*F*
*F*      DESCRIPTION:  THE SPECIFIED SYSID'S USER # IS OBTAINED FROM
*F*               THE SYSID ITSELF (IF ON-LINE/GHOST) OR PLH:USR (IF
*F*               BATCH).
***********************************************************************
*D*      NAME:    GETUSER#
*D*
*D*      REGISTERS:  R6 IS DESTROYED.
*D*
*D*      CALL:    LW,R6   (SYSID)
*D*               BAL,R7  GETUSER#
*D*               <ABN RETURN>
*D*               <NORMAL RETURN>
*D*
*D*      INTERFACE:  NONE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      INPUT:   R6 = SYSID
*D*               PLH:SID, PLB:USR, UB:US, UB:FLG
*D*
*D*      OUTPUT:  R5 = USER# ASSOCIATED WITH SPECIFIED SYSID
*D*
*D*      DESCRIPTION:  THE SPECIFIED SYSID'S USER # IS OBTAINED FROM
*D*               THE SYSID ITSELF (IF ON-LINE/GHOST) OR PLH:USR (IF
*D*               BATCH).  THE SPECIFIED USER MUST BE CURRENTLY ACTIVE.
***********************************************************************
*
         CI,6     SMUIS
         BLE      GETUS1            ON LINE # = USER #
         LI,5 LPART
         CH,6     PLH:SID,5
         BE       %+3
         BDR,5    %-2
         B        0,7               NO FIND
         LB,6     PLB:USR,5         USER #
         LB,5     UB:US,6           STATE
         CI,5     SNULL             REAL USER
         BE       0,7
         B        GETUS2
GETUS1   LB,5     UB:US,6
         CI,5     SNULL             REAL USER
         BE       0,7
         LH,5     UH:FLG,6
         CI,5     BAT
         BANZ     0,7
GETUS2   EQU      %
         LW,5     6
         B        1,7
         END
		 