*M*      DELPRI KEYIN MODULE CONTAINING ROUTINES FOR FORM/DELETE/PRIO
*
         DEF      DELPRI:           PATCHING DF
DELPRI:  RES
***********************************************************************
*P*      NAME:    DELPRI
*P*
*P*      PURPOSE: TO PROVIDE THE HANDLERS FOR THE FORM/DELETE/PRIO
*P*               KEYINS.
*P*
*P*      DESCRIPTION:  LOADED WITH THE KEYIN OVERLAY AND CONTAINS THE
*P*               FOLLOWING 3 ENTRY POINTS:
*P*                                 KFRMCG     (FORM KEYIN)
*P*                                 KIDEL      (DELETE KEYIN)
*P*                                 KIPRI      (PRIO KEYIN)
*P*
*P*      REFERENCE:  CP-V OPERATIONS REFERENCE MANUAL
***********************************************************************
*
         SYSTEM   UTS
*
*
*
         DEF      KFRMCG            DRIVER FOR 'FORM' KEYIN
         DEF      KIDEL             DRIVER FOR 'DELETE' KEYIN
         DEF      KIPRI             DRIVER FOR 'PRIO(RITY)' KEYIN
*
*
*
         REF      CVSYSID           SUBR TO CONVERT SYSID TO HEX
         REF      DCT4              DCTX VALIDATION
         REF      DEVCK             DCTX VALIDATION
         REF      E:ART             EVENT TO GOOSE USER (PRIO KEYIN)
         REF      GETUSER#          TO VALIDATE SYSID FOR PRIO KEYIN
         REF      GKIFLD            SUBR TO OBTAIN NEXT KEYIN FIELD
         REF      GMB               TO OBTAIN AN MPOOL BUFFER
         REF      JTYPEA            TO TYPE OC MESSAGES
         REF      KDELGFC           GHOST FUNCTION CODE:  DELETE KEYIN
         REF      KEYERR            COMMON KEYIN ERROR ROUTINE
         REF      KEYINR            COMMON KEYIN EXIT ROUTINE
         REF      KFCGFC            GHOST FUNCTION CODE:  FORMS CHANGE
         REF      KFL               TO OBTAIN BYTE-CNT OF CURRENT KEYIN
         REF      KPLB              TO OBTAIN CURRENT KEYIN FIELD
         REF      KSGCQ             COMMON ROUTINE TO INTERFACE TO SGCQ
         REF      MING              TO PREVENT PRIO CHANGE ON SYS GHOSTS
         REF      PRIOGFC           GHOST FUNCTION CODE:  PRIORITY CHANGE
         REF      RBLIMS            DCTX VALIDATION
         REF      T:RUE             TO GOOSE USER (PRIO KEYIN)
         REF      UB:PRIOB          ALTERED VIA PRIO KEYIN
         REF      XTOBCD            TO CONVERT HEX TO EBCDIC
         REF      BLANK             BLANKS TO TEST FORM NAME
         PAGE
         REF      DCT16
         REF      DCTSIZ            SIZE OF DCT TABLES
         REF      Y4                X'40000000' IN LITERALS
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8,SR1   EQU      8
R9,SR2   EQU      9
R10,SR3  EQU      10
R11,SR4  EQU      11
R12,D1   EQU      12
R13,D2   EQU      13
R14,D3   EQU      14
R15,D4   EQU      15
         PAGE
KIDEL    EQU      %
***********************************************************************
*F*      NAME:    KIDEL
*F*
*F*      PURPOSE: TO PROCESS THE 'DELETE' KEYIN.
*F*
*F*      DESCRIPTION:  PASSES DPSCAN A GHOST COMMUNICATION CODE
*F*               (KDELGFC); THIS CODE IS THEN PASSED TO RBBAT (VIA
*F*               THE KSGCQ ROUTINE) ALONG WITH THE SYMBIONT'S DEVICE
*F*               TYPE AND JOB SYSID.
***********************************************************************
*D*      NAME:    KIDEL
*D*                                          -        -
*D*      CALL:    KEYIN FORMAT:  DELETE SYSID|,YY(NDD)|
*D*                                          -        -
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*               R8(SR1) = CURRENT KEYIN MESSAGE DELIMITER
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  DPSCAN, KSGCQ
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  PASSES DPSCAN A GHOST COMMUNICATION CODE
*D*                    (KDELGFC).
***********************************************************************
*
         LI,12    KDELGFC           GHOST CODE
         LI,SR4   KSGCQ             GET INFO - TELL GHOST
         B        DPSCAN
         PAGE
KIPRI    EQU      %
***********************************************************************
*F*      NAME:    KIPRI
*F*
*F*      PURPOSE: TO PROCESS THE 'PRIO(RITY)' KEYIN.
*F*
*F*      DESCRIPTION:  TWO FORMS OF THE KEYIN:
*F*               PRIO SYSID,(YY(NDD)),PRIO - CAUSES A PRIOGFC GHOST
*F*                    COMMUNICATION CODE TO BE PASSED TO RBBAT (VIA
*F*                    THE KSGCQ ROUTINE) ALONG WITH THE SYMBIONT'S
*F*                    DEVICE-TYPE, JOB SYSID, AND NEW PRIORITY.
*F*                    IF YY(NDD) IS NOT SPECIFIED, ALL FILES FOR THAT
*F*                    SYSID ARE AFFECTED.
*F*               PRIO SYSID(,EXEC-PRIO) - EITHER INFORMS THE OPERATOR
*F*                    OF THE JOB'S BASE EXECUTION PRIORITY OR RE-
*F*                    SETS THE JOB'S BASE EXECUTION PRIORITY TO THE
*F*                    VALUE SPECIFIED.
***********************************************************************
*D*      NAME:    KIPRI
*D*                                         -            -
*D*      CALL:    KEYIN FORMAT:  PRIO SYSID,|YY(NDD),PRIO|
*D*                                         |EXEC-PRIO   |
*D*                                         -            -
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER  LIST
*D*               R8(SR1) = CURRENT KEYIN MESSAGE DELIMITER
*D*               RBLIMS, DCT4
*D*
*D*      OUTPUT:  UB:PRIOB
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  GKIFLD, CVSYSID, DEVCK, GMB, XTOCD, JTYPEA,
*D*                  GETUSER#, T:RUE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  SEE 'F' REPORT'S DESCRIPTION
*D*********************************************************************
*
         CI,SR1   ' '
         BNE      KEYERR
         BAL,SR4  GKIFLD
         BCS,8    KEYERR
         BAL,SR4  CVSYSID           CONVERT TO  BINARY IN R2
         BCS,8    KEYERR
         PUSH     R2
         CI,SR1   X'15'             GIVE HIM PRIORITY
         BE       KIPRI1
         CI,SR1   ','
         BNE      KEYERR
         BAL,SR4  GKIFLD
         BCS,8    NODEV             DEV NOT GIVEN: !PRIO ID,,PRIO FORMAT
         CI,SR1   ','               DOES NEW FILE PRIO FOLLOW?
         BNE      KIPRI2            NO, HE IS CHANGING EXECUTION PRIO
         BAL,SR4  DPSCAN2           GO GET YYNDD OR YY
         B        PUTDEV
NODEV    LI,R2    0                 SET ZERO OF NO DEVICE GIVEN
PUTDEV   PULL     13
         STB,R2   13
         CI,SR1   ','               COMMA DELIMITER FOUND
         BNE      KEYERR            NO,ERROR
         BAL,SR4  GKIFLD            YES,GET PRIORITY
         MTW,-1   KFL,R7            ONE CHARACTER PRIORITY
         BNEZ     KEYERR            NO,ERROR
         LW,14    KPLB,R7           GET PRIO
         LB,14    14                ONE CHAR
         AI,14    -'0'              CONVERT AND CHECK
         BGEZ     %+3
         AI,14    '0'-'A'+10
         BLEZ     KEYERR
         CI,14    X'F'
         BG       KEYERR
         LI,12    PRIOGFC
         B        KSGCQ
*
KIPRI1   EQU      %
         PULL     R6
         BAL,R7   GETUSER#
         B        KEYERR
         LB,R7    UB:PRIOB,R5
         LI,R3    IS
KIPRI1A  EQU      %
         BAL,SR4  GMB
         BEZ      GMB
         LW,R6    D3
         PUSH     R6
         STB,R7   D2
         LI,R6    2                 CONVERT 2 POSITIONS
         BAL,SR4  XTOBCD
         LW,R3    0,R3
         PULL     R6
         STW,R3   0,R6
         SLS,D3   8                 MOVE IT LEFT 1
         OR,D3    Y4                KLUDGE IN A BLANK (BLETCH)
         STW,D3   1,R6
         LW,D2    R6                BUFFER ADDRESS
         LI,D3    7                 BC
         BAL,SR4  JTYPEA            TYPE ON OC
         NOP
         B        KEYINR
KIPRI2   EQU      %
         PULL     R6
         PUSH     R7
         BAL,R7   GETUSER#
         B        KEYERR
         PULL     R7
         CI,R5    MING              RESIDENT GHOST
         BL       KIPRI1A-2         YES- DON'T CHANGE
         BAL,SR4  CVSYSID           CONVERT TO BINARY IN R2
         BCS,8    KEYERR
         CLM,R2   PRLIMS
         BOL      KEYERR
         DISABLE
         LB,R7    UB:PRIOB,R5
         CI,R7    X'C0'             REAL TIME PRIORITY
         BL       KIPRI2A           YES- DON'T CHANGE
         STB,R2   UB:PRIOB,R5
         LI,R6    E:ART
         BAL,R11  T:RUE
         LI,R3    WAS
         B        KIPRI1A
KIPRI2A  EQU      %
         ENABLE
         B        KIPRI1A-1
         BOUND    8
PRLIMS   DATA     X'F0',X'FF'
IS       TEXT     '
IS '
WAS      TEXT     '
WAS'
         PAGE
DPSCAN   EQU      %
***********************************************************************
*F*      NAME:    DPSCAN
*F*
*F*      PURPOSE: SUBROUTINE TO FETCH AND CONVERT THE SYSID AND YYNDD
*F*               FIELDS OF THE 'DELETE' AND 'FORM' KEYINS.
*F*
*F*      DESCRIPTION:  CONVERTS THE SYSID FIELD FROM EBCDIC TO HEX
*F*               FORMAT AND DERIVES THE DCT TYPE FROM THE YYNDD
*F*               SPECIFIED IN THE KEYIN.
***********************************************************************
*D*      NAME:    DPSCAN
*D*
*D*      CALL:    BAL,R11(SR4)
*D*
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*               R8(SR1) = CURRENT KEYIN MESSAGE DELIMITER
*D*               DCT4, RBLIMS
*D*
*D*      OUTPUT:  R13 = DEVICE TYPE CODE, CONVERTED SYSID (BINARY) 8,24
*D*
*D*      REGISTERS:  R12 IS PRESERVED
*D*
*D*      INTERFACE:  GKIFLD, CVSYSID, DEVCK
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  CONVERTS THE SYSID FIELD FROM EBCDIC TO HEX
*D*               FORMAT AND DERIVES THE DCT TYPE FROM THE YYNDD
*D*               SPECIFIED IN THE KEYIN.
***********************************************************************
*
         PUSH     SR4
         CI,SR1   ' '
         BNE      KEYERR
         BAL,SR4  GKIFLD            GET SYSID
         BAL,SR4  CVSYSID           CONVERT SYSID FROM HEX TO BINARY
         BCS,8    KEYERR
         LW,13    R2
         CI,SR1   X'15'             C/R?
         BE       DPS03             YES...ALLOW SHORTENED VERSION
         CI,SR1   ','               NO,COMMA DELIMITER
         BNE      KEYERR
         BAL,SR4  GKIFLD            GET DEVICE YYNDD
DPS00    LW,R0    KFL,R7            GET FIELD LENGTH
         CI,R0    5                 IS IT YYNDD?
         BE       DPS01             YUP
         CI,R0    2                 IS IT JUST YY?
         BNE      KEYERR            NOPE, NO GOOD
         LW,R4    KPLB,R7           GET HIS YY
         SAS,R4   -16               MAKE IT EASY TO USE
         LI,R2    DCTSIZ            GET TABLE SIZE
DPYYA    LD,R0    DCT16,R2          GET MNEMONIC
         SLD,R0   -8                SHIFT YY INTO R1 LEFT
         CH,R4    R1                IS IT THE SAME?
         BNE      DPYYB             NO, TRY AGAIN
         CLM,R2   RBLIMS            IS IT AN RBT?
         BCS,9    DPS02             NO, USE IT
DPYYB    BDR,R2   DPYYA             TRY NEXT DEVICE
         B        KEYERR            NOT FOUND, ERROR
*
DPS01    LW,R2    KPLB,R7           GET YYNDD
         LW,R3    KPLB+1,R7         GET 'D   '
         BAL,SR4  DEVCK             CONVERT 'YYNDD' TO DEVICE DCTX
         BCS,8    KEYERR
         CLM,R2   RBLIMS
         BIL      KEYERR
DPS02    LB,R2    DCT4,R2
         STB,R2   13
DPS03    PULL     SR4               NO,RESTORE EXIT
         B        *SR4              EXIT
*
DPSCAN2  PUSH     SR4
         B        DPS00
         PAGE
KFRMCG   EQU      %
***********************************************************************
*F*      NAME:    KFRMCG
*F*
*F*      PURPOSE: TO PROCESS THE 'FORM' KEYIN.
*F*
*F*      DESCRIPTION:  THE KFCGFC GHOST COMMUNICATION CODE IS PASSED TO
*F*               RBBAT (VIA THE KSGCQ ROUTINE) ALONG WITH THE
*F*               SYMBIONT'S DEVICE-TYPE, JOB SYSID, AND OPERATOR-
*F*               SPECIFIED FORM NAME.
***********************************************************************
*D*      NAME:    KFRMCG
*D*                                        -      -          --
*D*      CALL:    KEYIN FORMAT:  FORM SYSID|,YYNDD|,FORM-NAME||
*D*                                        -      -          --
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*               R8(SR1) = CURRENT KEYIN MESSAGE DELIMITER
*D*
*D*      OUTPUT:  PASSES RBBAT A GHOST COMMUNICATION BUFFER
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  DPSCAN, GKIFLD, KSGCQ
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  THE KFCGFC GHOST COMMUNICATION CODE IS PASSED TO
*D*               RBBAT (VIA THE KSGCQ ROUTINE) ALONG WITH THE
*D*               SYMBIONT'S DEVICE-TYPE, JOB SYSID, AND OPERATOR-
*D*               SPECIFIED FORM NAME.
*************************************************************************
*
         BAL,11   DPSCAN
         LI,14    0
         CI,8     ','
         BNE      KIF1
         BAL,11   GKIFLD
         MTW,-4   KFL,7
         BGZ      KEYERR
         LW,14    KPLB,7
         CW,R14   BLANK             DONT ALLOW ALL BLANKS AS FORM NAME
         BNE      KIF1
         LI,R14   0
KIF1     EQU      %
         LI,12    KFCGFC
         B        KSGCQ
         END

