*M*      KEYSUB KEYIN SUBROUTINE MODULE
*
         DEF      KEYSUB:           PATCHING DEF
KEYSUB:  RES
***********************************************************************
*P*      NAME:    KEYSUB
*P*
*P*      PURPOSE: TO PROVIDE A MODULE OF SUBROUTINES CALLED WITHIN THE
*P*               KEYIN OVERLAY.
*P*
*F*      DESCRIPTION:  LOADED WITH THE KEYIN OVERLAY AND CONTAINS
*F*               SEVERAL SUBROUTINES.
***********************************************************************
*
         SYSTEM   UTS
         DEF      CVSYSID           SUBR TO CONVERT EBCDIC SYSID TO HEX
         DEF      DECONV            SUBR TO CONVERT EBCDIC # TO BINARY #
         DEF      DEVCK             SUBR TO CONVERT DEV ADR TO DCTX
         DEF      HEXCK             SUBR TO CONVERT EBCDIC CHAR TO HEX
         DEF      NDD               SUBR TO DERIVE DCTX
         DEF      SIXPACK           SUBR TO PACK A 6-CHAR SERIAL #
         DEF      SYMCOM            SUBR FOR SYMBIONT-OPER COMMUNICATION
         DEF      SYMTABCK          SUBR TO CONVERT DCTX TO SYMTABX
         DEF      WAKEUP            SUBR TO WAKE-UP A USER
         PAGE
*                 SYMBOLIC REGISTER DEFINITIONS.
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
*
*
*
M24      EQU      MASKS+24
M8       EQU      MASKS+8
XFF      EQU      MASKS+8
KA       EQU      X'A'
KC1      EQU      X'C1'
KF0      EQU      X'F0'
         PAGE
         REF      AVRID             TO DERIVE USER # OF USER TO WAKEUP
         REF      AVRTBLNE          TO CONVERT DCTX TO AVR INDEX
         REF      BATAPE            TO CONVERT DCTX TO AVR INDEX
         REF      DCTSIZ            FOR SCAN OF DCT16
         REF      DCT16             TO VALIDATE 'NDD' VALUES
         REF      E:WU              TO UNBLOCK USER WAITING FOR MOUNT
         REF      GKIFLD            TO GET NEXT FIELD FROM KEYINBUF
         REF      KEYERR            ABNORMAL EXIT UPON  DETECTING ERROR
         REF      KFL               TO OBTAIN BYTE-CNT OF CURRENT FIELD
         REF      KPLB              TO OBTAIN CURRENT KEYIN FIELD
         REF      MASKS             MASKS
         REF      OCQUEUE           TO PASS SYMBIONT STATUS TO OC
         REF      SAQNSERT          TO GOOSE A SYMBIONT
         REF      SCNTXT            TO DETERMINE IF SYMB HAS CNTXT BLK
         REF      SMUIS             TO VALIDATE USER #
         REF      SNDDX             TO DERIVE SYMTAB INDEX FOR SYMB DEV
         REF      SQUE              TO DETERMINE SYMBIONT STATUS
         REF      SSIG              TO DETERMINE/CHANGE SYMBIONT STATUS
         REF      SSTAT             TO DETERMINE SYMBIONT'S STATUS
         REF      SW                TO SEE IF USER TO WAKEUP IS ASLEEP
         REF      SYMX              TO DETERMINE SYMBIONT'S STATUS
         REF      T:GJOBSTRT        TO INITIATE OCPGHST
         REF      T:RUE             TO UNBLOCK A USER WAITING FOR MOUNT
         REF      UB:US             TO SEE IF USER TO WAKEUP IS ASLEEP
         PAGE
SYMCOM   EQU      %
***********************************************************************
*F*      NAME:    SYMCOM
*F*
*F*      PURPOSE: TO TAKE APPROPRIATE ACTION BASED UPON THE SYMBIONT
*F*               SIGNAL CHARACTER (SSC) SPECIFIED IN THE SYMBIONT
*F*               KEYIN (SYYNDD,SSC).
*F*
*F*      DESCRIPTION:  THE SSC IS EITHER PUT INTO THE SYMBIONT TABLES
*F*               (SSIG) AND APPROPRIATE ACTION TAKEN, OR AN
*F*               APPROPRIATE CANNED MESSAGE IS OUTPUT VIA OCQUEUE.
***********************************************************************
*D*      NAME:    SYMCOM
*D*
*D*      CALL:    BAL,SR4(R11)
*D*
*D*      INPUT:   R2 = DCT INDEX OF DEVICE SPECIFIED IN KEYIN
*D*               R12(D1) = SYMBIONT SIGNAL CHARACTER FROM KEYIN
*D*               SSTAT, SQUE, SCNTXT, SYMX, SSIG
*D*
*D*      DATA:    SIGS, VECTOR
*D*
*D*      OUTPUT:  SSIG
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  SYMTABCK, OCQUEUE, SAQNSERT, T:GJOBSTRT
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  SYMTABCK IS CALLED TO OBTAIN A SYMBIONT TABLE
*D*               INDEX FOR THE GIVEN DCT INDEX.  THE INTERNAL TABLES
*D*               (SIGS, VECTOR) ARE ACCESSED TO VALIDATE THE SSC AND
*D*               EITHER PUT IT INTO THE SYMBIONT TABLES (SSIG) AND TAKE
*D*               APPROPRIATE ACTION, OR OUTPUT AN APPROPRIATE CANNED
*D*               MESSAGE VIA OCQUEUE.
***********************************************************************
*
         PUSH     SR4
         BAL,SR4  SYMTABCK          SYMBIONT IN SYSTEM
         B        SYCM01            YES
*                                   NO
SYCMKYER PULL     R0
         B        KEYERR
*
         PAGE
*SYMCOM TYPEOUT ROUTINE
*
*   -- FOR (CR)(EP)(EP) -READ- (TAB)(BLNK)(BLNK)
*
*(R1)=0,(CR)(EP)(EP)SYYNDD NOT ACTIVE(CR)
*(R1)=1,(CR)(EP)(EP)SYYNDD ACTIVE(CR)
*(R1)=2,(CR)(EP)(EP)SYYNDD NOT SUSPENDED(CR)
*(R1)=3,(CR)(EP)(EP)SYYNDD NOT AVAILABLE(CR)
*(R1)=4,(CR)(EP)(EP)SYYNDD SUSPENDED
*
SYCMTYPE1 LI,R1   3
*
SYCMTYPE LW,R7    R2                DCT INDEX TO GET YYNDD
         AI,R1    8                 STATUS INDEX+8 EQUALS MESSAGE INDEX
         BAL,SR4  OCQUEUE           MESSAGE TO OPERATOR'S CONSOLE
         B        SYCM06            EXIT
         PAGE
SYCM01   EQU      %
         LI,R7    #SIGS
         CB,D1    SIGS,R7
         BE       %+3
         BDR,R7   %-2
         B        SYCMKYER
         LB,R1    SSTAT,R3
         BNEZ     SYCM02
         LB,D2    SQUE,R3
         BEZ      %+3
         LI,R1    1
         B        SYCM03
         LH,D2    SCNTXT,R3
         BEZ      SYCM03
         LI,R1    2
SYCM02   EQU      %
         CI,R1    3
         BGE      SYCMTYPE1
SYCM03   EQU      %
         AI,R7    -1
         MI,R7    3
         AW,R7    R1
         LB,R1    VECTOR,R7
         CI,R1    5
         BL       SYCMTYPE
         B        SYMCOM,R1
SYCMSO   EQU      %
         BAL,SR4  SYCMOCK
SYCMS    EQU      %
         STB,D1   SSIG,R3
SYCM06   PLW,SR4  TSTACK
         B        *SR4
SYCMGO   EQU      %
         BAL,SR4  SYCMOCK
SYCMG    EQU      %
         STB,D1   SSIG,R3
         BAL,SR4  SAQNSERT
         B        SYCM06
SYCMOCK  EQU      %
         LB,D2    SYMX,R3
         CI,D2    2
         BANZ     *SR4
SYCMEH   B        SYCMKYER
SYCMUNLK EQU      %
         LB,D2    SSIG,R3
         CI,D2    'L'
         BE       SYCMS
         LI,R1    1
         B        SYCMTYPE
SYCMOCP  EQU      %
         LC       SYMX,R3
         BCR,2    SYCMKYER
         STB,D1   SSIG,R3
         LD,R0    OCPGNM
         BAL,SR3  T:GJOBSTRT
         B        SYCM06
SYCMDL   EQU      %
         LB,D2    SYMX,R3
         AND,D2   NKPBT
SYCMDK   EQU      %
         CI,D2    X'21'             IN OR OCP NO GOOD FOR K OR D
         BANZ     SYCMKYER
         STB,D2   SYMX,R3
         B        SYCM06
SYCMKP   EQU      %
         LB,D2    SYMX,R3
         OR,D2    KPBIT
         B        SYCMDK
*
*
         BOUND    8
OCPGNM   TEXTC    'OCPGHST'
NKPBT    DATA     X'EF'
KPBIT    DATA     X'10'
*
*
SYMSIG   CNAME
         PROC
         GEN,8    CF(2)
         DO       AF(1)<5
INAC(SIGX) SET    AF(1)
         ELSE
INAC(SIGX) SET    AF(1)-SYMCOM
         FIN
         DO       AF(2)<5
ACT(SIGX)  SET    AF(2)
         ELSE
ACT(SIGX) SET     AF(2)-SYMCOM
         FIN
         DO       AF(3)<5
SUSP(SIGX) SET    AF(3)
         ELSE
SUSP(SIGX) SET    AF(3)-SYMCOM
         FIN
SIGX     SET      SIGX+1
         PEND
*
SIGX     SET      1
NOTAC    SET      0
ACTIV    SET      1
NOSUS    SET      2
SUSPD    SET      4
*
*
SIGS     EQU      %
         DATA,1   0
*
*
         SYMSIG,'I' SYCMG,SYCMUNLK,SYCMG INITIATE
         SYMSIG,'C' NOTAC,NOSUS,SYCMG  CONTINUE
         SYMSIG,'R' NOTAC,SYCMSO,SYCMGO RETRY-REPRINT
         SYMSIG,'X' NOTAC,SYCMS,SYCMG  ABORT
         SYMSIG,'L' SYCMSO,SYCMS,SYCMG LOCK
         SYMSIG,'S' NOTAC,SYCMS,SUSPD  SUSPEND
         SYMSIG,'Q' NOTAC,SYCMSO,SYCMGO RE-QUEUE
         SYMSIG,'A' SYCMGO,SYCMSO,SYCMGO ALIGN
         SYMSIG,'K' SYCMKP,ACTIV,ACTIV KEEP GRANULES TILL END
         SYMSIG,'D' SYCMDL,ACTIV,ACTIV DELETE AS YOU GO
         SYMSIG,'B' SYCMOCP,ACTIV,ACTIV   BOOT OCP
SIGX     SET      SIGX-1
#SIGS    EQU      SIGX
*
*
         BOUND    4
*
*
VECTOR   EQU      %
I        DO       SIGX
         GEN,8,8,8  INAC(I),ACT(I),SUSP(I)
         FIN
         BOUND    4
         PAGE
SIXPACK  EQU      %
***********************************************************************
*F*      NAME:    SIXPACK
*F*
*F*      PURPOSE: SUBROUTINE TO HASH A 6-CHARACTER SERIAL # TO A 1-WORD
*F*               ITEM.
*F*
*F*      DESCRIPTION:  PACKS A 6-CHARACTER SERIAL # INTO 4-BYTES
*F*               USING A HASHING TECHNIQUE.
***********************************************************************
*D*      NAME:    SIXPACK
*D*
*D*      CALL:    BAL,SR4(R11)
*D*
*D*      INPUT:   R1 = BA(SERIAL #)
*D*
*D*      OUTPUT:  R2 = HASHED SERIAL #
*D*
*D*      REGISTERS:  NONE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  PACKS A 6-CHARACTER SERIAL # INTO R2 USING A
*D*               HASHING TECHNIQUE.
***********************************************************************
*
         PUSH     3,R3
         LI,R5    0
         LI,R4    6
SIXPACK1 EQU      %
         LB,R3    0,R1
         AI,R1    1
         SLS,R3   26
         SLD,R2   2
         SLS,R3   -28
         MI,R5    10
         AW,R5    R3
         BDR,R4   SIXPACK1
         SLS,R2   20
         OR,R2    R5
         PULL     3,R3
         B        *SR4
         PAGE
NDD      EQU      %
***********************************************************************
*F*      NAME:    NDD
*F*
*F*      PURPOSE: SUBROUTINE TO DERIVE THE DCT & AVR INDICES OF A TAPE
*F*               OR PACK GIVEN THE DEVICE ADDRESS IN THE FORM 'NDD'.
*F*
*F*      DESCRIPTION:  OBTAINS THE NEXT FIELD FROM KEYINBUF (NDD),
*F*               VALIDATES IT AND DERIVES THE DCT & AVR INDICES.
************************************************************************
*D*      NAME:    NDD
*D*
*D*      CALL:    BAL,D4(R15)
*D*
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*
*D*      OUTPUT:  R2 = DCT INDEX OF DEVICE SPECIFIED BY NEXT FIELD IN
*D*                    KEYINBUF
*D*               R5 = AVR INDEX OF DEVICE SPECIFIED BY NEXT FIELD IN
*D*                    KEYINBUF
*D*
*D*      REGISTERS:  R0-R1, R3-R4, R11, & R14 ARE VULNERABLE
*D*
*D*      INTERFACE:  GKIFLD, DEVCK
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  GKIFLD IS CALLED TO OBTAIN THE NEXT FIELD FROM
*D*               KEYINBUF (SUPPOSEDLY A DEVICE ADDRESS OF THE FORM
*D*               'NDD').  DEVCK IS CALLED TO DERIVE THE DCT INDEX.
*D*               THIS DCTX IS THEN CONVERTED TO AN AVR INDEX (IF
*D*               POSSIBLE).
***********************************************************************
*
         BAL,D3   KIMOUNT1A         RETURNS DCTX IN R2
         CI,R2    BATAPE+AVRTBLNE
         BGE      KEYERR
         LW,R5    R2                MAKE AVR INDEX
         AI,R5    -BATAPE
         BLZ      KEYERR
         B        *D4
KIMOUNT1A EQU     %                 IS A SUBROUTINE
         BAL,SR4  GKIFLD            GET FIELD
         BCS,8    KEYERR            CHECK IF LEGAL FIELD
         LW,R1    KFL,R7
         CI,R1    3                 CHECK IF FIELD 3 CHAR'S
         BNE      KEYERR            ERROR IF NOT
         LW,R2    KPLB,R7
         SLD,R2   -16
         BAL,SR4  DEVCK             CHECK IF LEGAL MAG TAPE
         BCS,8    KEYERR
         B        *D3
         PAGE
WAKEUP   RES
***********************************************************************
*F*      NAME:    WAKEUP
*F*
*F*      PURPOSE: SUBROUTINE TO WAKE A SLEEPING USER.
*F*
*F*      DESCRIPTION:  AN E:WU EVENT IS REPORTED ON THE SPECIFIED USER
*F*               IF HE IS CURRENTLY ASLEEP.
***********************************************************************
*D*      NAME:    WAKEUP
*D*
*D*      CALL:    BAL,R11
*D*
*D*      INPUT:   R4 = AVR INDEX
*D*               AVRID, UB:US
*D*
*D*      REGISTERS:  NONE
*D*
*D*      INTERFACE:  T:RUE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  AN E:WU EVENT IS REPORTED ON THE USER ASSOCIATED
*D*               WITH THE SPECIFIED AVR TABLE ENTRY.
***********************************************************************
*
         PUSH     0,5
         LH,5     AVRID,4
         BLEZ     WUX
         CI,5     SMUIS
         BG       WUX
         DISABLE
         LB,7     UB:US,5
         CI,7     SW
         BNE      WUX               BAD STATE TO WAKEUP
         LI,6     E:WU              WAKE UP EVENT
         BAL,11   T:RUE             WAKE UP
WUX      ENABLE
         PULL     0,5
         B        *11
         PAGE
CVSYSID  EQU      %
***********************************************************************
*F*      NAME:    CVSYSID
*F*
*F*      PURPOSE: TO CONVERT A FIELD OF UP TO 4 EBCDIC CHARACTERS INTO
*F*               HEXADECIMAL, PRESUMABLY AS A SYSID VALUE.
*F*
*F*      DESCRIPTION:  CONVERTS THE (<= 4) EBCDIC CHARACTERS IN THE
*F*               FIELD BUFFER OF THE KEYIN PARAMETER LIST TO A RIGHT-
*F*               JUSTIFIED HEXADECIMAL VALUE.
***********************************************************************
*D*      NAME:    CVSYSID
*D*
*D*      CALL:    BAL,SR4(R11)
*D*
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*
*D*      OUTPUT:  R2 = CONVERTED HEXADECIMAL VALUE (RIGHT-JUSTIFIED)
*D*               CC1 = 0 IF IT CONVERTS
*D*               CC1 = 1 IF IT DOESN'T
*D*
*D*      REGISTERS:  R1, R3-R4 & R15 ARE VULNERABLE
*D*
*D*      INTERFACE:  HEXCK
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  AFTER VERIFYING THAT THE CURRENT ITEM IN THE
*D*               FIELD BUFFER OF THE KEYIN PARAMETER LIST IS <= 4
*D*               CHARACTERS, HEXCK IS CALLED TO CONVERT EACH EBCDIC
*D*               CHARACTER TO A HEXADECIMAL DIGIT.  THE RESULT IS
*D*               RIGHT-JUSTIFIED IN R2.
***********************************************************************
*
         LI,R4    0
         LW,R1    KFL,R7
         BE       CVSYSID3                                              746
         CI,R1    4                 CHECK IF <= 4 CHAR
         BG       CVSYSID4          NO, ERROR
         LW,R3    KPLB,R7           (R3) =  EBCDIC  SYSID
CVSYSID2 EQU      %
         SLS,R4   4                       SYSID
         SLD,R2   8                             TO
         BAL,D4   HEXCK                           HEX
         B        CVSYSID4
         OR,R4    R2
         BDR,R1   CVSYSID2
CVSYSID3 EQU       %                                                    746
         LW,R2    R4
         LCI      0
         B        *SR4              EXIT
CVSYSID4 EQU      %
         LCI      8
         B        *SR4
         PAGE
DEVCK    EQU      %
***********************************************************************
*F*      NAME:    DEVCK
*F*
*F*      PURPOSE: SUBROUTINE TO CONVERT A DEVICE ADDRESS TO A DCT INDEX.
*F*
*F*      DESCRIPTION:  VALIDATES A DEVICE ADDRESS (GIVEN IN THE FORM
*F*               YYNDD OR NDD) BY FINDING A MATCH IN DCT16; RETURNS
*F*               DCT INDEX TO CALLER.
***********************************************************************
*D*      NAME:    DEVCK
*D*
*D*      CALL:    BAL,SR4(R11)
*D*
*D*      INPUT:   R2/R3 = 'YYNDD   ' (FOR A NORMAL DEVICE CHECK REQUEST)
*D*                     = '  NDD   ' (FOR A SPECIAL TAPE CHECK REQUEST)
*D*               DCT16
*D*
*D*      OUTPUT:  R2 = DCT INDEX
*D*               CC1 = 0 IF ADDRESS IS VALID
*D*                     1 IF IT ISN'T
*D*
*D*      REGISTERS:  R0-R1  & R3-R4 ARE VULNERABLE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  VALIDATES A DEVICE ADDRESS (GIVEN IN THE FORM
*D*               'YYNDD' OR 'NDD') BY FINDING A MATCH IN DCT16; RETURNS
*D*               THE DCT INDEX IN R2 TO THE CALLER.
***********************************************************************
*
         SLD,R2   -24
         LI,R4    DCTSIZ
         CI,R2    0
         BE       TAPCK
         LD,0     DCT16,R4          LOOK ONLY AT REAL DEVICE NAME -
         AND,0    M8                NECESSARY BECAUSE RB DEVICES
         CD,0     2                 HAVE DIFFERENT FIRST THREE CHARACTERS
         BE       DEVCK2            :
         BDR,4    %-4               :
DEVCK1   LCI      8
         B        *SR4
DEVCK2   LW,R2    R4
         LCI      0
         B        *SR4
TAPCK    LW,R1    R3
TAPCK1   LD,R2    DCT16,R4
         AND,3    M24               :
         CW,R3    R1
         BE       DEVCK2
         BDR,R4   TAPCK1
         B        DEVCK1
         PAGE
HEXCK    EQU      %
***********************************************************************
*F*      NAME:    HEXCK
*F*
*F*      PURPOSE: SUBROUTINE TO CONVERT AN EBCDIC CHARACTER TO A HEX
*F*               DIGIT.
*F*
*F*      DESCRIPTION:  INSURES THAT THE EBCDIC CHARACTER TRANSLATES TO
*F*               A VALID HEX DIGIT AND RETURNS THE HEX DIGIT TO THE
*F*               CALLER.
***********************************************************************
*D*      NAME:    HEXCK
*D*
*D*      CALL:    BAL,D4(R15)
*D*
*D*      INPUT:   R2 = EBCDIC CHARACTER TO BE CHECKED
*D*
*D*      OUTPUT:  R2 = CONVERTED HEXADECIMAL DIGIT
*D*               CC1 = 0 IF CHARACTER WAS LEGAL
*D*                   = 1 IF ILLEGAL
*D*
*D*      REGISTERS:  ALL ARE PRESERVED
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  INSURES THAT THE EBCDIC CHARACTER TRANSLATES TO
*D*               A VALID HEX DIGIT AND RETURNS THE DIGIT TO THE CALLER.
***********************************************************************
*
         AND,R2   XFF
         AI,R2    -KF0
         BL       HEXCK2            BRANCH IF NOT
         CI,R2    9
         BLE      HEXCK3            BRANCH IF 0-9
HEXCK1   EQU      %
         B        *D4               EXIT
*
HEXCK2   EQU      %
         AI,R2    KF0-KC1
         BL       HEXCK1            BRANCH IF NOT
         AI,R2    -5
         BG       HEXCK1            BRANCH IF NOT
         AI,R2    KA+5
HEXCK3   EQU      %
         AI,D4    1
         B        *D4
         PAGE
DECONV   EQU      %
***********************************************************************
*F*      NAME:    DECONV
*F*
*F*      PURPOSE: SUBROUTINE TO CONVERT AN EBCDIC CHARACTER STRING
*F*               (REPRESENTING A DECIMAL #) TO A BINARY VALUE.
*F*
*F*      DESCRIPTION:  INSURES THAT THE EBCDIC CHARACTERS TRANSLATE TO
*F*               VALID DECIMAL DIGITS AND RETURNS THE CONVERTED BINARY
*F*               VALUE TO THE CALLER.
***********************************************************************
*D*      NAME:    DECONV
*D*
*D*      CALL:    BAL,R15
*D*
*D*      INPUT:   R0 = EBCDIC CHARACTER STRING (LEFT-JUSTIFIED, BLANK
*D*                    FILLED TO 4 CHARACTERS)
*D*
*D*      OUTPUT:  R1 = CONVERTED BINARY VALUE OF EBCDIC CHARACTERS
*D*               CC1 = 0 IF LEGAL DECIMAL CHARACTER
*D*                     1 IF ILLEGAL
*D*
*D*      REGISTERS:  R0, R1, R3 & R5 ARE VULNERABLE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  INSURES THAT THE EBCDIC CHARACTERS TRANSLATE TO
*D*               VALID DECIMAL DIGITS AND RETURNS THE CONVERTED BINARY
*D*               VALUE TO THE CALLER IN R2.
***********************************************************************
*
         LI,1     0                 ACCUMULATOR
         LI,5     4                 COUNT OF BYTES TO CONVERT
*
DCV20X   EQU      %
         LB,3     0                 GET NEXT BYTE
         CI,3     X'40'
        BE       DCV30X               BR TO OK EXIT IF BLANK
*
         AI,3     -X'F0'            SUBTRACT DECIMAL BIAS
         BLZ      DCV40X            BR IF NOT DEC #
*
         MI,1     10                SHIFT ACCUMULATOR
         AW,1     3                 ADD LOW ORDER DIGIT
         SLS,0    8                 SHIFT INPUT VALUE
         BDR,5    DCV20X            LOOP
*
DCV30X   EQU      %
         LCI      0
         B        *15
*
DCV40X   EQU      %                 DONE
         LCI      8
         B        *15
         PAGE
SYMTABCK EQU      %
***********************************************************************
*F*      NAME:    SYMTABCK
*F*
*F*      PURPOSE: SUBROUTINE TO OBTAIN A SYMTAB INDEX BASED UPON A
*F*               GIVEN DCT INDEX.
*F*
*F*      DESCRIPTION:  SNDDX IS SCANNED FOR A MATCH AGAINST A GIVEN
*F*               DCT INDEX.
***********************************************************************
*D*      NAME:    SYMTABCK
*D*
*D*      CALL:    BAL,R11
*D*               < NORMAL RETURN >
*D*               < ERROR RETURN >
*D*
*D*      INPUT:   R2 = DCT INDEX
*D*               SNDDX
*D*
*D*      OUTPUT:  R3 = SYMTAB INDEX OF SPECIFIED DEVICE
*D*
*D*      REGISTERS:  ALL ARE PRESERVED
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  SCANS SNDDX FOR A MATCH AGAINST THE GIVEN DCT
*D*               INDEX; RETURNS TO BAL+2 IF A MATCH IS NOT FOUND;
*D*               OTHERWISE THE SYMTAB INDEX OF THE DEVICE IS RETURNED
*D*               TO THE CALLER.
***********************************************************************
*
         LB,3     SNDDX
         CB,2     SNDDX,3
         BE       *11
         BDR,3    %-2
         AI,11    1
         B        *11
         END

