*M*      DISPLAY KEYIN MODULE CONTAINING ROUTINE FOR 'DISPLAY' KEYIN
*
         DEF      DISPLAY:          PATCHING DEF
DISPLAY: RES
***********************************************************************
*P*      NAME:    DISPLAY
*P*
*P*      PURPOSE: TO PROVIDE THE HANDLER FOR THE 'DISPLAY' KEYIN.
*P*
*P*      DESCRIPTION:  LOADED WITH THE KEYIN OVERLAY AND CONTAINS THE
*P*               SINGLE ENTRY POINT:  KIDIS.
*P*
*P*      REFERENCE:  CP-V OPERATIONS REFERENCE MANUAL
***********************************************************************
*
RBCODE   SET      1                 TURNS ON R/B DISPLAY
ANSPROC  SET      1
MPBITS   SET      1
         SYSTEM   UTS
*
*
*
         DEF      KIDIS             HANDLER FOR 'DISPLAY' KEYIN
*
*
*
         REF      ANSFLGS           TO CHECK FOR ANS TAPE DISPLAY
         REF      AVRFNMT           AVR TABLE ENTRY:  ANS FILE NAME
         REF      AVRID             AVR TABLE ENTRY:  USER #
         REF      AVRNOU            AVR TABLE ENTRY:  # OF USERS
         REF      AVRTBL            AVR TABLE ENTRY:  SERIAL # & FLAGS
         REF      AVRTBLNE          AVR TABLE DATA:   # OF ENTRIES
         REF      AVRTBLSIZ         AVR TABLE DATA:   # TAPE ENTRIES
         REF      BATAPE            TO CONVERT DCTX TO AVRX
         REF      BT31TO0           MASKS
         SREF     COC               TIME-SHARING SYSTEM CHECK
         REF      CVSYSID           ROUTINE TO CONVERT SYSID
         REF      DCT16             DEVICE NAME DATA
         REF      DCT24             PARTITIONING INFO
         REF      DCT3              PARTITIONING INFO
         REF      GKIFLD            ROUTINE TO PARSE DISPLAY KEYIN
         REF      GMB               ROUTINE TO GET MONITOR BUFFER
         REF      GMBSIZ            MONITOR BUFFER SIZE DATA
         REF      WORDCNT           DATA FOR DISP DISC
         REF      CATBUF            DATA FOR DISP DISC
         REF      BUFMASK           DATA FOR DISP DISC
         REF      GRANRAD           DATA FOR DISP DISC
         REF      GRANSYM           DATA FOR DISP DISC
         REF      IDTOBCD           ROUTINE TO CONVERT ID
         REF      JTYPEA            ROUTINE TO SEND DISPLAY TO OC
         REF      KDISPGFC          GHOST FUNCTION CODE:  DISPLAY
         REF      KEYERR            KEYIN ERROR EXIT ROUTINE
         REF      KEYINR            KEYIN NORMAL EXIT ROUTINE
         REF      KFL               BYTE-CNT FIELD OF KPL
         REF      KPLB              BUFFER WITHIN KPL
         REF      KSGCQ             ROUTINE TO BUILD RBBAT COM BUFFER
         SREF     LB:UN             TO OBTAIN LINE'S USER #
         SREF     LNOL              FOR INDEXING INTO COC TABLES
         REF      LPART             FOR INDEXING INTO PARTITION TABLES
         REF      NXKICHR           ROUTINE TO OBTAIN NEXT KEYIN CHAR
         REF      PLB:USR           PARTITION TABLE ENTRY:  USER #
         REF      PLD:ACT           PARTITION TABLE ENTRY:  ACCOUNT
         REF      PLH:SID           PARTITION TABLE ENTRY:  SYSID
         REF      RMB               ROUTINE TO RELEASE MONITOR BUFFER
         SREF     S:MPDISP          FLAG FOR THE MOOSE
         REF      SB:RTY            RESOURCE TABLE:  DEVICE TYPE
         REF      SH:RBCU           RESOURCE TABLE:  BATCH USAGE
         REF      SH:RGCU           RESOURCE TABLE:  GHOST USAGE
         REF      SH:RNM            RESOURCE TABLE:  RESOURCE NAME
         REF      SH:ROCU           RESOURCE TABLE:  ON-LINE USAGE
         REF      SMUIS             FOR INDEXING INTO USER TABLES
         REF      SNDDX             FOR INDEXING INTO SYMBIONT TABLES
         REF      SNULL             STATE VALIDATION
         REF      SOLICIT           SOLICIT BIT FOR DRIVE
         REF      SSIG              SYMBIONT STATUS CHECKING
         REF      SV:RSIZ           FOR INDEXING INTO RESOURCE TBLS
         REF      SW                STATE VALIDATION
         REF      T:GJOBSTRT        TO GOOSE THE MOOSE
         REF      TB:FLGS           RESOURCE TYPE VALIDATION
         REF      TSTACK            MONITOR TEMP STACK
         SREF     TXMOOSE           TEXT FOR T:GJOBSTRT
         REF      UB:US             USER-STATE VALIDATION
         REF      UH:FLG            BAT FLAG
         REF      UH:FLG2           SUSPENDED FLAG
         REF      XA                DIVISOR
         REF      XTOBCD            ROUTINE TO CONVERT HEX TO EBCDIC
         REF      Y15               MASK
         REF      YC1FF             FROM KEYN - AVRTBL BUSY BITS
*
*
*
         DO       RBCODE            ***********************************
         SREF     ACTBIT            RB:FLAG BIT:  LINE LOGGED ON
         SREF     ALBIT             RB:FLAG BIT:  RBLOG KEYIN DONE
         SREF     DCBIT             RB:FLAG BIT:  WSN SPECIFIED
         SREF     DISCBIT           RB:FLAG BIT:  DISC WHEN DONE
         SREF     FRBIT             RB:FLAG BIT:  INITIAL READ OF FILE
         SREF     HASPBIT           RB:FLAG BIT:  IRBT LINE
         SREF     LIPBIT            RB:FLAG BIT:  LOGGING ON
         SREF     LOFBIT            RB:FLAG BIT:  LOGGING OFF
         SREF     OFFBIT            RB:FLAG BIT:  RBX'ED
         SREF     RB:FLAG           REMOTE BATCH FLAGS
         SREF     RBB:HIN           R/B SYMBIONT CHAINS
         SREF     RBB:HOU           R/B SYMBIONT CHAINS
         REF      RBB:ID            R/B SYSID'S
         SREF     RBD:WSN           R/B WRK-STATION NAMES
         REF      RBLIMS            DCTX LIMITS FOR R/B
         SREF     SSSBIT            RB:FLAG BIT:  INPUTTING WHILE SUSP
         SREF     STB:LNK           R/B SYMBIONT CHAINS
         FIN                        *************************************
         PAGE
PERDWND  EQU      2                 DCT24 BIT FOR RECONFIGURATION
Y1       EQU      BT31TO0+29
Y2       EQU      BT31TO0+30
Y8       EQU      BT31TO0+32
*
*
*
*        MISCELLANEOUS MESSAGE TEXTS
*
KDSUSER1 TEXT     '
USER = '
KDSDC    TEXT     ' DC '
KDSDP    TEXT     ' DP '
KDSCYL   TEXT     ' CYL'
KDSYMB   TEXT     ' SYMBIONT = '
KDSEMPTY GEN,40,24 'EMPTY',
KDSCRACH TEXT     'SCRATCH '
KDSUSER2 DATA     'USER',0
KDPUBLIC TEXT     ' PUBLIC '
KDLOCKED TEXT     ' LOCKED '
KDSHARE  TEXT     ' SHARED '
KDID     GEN,24,8 'ID=',
KDSYSTEM TEXT    'SYSTEM'
KDSAVAIL GEN,40,24 'AVAIL',
KDSOLIC  GEN,56,8 'SOLICIT',0
ALLOHEADS EQU     '    BATCH ON-LINE GHOST'
ALLOHEAD DATA,1   S:NUMC(ALLOHEADS)+2,X'15',S:UT(ALLOHEADS),X'15'
         BOUND    4
COCHEADS EQU      'LINE# ID'
COCHEAD  DATA,1   S:NUMC(COCHEADS)+2,X'15',S:UT(COCHEADS),X'15'
         BOUND    4
         PAGE
*                 SYMBOLIC REGISTER DEFINITIONS.
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5        EQU       5
R6       EQU      6
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
         PAGE
KIDIS    EQU      %
***********************************************************************
*F*      NAME:    KIDIS
*F*
*F*      PURPOSE: TO PROVIDE A DRIVER FOR THE 'DISP(LAY)' KEYIN.
*F*
*F*      DESCRIPTION:  OBTAINS THE NEXT FIELD FROM KEYINBUF, VALIDATES
*F*               IT AND GIVES CONTROL TO THE APPROPRIATE HANDLER.
***********************************************************************
*D*      NAME:    KIDIS
*D*
*D*      CALL:    DIRECT BRANCH FROM KEYN WHEN 'DISPLAY' KEYIN IS
*D*               REQUESTED.
*D*
*D*      INPUT:   R7 = ADR OF KEYIN PARAMETER LIST
*D*               KEYINBUF = OPERATOR'S KEYIN TEXT
*D*
*D*      OUTPUT:  R6 = ADR OF MONITOR BUFFER (IF THE DISPLAY IS THE TYPE
*D*                    THAT IS NOT EVENTUALLY PROCESSED BY RBBAT).
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  TRANSFERS CONTROL TO THE APPROPRIATE DISPLAY SUB-
*D*                  HANDLER
*D*
*D*      ENVIRONMENT:  MAPPED/MASTER
*D*
*D*      DESCRIPTION:  DETERMINES WHAT TYPE OF DISPLAY HAS BEEN
*D*                    REQUESTED AND PASSES CONTROL TO THE APPROPRIATE
*D*                    SUB-HANDLER; IF IT IS THE TYPE THAT IS NOT BUILT
*D*                    BY RBBAT, A MONITOR BUFFER IS ACQUIRED.
***********************************************************************
*
         B        KIDIS1
         BAL,SR4  NXKICHR           GET NEXT DELIMITER
KDS00    CI,SR1   X'40'             SPACE DELIMITER
         BE       %-2               YES,TRY AGAIN
KIDIS1   EQU      %
         CI,SR1   X'15'             NO OPTION(NEW LINE DELIMITER FOUND)
         BE       KDS01             YES
         BAL,SR4  GKIFLD            YES,GET OPTION
         BCR,8    KDS00             OPTIONLENGTH,IF CORRECT,BRANCH
         LW,R0    KFL,R7            NO OPTION(LENGTH.EQ.0)
         BEZ      KDSNOP            YES
KDSERR   B        KEYERR            NO,ERROR EXIT
KDS01    EQU      %
         LW,R0    KFL,R7
         BEZ      KDSNOP
         LI,R1    OPTION#
         LW,R0    KPLB,R7
         CW,R0    DISPTXT,R1
         BE       KDGCK
         BDR,1    %-2
         LW,R0    SNDDX
         BEZ      KEYERR
         BAL,SR4  CVSYSID
         BCR,8    KDSYID
         B        KEYERR
KDGCK    EQU      %                 IF THE OPTION DOES NOT CALL RBBAT GET A MONI
         CI,R1    GHOPT             BUFFER BEFORE EXITING TO THE OPTION ROUTINE
         BLE      DISPTV,R1
         BAL,15   BLKIT
         B        DISPTV,R1
         PAGE
LOC      EQU      %
         DEF      DISPTXT           CSECT BIAS
         DEF      DISPTV            CSECT BIAS
DISPTXT  CSECT    0
DISPTV   CSECT    0
*
*
*
X        SET      0
DITV     CNAME
         PROC
Y        SET      NUM(AF)<2|S:NUMC(AF(1))>4
         ERROR,1,Y   'ILLEGAL/MISSING ARGUMENT FIELD'
         GOTO,Y   %PEND
         USECT    DISPTXT
LF       TEXT     AF(1)
         USECT    DISPTV
         B        AF(2)
X        SET      X+1
%PEND    PEND
*
*
*
         DITV     'XXXX',KEYERR     DUMMY ENTRY
KDSPACES DITV     '    ',KDSNOP
         DITV     'CPU ',KDCPU
         DITV     'DISP',KDSNOP     DEFAULT DISPLAY KEYIN
         DITV     'DI  ',KDSNOP
         DITV     'NORU',KDSNOR
         DITV     'OC  ',KDSOC
         DITV     'OUTP',KDOUT
         DITV     'Q   ',KDSNOP
         DITV     'SYMB',KDSYM
*
*********************************** ABOVE THIS LINE:  HANDLED BY RBBAT
GHOPT    EQU      X-1 **************************************************
*********************************** BELOW THIS LINE:  HANDLED BY KEYIN
*
         DITV     'COC ',KDSCOC
         DITV     'DISC',KDISC
         DITV     'JOB ',KDSJOB
         DITV     'PACK',KDPACK
         DITV     'RES ',KDSRES
         DITV     'TAPE',KDSTAP
         DITV     'USER',KDSUSER
         DITV     'VOLU',KDSVOL
         DO       RBCODE
         DITV     'RBT ',KDRBT
         FIN
OPTION#  EQU      X-1
         USECT    LOC
         PAGE
KDISC    EQU      %
***********************************************************************
*F*      NAME:    KDISC
*F*
*F*      PURPOSE: TO PROCESS THE 'DISC' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  USER=XXXX DC, XXXX DP; SYMBIONT=XXXX
***********************************************************************
*D*      NAME:    KDISC
*D*
*D*      CALL:    KEYIN FORMAT:  DISPLAY DISC
*D*
*D*      INPUT:   R6 = ADR OF MONITOR BUFFER
*D*               GRANRAD, GRANPACK, GRANSYM
*D*
*D*      OUTPUT:  'USER=XXXX DC, XXXX EP; SYMBIONT=XXXX'
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  CONVERT, KDS8CHM, KDS8FRTO, TYPEIT
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  GRANRAD, GRANPACK, AND GRANSYM ARE ACQUIRED,
*D*               CONVERTED FROM BINARY TO EBCDIC-DECIMAL (VIA CONVERT),
*D*               AND FORMATTED (VIA KDS8CHM) INTO THE APPROPRIATE
*D*               DISPLAY.
***********************************************************************
*
         LW,D2    GRANRAD
         AH,D2    WORDCNT
         BAL,SR2  CONVERT
         LI,R3    8                 INITIALIZE OC LIST CHARACTER INDEX
         LW,R0    KDSUSER1          '(NL)USE'
         LW,R1    KDSUSER1+1        'R = '
         STW,R0   0,R6              TO OC LIST
         STW,R1   1,R6              MESSAGE BUFFER
         BAL,SR2  KDS8CHM           USER GRANULE COUNT TO OC LIST MSG
         LW,D3    KDSDC
         BAL,SR2  KDS8CHM           PUT 'DC' INTO MESSAGE
         INT,D2   WORDCNT           PACK WORD CNT
         AW,D2    GRANRAD+1
         BAL,SR2  CONVERT
         BAL,SR2  KDS8CHM           PUT IN MESSAGE
         LW,D3    KDSDP
         BAL,SR2  KDS8CHM
         LW,SR2   CATBUF+3          GET CYL GRANS TOO
         LW,R2  BUFMASK+3
         LB,D2    *SR2
         AI,SR2   1
         LB,D3    *SR2
         AW,D2    D3
         BDR,R2   %-3
         AW,D2    GRANRAD+3
         BAL,SR2  CONVERT
         BAL,SR2  KDS8CHM
         LW,D3    KDSCYL
         BAL,SR2  KDS8CHM
         LI,R2    KDSYMB            YES,SET TO EDIT ' SYMBION'
         BAL,SR2  KDS8FRTO          TO OC LIST MESSAGE
         LW,D3    KDSYMB+2          'T = '
         BAL,SR2  KDS8CHM           TO OC LIST MESSAGE
         LW,D2    GRANSYM
         AH,D2    WORDCNT+1
         BAL,SR2  CONVERT
         BAL,SR2  KDS8CHM           SYMB GRAN COUNT TO OC LIST MSG
         LW,D3    Y15
KDS04A   BAL,SR2  KDS8CHM           TO OC LIST MESSAGE BUFFER
         BAL,15   TYPEIT
         B        RELXX
         PAGE
CONVERT  RES      0
***********************************************************************
*F*      NAME:    CONVERT
*F*
*F*      PURPOSE: SUBROUTINE TO CONVERT A BINARY VALUE TO A DECIMAL
*F*               NUMBER IN EBCDIC FORMAT.
*F*
*F*      DESCRIPTION:  CONVERTS A CALLER-SPECIFIED BINARY VALUE TO A
*F*               (<= 8 DIGIT) DECIMAL NUMBER IN EBCDIC FORMAT.
***********************************************************************
*D*      NAME:    CONVERT
*D*
*D*      CALL:    BAL,R9(SR2)
*D*
*D*      INPUT:   R13(D2) = BINARY VALUE TO BE CONVERTED.
*D*
*D*      OUTPUT:  R14/R15(D3/D4) = CONVERTED DECIMAL VALUE IN EBCDIC
*D*                                FORMAT.
*D*
*D*      REGISTERS:  R12(D1) IS VULNERABLE.
*D*
*D*      INTERFACE:  NONE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  CONVERTS A CALLER-SPECIFIED BINARY VALUE TO A
*D*                    (<= 8-DIGIT) DECIMAL NUMBER IN EBCDIC FORMAT.
***********************************************************************
*
         LI,D3    0                 CLEAR EBCDIC COUNT                  020
KDSGC05  LI,D1    0                 EXTEND DISC GRANULE COUNT
         DW,D1    XA                /10
         AI,D1    X'F0'             ADD EBCDIC BIAS TO DIGIT
         SLD,D3   -8                POSITION EBCDIC GRANULE COUNT       020
         STB,D1   D3                EDIT IN DIGIT                       020
         AI,D2    0                 CONVERSION DONE                     020
         BNEZ     KDSGC05           NO,LOOP                             020
         B        *SR2              EXIT
         PAGE
KDS8FRTO EQU      %
         LW,D3    0,R2              PICK UP 8 CHARACTERS
         LW,D4    1,R2              TO MOVE TO MESSAGE BUFFER
*        B        KDS8CHM           FALLTHRU TO KDS8CHM
*
KDS8CHM  EQU      %
***********************************************************************
*F*      NAME:    KDS8CHM
*F*
*F*      PURPOSE: SUBROUTINE TO MOVE CHARACTERS INTO MESSAGE BUFFER.
*F*
*F*      DESCRIPTION:  MOVES USER-SUPPLIED CHARACTERS INTO A USER-
*F*               SUPPLIED MESSAGE BUFFER.
***********************************************************************
*D*      NAME:    KDS8CHM
*D*
*D*      ENTRY:   KDS8FRTO
*D*
*D*      CALL:    BAL,R9(SR2)
*D*
*D*      INPUT:   R2 = ADR OF BUFFER CONTAINING CHARACTERS (IF BAL IS TO
*D*                    KDS8FRTO).
*D*               R3 = BYTE INDEX INTO BUFFER.
*D*               R6 = MONITOR BUFFER ADR.
*D*               R14/R15(D3/D4) = CHARACTERS TO BE MOVED (IF BAL IS TO
*D*                                KDS8CHM).
*D*
*D*      OUTPUT:  R3 IS UPDATED
*D*
*D*      REGISTERS:  R0 IS VULNERABLE.
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  MOVES USER-SUPPLIED CHARACTERS INTO A USER-
*D*               SUPPLIED BUFFER.
***********************************************************************
*
         LB,R0    D3                MOST SIGNIFICANT CHARACTER.EQ.NULL?
         BEZ      *SR2              YES,EXIT
         STB,R0   *R6,R3            NO,MOVE TO MESSAGE BUFFER
         AI,R3    1                 INCR.CHARACTER INDEX
         SLD,D3   8                 POSITION NEXT CHARACTER
         B        KDS8CHM           LOOP
         PAGE
KDCPU    EQU      %
***********************************************************************
*F*      NAME:    KDCPU
*F*
*F*      PURPOSE: TO PROCESS THE 'CPU' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SETS A FLAG AND GOOSES THE MOOSE.
************************************************************************
*
         LI,4     NSCPU             ANY SLAVE CPUS
         BEZ      KEYERR            NO,ERROR
         MTW,1    S:MPDISP          SET DISPLAY FLAG
         LD,0     TXMOOSE           GO START UP MOOSE
         BAL,10   T:GJOBSTRT
         B        KEYINR
         PAGE
KDSCOC   EQU      %
***********************************************************************
*F*      NAME:    KDSCOC
*F*
*F*      PURPOSE: TO PROCESS THE 'COC'  OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  LINE #   ID
*F*                    XX     YY
*F*                    .      .
*F*                    .      .
***********************************************************************
*D*      NAME:    KDSCOC
*D*
*D*      CALL:    KEYIN FORMAT:  DISP COC
*D*
*D*      INPUT:   R6 = MONITOR BUFFER ADR.
*D*               LB:UN
*D*
*D*      OUTPUT:  A DISPLAY OF ALL ACTIVE COC LINES AND THEIR
*D*               CORRESPONDING SYSIDS.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE.
*D*
*D*      INTERFACE:  RMB, TYPEIT, XTOBCD, 4BYTE, KDS8CHM
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  FOR EACH NON-ZERO LB:UN, THE LINE # AND USER #
*D*               ARE CONVERTED AND FORMATTED INTO THE APPROPRIATE
*D*               DISPLAY.
***********************************************************************
*
         LI,D3    COC               COC-LESS SYSTEM
         BNEZ     COC0              NO
         LW,D3    R6                MB
         BAL,11   RMB               GIVE IT BACK
         B        KEYERR
COC0     EQU      %
         LI,D3    BA(COCHEAD)       COC HEADING
         ANLZ,D4  BAMB              BYTE ADDRESS MONITOR BUFFER
         LB,R3    COCHEAD
         STB,R3   D4                COUNT
         MBS,D3   1                 MOVE HEAD SKIPPING COUNT
         BAL,15   TYPEIT
         LI,5     0
COC1     EQU      %
         MTB,0    LB:UN,5           ID
         BEZ      COC2
         STB,5    D2                LINE#
         PUSH     R6                SAVE BUFFER ADDRESS
         LI,6     2                 # POSITIONS CONVERT
         BAL,11   XTOBCD            CONVERT
         OR,D3    =X'1540'**16
         PULL     R6                RESTORE BUFFER ADDRESS
         STW,D3   0,6
         LI,R3    4                 POSITION IN BUFFER
         LW,14    BT31TO0+31        =X'40000000'
         BAL,9    KDS8CHM           MOVE IT TO BUFFER
         LB,D2    LB:UN,5           ID
         LI,R3    5                 POSITION IN BUFFER
         BAL,R0   4BYTE
         BAL,15   TYPEIT
COC2     EQU      %
         AI,5     1
         CI,5     LNOL
         BL       COC1
         B        RELXX
         PAGE
KDSRES   EQU      %
***********************************************************************
*F*      NAME:    KDRES
*F*
*F*      PURPOSE: TO PROCESS THE 'RES' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                        BATCH ON-LINE GHOST
*F*                  RES     #      #      #
*F*                   .      .      .      .
*F*                   .      .      .      .
*F*                   .      .      .      .
***********************************************************************
*D*      NAME:    KDSRES
*D*
*D*      CALL:    KEYIN FORMAT:  DISP RES
*D*
*D*      INPUT:   R6 = MONITOR BUFFER ADR.
*D*               SV:RSIZ, SB:RTY, TB:FLGS, SH:RNM, SH:RBCU, SH:ROCU,
*D*               SH:RGCU
*D*
*D*      OUTPUT:  A DISPLAY OF TAPE/DISC RESOURCES AND HOW THEY ARE
*D*               CURRENTLY ALLOCATED.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  TYPEIT, CONVERT, KDS8CHM
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  THE RESOURCE TABLES ARE ACCESSED TO DETERMINE
*D*               THE CURRENT TYPE AND ALLOCATION OF ALL SYSTEM
*D*               RESOURCES AND AN APPROPRIATE DISPLAY IS FORMATTED.
***********************************************************************
*
         LI,D3    BA(ALLOHEAD)      ALLOCATION HEADING
         ANLZ,D4  BAMB              BYTE ADDRESS MONITOR BUFFER
         LB,R3    ALLOHEAD          COUNT
         STB,R3   D4
         MBS,D3   1                 MOVE HEAD SKIPPING COUNT
         BAL,15   TYPEIT
         LI,5     SV:RSIZ           RESOURCE TABLE SIZE
RES0     EQU      %
         LB,3     SB:RTY,5          TYPE
         CI,3     X'FF'             NOT RESOURCE
         BE       RES2
         LB,3     TB:FLGS,3         FLAGS
         SLS,3    -6                TYPE BITS
         CI,3     2                 1 0 = TAPE; 1 1 = DISC
         BL       RES2              NOT OF INTEREST
         LH,3     SH:RNM,5          TEXT
         SLS,3    16                LEFT JUSTIFY
         AI,3     '  '
         STW,3    0,6
         LH,D2    SH:RBCU,5         BATCH ALLOCATION
         BAL,SR2  CONVERT
         LI,3     6                 BUFFER INDEX
         BAL,SR2  KDS8CHM           IN BUFFER
         LH,D2    SH:ROCU,5         ON-LINE ALLOCATION
         BAL,SR2  CONVERT
         LI,3     13                INDEX
         BAL,SR2  KDS8CHM           IN BUFFER
         LH,D2    SH:RGCU,5         GHOST ALLOCATION
         BAL,SR2  CONVERT
         LI,3     20                INDEX
         BAL,SR2  KDS8CHM           IN BUFFER
         LW,D3    Y15               CR
         BAL,SR2  KDS8CHM           IN BUFFER
         BAL,15   TYPEIT
RES2     EQU      %
         BDR,5    RES0
         B        RELXX
BAMB     MTB,0    *6                SUBJECT FOR ANLZ
         PAGE
KDSUSER  EQU      %
***********************************************************************
*F*      NAME:    KDSUSER
*F*
*F*      PURPOSE: TO PROCESS THE 'USER' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  BATCH:  ID,ID,...
*F*                  ONLINE: ID,ID,...,ID;
*F*                          ID,ID...
*F*                  ASLEEP: ID,ID,...
*F*                  HUNGUP: ID,ID,ID,...
***********************************************************************
*D*      NAME:    KDSUSER
*D*
*D*      CALL:    KEYIN FORMAT:  DISP USER
*D*
*D*      INPUT:   R6 = MONITOR BUFFER ADR.
*D*               SMUIS, UB:US, UH:FLG2
*D*
*D*      OUTPUT:  A DISPLAY OF ALL ACTIVE USERS' IDS.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  KDS8CHM, UBAT, 4BYTE, TYPEIT
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  4 PASSES ARE MADE THRU UB:US IN ORDER TO PLACE
*D*               USERS IN 1 OF THE DISPLAY CATEGORIES:  BATCH, ON-
*D*               LINE, ASLEEP OR HUNGUP.
***********************************************************************
*
         LI,7     -1
BUFMESS  EQU      %                                                  RL3
         LI,R3    0
         MTW,1    7
         LD,D3    MESS,7
         BAL,SR2  KDS8CHM
START    LI,4     SMUIS             INDEX ON MAX USERS
         LB,1     UB:US,4           USER?
         CI,1     SNULL             FOR EMPTY USER SLOTS
         BNE      TEST              YES, GOT AN ACTIVE USER
LOOP     BDR,4    START+1
         CI,3     8
         BNE      OUTPUT-1          NO
         CI,7     3                 FINISHED?
         BNE      BUFMESS           NO
KDREL    LW,14    6
         B        RELXX
TEST     CI,1     SW                ASLEEP
         BNE      TEST1             NO
         CI,7     2                 HIS TURN
         BL       LOOP
         LH,11    UH:FLG2,4         GET USER FLAGS
         CI,11    X'40'             SUSPENDED USER?
         BAZ      TEST0             NO, JUST A SLEEPER
         CI,7     3                 IS IT HIS TURN TO PRINT
         BNE      LOOP              NOPE
         B        LIST23
TEST0    CI,7     2                 HIS TURN YET?
         BNE      LOOP              NO
LIST23   EQU      %
         BAL,11   UBAT              BATCH [ ON-LINE
         B        IDER              ON-LINE USER #
         B        IDER+1            BATCH SYSID
TEST1    BAL,11   UBAT
         B        TEST2
         CI,7     0
         BE       IDER+1
         B        LOOP
TEST2    CI,4     1
         BE       LOOP
         CI,7     1
         BNE      LOOP
IDER     LW,D2    4                 ID FOR SLEEP,ONLINE
         BAL,0    4BYTE
         CI,4     1                 LAST ENTRY
         BE       OUTPUT            YES-WRITE IT
         CI,3     57
         BE       TLINE             YES
         LI,2     ','               EDIT COMMA
         STB,2    *6,3
         AI,3     1
         B        LOOP              GET NEXT ID
TLINE    EQU      %
         LI,2     ';'               EDIT SEMI-COLON
         STB,2    *6,3
         AI,3     1
         B        OUTPUT
         MTW,-1   3
OUTPUT   BAL,15   TYPEIT
         LD,D3    NXTL
         BAL,SR2  KDS8CHM
         B        LOOP
         BOUND    8                                                  RL3
MESS     TEXT     '
BATCH: '                                         RL3
         TEXT     '
ONLINE:'                                         RL3
         TEXT     '
ASLEEP:'                                         RL3
         GEN,8,56 X'15','HUNGUP:'
NXTL     GEN,8,56 X'15','       '
         PAGE
UBAT     EQU      %
***********************************************************************
*F*      NAME:    UBAT
*F*
*F*      PURPOSE: SUBROUTINE TO DETERMINE USER-TYPE.
*F*
*F*      DESCRIPTION:  RETURNS USER'S SYSID IF SPECIFIED USER # BELONGS
*F*               TO A BATCH USER.
***********************************************************************
*D*      NAME:    UBAT
*D*
*D*      CALL:    BAL,R11
*D*               < RETURN IF USER IS NOT BATCH >
*D*               < RETURN IF USER IS BATCH >
*D*
*D*      INPUT:   R4 = USER #
*D*               UH:FLG, LPART, PLB:USR, PLH:SID
*D*
*D*      OUTPUT:  R13(D2) = BATCH USER'S SYSID
*D*
*D*      REGISTERS:  R1 & R2 ARE VULNERABLE.
*D*
*D*      INTERFACE:  NONE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  DETERMINES IF USER # IS ASSOCIATED WITH A BATCH
*D*               USER (VIA UH:FLG) AND, IF SO, RETURNS HIS SYSID TO
*D*               THE CALLER.
***********************************************************************
*
         CI,4     SMUIS
         BG       *11
         LI,1     X'100'
         CH,1     UH:FLG,4
         BAZ      *11
         LI,2     LPART
NEXT     CB,4     PLB:USR,2         FIND HIM
         BE       FOUND
         BDR,2    NEXT
         B        *11
FOUND    LH,D2    PLH:SID,2         GET HIS ID
         MTW,1    11
         B        *11
         PAGE
F0TO40   EQU      %
************************************************************************
*F*      NAME:    F0TO40
*F*
*F*      PURPOSE: TO REPLACE X'00'/X'F0' BYTES IN A REGISTER WITH X'40'.
*F*
*F*      DESCRIPTION:  SCANS EACH BYTE OF D3 AND REPLACES X'00' OR
*F*               X'F0' BYTES WITH X'40' BYTES
***********************************************************************
*
         PUSH     6
         LW,6     Y8
         LW,D4    KDSPACES
F0T40L   LB,D1    D3,6
         BEZ      F0T40
         CI,D1    X'F0'
         BE       F0T40
         PULL     6
         B        *11
F0T40    STB,D4   D3,6
         BIR,6    F0T40L
         PAGE
SIXBACK  EQU      %
***********************************************************************
*F*      NAME:    SIXBACK
*F*
*F*      PURPOSE: SUBROUTINE TO UN-PACK A 6-CHARACTER SERIAL #.
*F*
*F*      DESCRIPTION:  UN-DUZ WHAT THE SIXPACK ROUTINE DID WHEN IT
*F*               COMPRESSED A 6-CHARACTER FIELD INTO A 1-WORD ITEM.
*************************************************************************
*D*      NAME:    SIXBACK
*D*
*D*      CALL:    BAL,R11(SR4)
*D*
*D*      INPUT:   R2 = HASHED SERIAL #
*D*
*D*      OUTPUT:  R8/R9(SR1/SR2) = EBCDIC 6-CHARACTER SERIAL #(LEFT-
*D*               JUSTIFIED).
*D*
*D*      REGISTERS:  R2 IS VULNERABLE.
*D*
*D*      INTERFACE:  NONE
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  UN-DUZ WHAT THE SIXPACK ROUTINE DID WHEN IT
*D*               COMPRESSED A 6-CHARACTER FIELD INTO A 1-WORD ITEM.
***********************************************************************
*
         PUSH      4,R3
         SLD,R2   -20
         SLS,R3   -12
         LW,R5    R3
         LI,R6    6
SIXBACK1 EQU      %
         SLD,R2   -2
         SLS,R3   -26
         LI,R4    0
         DW,R4    XA
         OR,R3    R4
         BEZ      %+2
         AI,R3    X'80'
         AI,R3    X'40'
         SLD,SR1  -8
         STB,R3   SR1
         BDR,R6   SIXBACK1
         PULL     4,R3
         B        *SR4
         PAGE
KDSJOB   EQU      %
***********************************************************************
*F*      NAME:    KDSJOB
*F*
*F*      PURPOSE: TO PROCESS THE 'JOB' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  ID=XXXX ACCNT=XXXXXXXX PART=XX
***********************************************************************
*D*      NAME:    KDSJOB
*D*
*D*      CALL:    KEYIN FORMAT:  DISP JOB
*D*
*D*      INPUT:   R6 = MONITOR BUFFER ADR.
*D*               LPART, PLH:SID, PLD:ACT
*D*
*D*      OUTPUT:  A DISPLAY OF CURRENTLY ACTIVE BATCH JOBS.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE.
*D*
*D*      INTERFACE:  IDTOBCD, XTOBCD, TYPEIT, RMB
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  FOR EVERY ACTIVE BATCH PARTITION (PLH:SID AND
*D*               PLD:ACT NON-ZERO) AN APPROPRIATE DISPLAY IS FORMATTED.
************************************************************************
*
         LI,7     LPART
NEXTPART RES      0
         MTH,0    PLH:SID,7         TEST FOR ACTIVE
         BEZ      KDSL
         LD,D1    PLD:ACT,7
         BEZ      KDSL
         LW,5     6
         SLS,5    2                 BA
         LI,4     BA(PART)          BA SOURCE
         AW,5     Y2                32 BYTES
         MBS,4    0
         LW,5     D3                BUFFER
         STW,D1   4,5
         STW,D2   5,5
         LH,D2    PLH:SID,7
         SLS,13   16
         BAL,11   IDTOBCD           D3=ANSWER
         STW,D3   1,5               ID
         LW,13    7
         SLS,D2   24
         LI,6     2
         BAL,11   XTOBCD            6=# OF BYTES  TO CONVERT
         LI,4     14+1
         STH,D3   *5,4
         LW,6     5
         LI,3     32
         BAL,15   TYPEIT
KDSL     RES      0
         BDR,7    NEXTPART
RELXX    EQU      %
         LI,11    KEYINR
         B        RMB
PARTS    EQU      'ID=     ACCNT=          PART=  '
PART     DATA,1   X'15',S:UT(PARTS)
         BOUND    4
         PAGE
***********************************************************************
*F*      NAME:    KDSYID
*F*
*F*      PURPOSE: TO PROCESS THE 'ID' FORM OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT.
*F*********************************************************************
*F*      NAME:    KDSNOP
*F*
*F*      PURPOSE: TO PROCESS THE 'Q' OPTION OF THE 'DISPLAY' KEYIN; THIS
*F*               IS ALSO THE HANDLER FOR THE DEFAULT 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT FOR KDSYID
*F*********************************************************************
*F*      NAME:    KDSNOR
*F*
*F*      PURPOSE: TO PROCESS THE 'NORUN' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT FOR KDSYID.
*F**********************************************************************
*F*      NAME:    KDSOC
*F*
*F*      PURPOSE: TO PROCESS THE 'OC' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT FOR KDSYID.
*F*********************************************************************
*F*      NAME:    KDSYM
*F*
*F*      PURPOSE: TO PROCESS THE 'SYMB' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT FOR KDSYID.
*F*********************************************************************
*F*      NAME:    KDOUT
*F*
*F*      PURPOSE: TO PROCESS THE 'OUTPUT' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  SEE 'D' REPORT FOR KDSYID.
************************************************************************
*D*      NAME:    KDSYID
*D*
*D*      ENTRY:   KDSNOP, KDSNOR, KDSOC, KDSYM, KDOUT
*D*
*D*      CALL:    VIA ANY OF THE DISPLAY OPTIONS THAT REQUIRE THE
*D*               SERVICES OF RBBAT:
*D*                 'ID'/'BLANK'/NORUN/OC/SYMB/OUTPUT/Q
*D*
*D*      INPUT:   KDISPGFC
*D*
*D*      OUTPUT:  SEE DESCRIPTION BELOW
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE.
*D*
*D*      INTERFACE:  KSGCQ
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  THESE DISPLAY REQUESTS ARE PASSED TO RBBAT VIA A
*D*               GHOST COMMUNICATION BUFFER.  THE FOLLOWING REGISTER
*D*               SET-UPS ARE INPUT TO KSGCQ FOR BUILDING & QUEUEING
*D*               THE BUFFER:
*D*
*D*                  OPTION          R13    R14     R12
*D*                  ------          ---    ---     ---
*D*                (NO OPTION)        0      0       F
*D*                     Q             0      0      GU
*D*                     OC            0      -5     HNC
*D*                   NORUN           -1     -5     OCO
*D*                    (ID)           1     (ID)    STD
*D*                    SYMB           -2     -      TIE
*D*                   OUTPUT          -3     -5      O
*D*                                                  N
***********************************************************************
*
KDSYID   EQU      %
         LI,13    1
         LW,14    2                 GET ID
         B        KDGQ              MERGE
*
KDSNOP   EQU      %
         LI,13    0
         LI,14    0
         B        KDGQ              MERGE
*
KDSOC    EQU      %
         LI,13    0
         B        KDGQ1             MERGE
*
KDSYM    EQU      %
         LI,13    -2
         B        KDGQ              MERGE
*
KDOUT    EQU      %
         LI,13    -3
         B        KDGQ1             MERGE
*
KDSNOR   EQU      %
         LI,13    -1
KDGQ1    EQU      %
         LI,14    -5
KDGQ     EQU      %                 MERGE ENTRY POINT
         LI,12    KDISPGFC          GHOST FUNCTION CODE
         B        KSGCQ             BUILD BUFFER FOR RBBAT
         PAGE
         DO       RBCODE
*
KDRBT    EQU      %                 DISPLAY RBT
***********************************************************************
*F*      NAME:    KDRBT
*F*
*F*      PURPOSE: TO PROCESS THE 'RBT' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  RBNDD--WSN--RBID--STATUS
*F*                    .     .     .     .
*F*                    .     .     .     .
*F*                    .     .     .     .
***********************************************************************
*D*      NAME:    KDRBT
*D*
*D*      CALL:    KEYIN FORMAT:  DISP RBT
*D*
*D*      INPUT:   R6 = MONITOR BUFFER ADR.
*D*               RB:FLAG, DCT16, RBB:ID, RBD:WSN, RBB:HIN, RBB:HOU,
*D*               SSIG, STB:LNK
*D*
*D*      OUTPUT:  A DISPLAY DESCRIBING THE STATUS OF EACH REMOTE BATCH
*D*               STATION STATUS.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  CONVERT, TYPEIT
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  A DISPLAY IS FORMATTED FOR EACH REMOTE BATCH
*D*               STATION GIVING THE DEVICE ADDRESS, WORKSTATION NAME,
*D*               REMOTE BATCH ID, AND STATUS.  STATUS IS ONE OF THE
*D*               FOLLOWING:
*D*
*D*                  STATUS            RBB:ID  RB:FLAG
*D*                  ------            ------  ------------------------
*D*               EMPTY                  0     LIPBIT+ACTBIT=0
*D*               LOGGING ON             0     ACTBIT=0; LIPBIT=1
*D*               LOGGING OFF            ID    LOFBIT+DISCBIT /=0
*D*               SUSPENDED              ID    SYMX=2; SSSBIT=1
*D*               OUTPUTTING             ID    SYMB=2; SSSBIT=0
*D*               INACTIVE               ID    SYMX=1; FRBIT=1
*D*               INPUTTING              ID    SYMX=1; FRBIT=0
*D*               ACTIVE                 ID    HASPBIT=1; RBB:HIN/OU /=0
*************************************************************************
*
         LW,5     RBLIMS+1          :
         CW,5     RBLIMS            IF RBB:ID = 0 AND LIPBIT ISN'T SET SAY
         BL       RELXX             'EMPTY'  IF LIPBIT IS SET SAY 'LOGGING ON'
         LD,14    DCT16,5           IF RBB:ID =/ 0 SAY THE STATE OF THE
         STW,14   *R6               RBT DEPENDING ON:
         STW,15   1,R6              :
         LW,14    DASH              LOFBIT +DISCBIT  --  LOGGING OFF
         STW,14   2,6               SYMX=1 AND FRBIT --  INACTIVE
         LW,10    RB:FLAG,5         SYMX=1 AND NO FRBIT  -- INPUTTING
         CW,10    ALBIT
         BANZ     KDRBT3
         CW,10    DCBIT
         BANZ     KDRBT3
         LB,13    RBB:ID,5          SYMX=2 AND SSSBIT  --  SUSPENDED
         BEZ      KDRBT1            SYMX=2 AND NO SSSBIT -- OUTPUTTING
KDRBT3   EQU      %
         LD,14    RBD:WSN,5         :
         STW,14   3,6               ONE MESSAGE IS OUTPUT FOR EACH RBT.
         STW,15   4,6
         LW,14    DASH
         STW,14   5,6
         LB,13    RBB:ID,5
         BAL,9    CONVERT
         SLS,14   -8
         CI,14    X'40'
         BAZ      %-2
         OR,14    KDSPACES
         STW,14   6,6
         LW,14    DASH
         STW,14   7,6
         LI,13    20
         LI,1     0
         CI,10    ACTBIT+LIPBIT
         BAZ      KDRBT15
         CI,10    ACTBIT
         BAZ      KDRBT2-1
         LI,R1    2
         CI,10    LOFBIT+DISCBIT
         BANZ     KDRBT2
         CW,10    HASPBIT
         BAZ      KDRBT4
         LI,1     7
         LB,3     RBB:HIN,5
         BNEZ     KDRBT2
         LB,R3    RBB:HOU,5
         BEZ      KDRBT35
         LB,11    SSIG,3
         BNEZ     KDRBT2
         LB,3     STB:LNK,3
         BNEZ     %-3
KDRBT35  EQU      %
         LI,1     5
         B        KDRBT2
KDRBT4   EQU      %
         AI,R1    1
         LB,2     RBB:HIN,5
         BEZ      KDRBT5
         AI,R1    2
         CW,10    FRBIT
         BANZ     KDRBT2
         B        KDRBT2-1
KDRBT5   EQU      %
         LB,2     RBB:HOU,5
         BEZ      KDRBT35
         CI,10    SSSBIT
         BANZ     KDRBT2
         AI,R1    1
KDRBT2   EQU      %
         LD,2     RBPTRS,1
         AW,3     6
         AI,3     3
         SLS,3    2
         AW,3     13
         LB,14    3
         AW,14    13
         AI,14    12
         MBS,2    0
         LW,3     14
         AI,5     -1
         LI,15    KDRBT+1
         B        TYPEIT
KDRBT1   EQU      %
         LI,R1    0
         CI,10    LIPBIT+ACTBIT
         BAZ      KDRBT2
         B        KDRBT2-1
KDRBT15  EQU      %
         CI,10    OFFBIT            IS STATION RBX'ED?
         BAZ      KDRBT2            NO
         LI,1     8                 GET DISPL TO 'RBX' MESSAGE
         B        KDRBT2
*
*
*
DASH     TEXT     ' -- '
EMPM     TEXT     'EMPTY'
LGNM     TEXT     'LOGGING ON'
INPM     TEXT     'INPUTTING'
OPTM     TEXT     'OUTPUTTING'
INACM    TEXT     'INACTIVE'
SUSM     TEXT     'SUSPENDED'
LGFM     TEXT     'LOGGED OFF'
HACTM    TEXT     'ACTIVE'
RBXM     TEXT     'RBXED'
PTR      COM,32,10,22  BA(AF(1)),AF(2),0
         BOUND    8
RBPTRS   EQU      %
         PTR      EMPM,5
         PTR      LGNM,10
         PTR      LGFM,10
         PTR      SUSM,9
         PTR      OPTM,10
         PTR      INACM,8
         PTR      INPM,9
         PTR      HACTM,6
         PTR      RBXM,5
*
*
*
         FIN
         PAGE
TYPEIT   EQU      %
***********************************************************************
*F*      NAME:    TYPEIT
*F*
*F*      PURPOSE: TO TYPE A DISPLAY ON THE OC
*F*
*F*      DESCRIPTION: CALLS JTYPEA (IN SYMSUBR) TOINTERFACE TO NEWQ;
*F*               FALLS THRU TO BLKIT TO RE-ACQUIRE THE MONITOR BUFFER
*F*               (VIA GMB) SINCE JTYPEA RELEASED IT.
***********************************************************************
*
         LW,14    3
         LW,13    6
         PUSH     15
         PUSH     2,4
         BAL,11   JTYPEA
         NOP
         PULL     2,4
         PULL     15
*        B        BLKIT             FALL THRU TO BLKIT
*
*
*
BLKIT    EQU      %
************************************************************************
*F*      NAME:    BLKIT
*F*
*F*      PURPOSE: TO ACQUIRE AND INITIALIZE A MONITOR BUFFER.
*F*
*F*      DESCRIPTION:  CALLS GMB TO ACQUIRE A MONITOR BUFFER (ADR
*F*               RETURNED TO CALLER IN R6); THE BUFFER IS THEN
*F*               INITIALIZED WITH BLANKS.
***********************************************************************
*
         PUSH     2,1
         BAL,11   GMB
         BEZ      GMB
         LI,2     GMBSIZ-1
         LW,1     KDSPACES
         STW,1    *14,2
         BDR,2    %-1
         PULL     2,1
         LW,6     14
         LI,3     0
         B        *15
*
*
*
4BYTE    EQU      %
***********************************************************************
*F*      NAME:    4BYTE
*F*
*F*      PURPOSE: TO CONVER A BINARY ID TO EBCDIC.
*F*
*F*      DESCRIPTION:  CONVERTS AND FORMATS A BINARY ID.
************************************************************************
*
         SLS,D2   16
         PUSH     0
         BAL,11   IDTOBCD
         BAL,11   F0TO40
         LI,15    0
         BAL,SR2  KDS8CHM
         PULL     0
         B        *0
         PAGE
KDPACK   EQU      %
***********************************************************************
*F*      NAME:    KDPACK
*F*
*F*      PURPOSE: TO PROCESS THE 'PACK' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  YYNDD STATUS SERIAL#,ID
*F*                    .     .       .     .
*F*                    .     .       .     .
*F*                    .     .       .     .
***********************************************************************
*
         LI,7     AVRTBLNE-AVRTBLSIZ
         LI,5     AVRTBLSIZ
        B        KDSTAPA
*
KDSVOL   EQU      %
***********************************************************************
*F*      NAME:    KDSVOL
*F*
*F*      PURPOSE: TO PROCESS THE 'VOLU' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  YYNDD STATUS SERIAL#,ID
*F*                    .     .       .     .
*F*                    .     .       .     .
*F*                    .     .       .     .
***********************************************************************
*
         LI,7     AVRTBLNE
         B        KDSTAP+1
*
*
*
KDSTAP   EQU      %
***********************************************************************
*F*      NAME:    KDSTAP
*F*
*F*      PURPOSE: TO PROCESS THE 'TAPE' OPTION OF THE 'DISPLAY' KEYIN.
*F*
*F*      DESCRIPTION:  CALCULATES VALUES FOR, AND BUILDS THE FOLLOWING
*F*               OC MESSAGE:
*F*                  YYNDD STATUS SERIAL#,ID
*F*                    .     .       .     .
*F*                    .     .       .     .
*F*                    .     .       .     .
***********************************************************************
*D*      NAME:    KDSTAP
*D*
*D*      ENTRY:   KDSVOL, KDPACK
*D*                                   -    -
*D*                                   |TAPE|
*D*      CALL:    KEYIN FORMAT:  DISP |VOLU|
*D*                                   |PACK|
*D*                                   -    -
*D*      INPUT:   EACH ENTRY POINT SETS APPROPRIATE AVR TABLE POINTERS:
*D*                  R5 = AVR INDEX AT WHICH TO START DISPLAY
*D*                  R6 = MONITOR BUFFER ADR
*D*                  R7 = # OF AVR ENTRIES TO DISPLAY
*D*               DCT3, DCT24, DCT16, AVRTBL, AVRID, AVRNOU, ANSFLGS,
*D*               AVRFNMT
*D*
*D*      OUTPUT:  A DISPLAY DESCRIBING THE STATUS OF THE SPECIFIED
*D*               REMOVABLE VOLUME DEVICES.
*D*
*D*      REGISTERS:  ALL ARE VULNERABLE
*D*
*D*      INTERFACE:  KDS8FRTO, KDS8CHM, 4BYTE, TYPEIT, SIXBACK, CONVERT
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  A DISPLAY IS FORMATTED FOR EACH REMOVABLE VOLUME
*D*               DEVICE OF THE TYPE SPECIFIED IN THE KEYIN BASED ON THE
*D*               FOLLOWING AVR-TABLE DATA:
*D*
*D*                  STATUS     PUB  SERIAL  NOU  ID  SCR
*D*               ------------  ---  ------  ---  --  ---
*D*                  EMPTY       0     0      0   0    0
*D*                  SYSTEM      1     0      0   0    0
*D*                  AVAIL       0     #      0   0    0
*D*                  PUBLIC      1     #      -   -    0
*D*                  SHARED      0     #      #   0    0
*D*                  USER        0     #      -   #    0
*D*                  SCRATCH     0     #      -   -    1
*D*                  LOCKED      -     #      #   -1   0
************************************************************************
*
         LI,7     AVRTBLSIZ
         LI,5     0
KDSTAPA  LI,R2    BATAPE
         AW,2     5
         LC       DCT3,R2
         BCS,2    DTPVLOOP
         LB,R3    DCT24,R2
         CI,R3    PERDWND           IS DEVICE RECONFIGURED OUT OF SYSTEM?
         BANZ     DTPVLOOP          YES...IGNORE IT
         LD,D3    DCT16,R2
         SLD,D3   16
         LI,R3    X'15'
         STB,R3   D3
         AI,D4    X'4000'
         STW,D3   0,R6              EDITED YYNDD
         STW,D4   1,R6              TO MESSAGE BUFFER
         LI,R3    7                 SET MESSAGE CHARACTER INDEX
         LD,D1    AVRTBL,5
         LH,4     AVRID,5
         BNEZ     IDSET
JJSC     LI,2     KDSEMPTY
         B        ANS%USE
NOTANS0  EQU      %
         LW,11    D1                ANY INSN
        BEZ      CKSYS
INUSE    EQU      %
        LI,R2    KDPUBLIC
        CW,D2    Y8
        BANZ     TYPOMES
         LI,2     KDSUSER2
         CI,4     0                 ANY ID
         BNE      CKPREMT           YES - MIGHT BE BUSY
         LI,2     KDSCRACH
         CW,D2    Y1                SCRATCH
         BANZ     TYPOMES           YES
        LI,R2    KDSHARE
        MTH,0    AVRNOU,R5
        BNEZ     TYPOMES            SHARED
         LI,2     KDSAVAIL          NO,IT HAS BEEN PREMOUNTED
TYPOMES  BAL,SR2  KDS8FRTO          CHAR TO MESSAGE BUFFER
         LW,D4    D1
         BEZ      CHKID
         CI,D4    -1                MAYBE SCRATCH
         BE       CHKID
         B        ANS%SN            CHECK ANS SERIAL #
CKPREMT  CW,D2    YC1FF             IS DRIVE ACTUALLY BUSY?
         BANZ     TYPOMES           IF SO, SAY SO
         LI,2     KDSAVAIL          IF NOT SAY 'AVAIL'
         MTB,0    SOLICIT,5         IS IT BEING SOLICITED?
         BEZ      TYPOMES           IF NOT IT'S REALLY AVAILABLE
         LI,2     KDSOLIC           SAY 'SOLICIT' NOT 'AVAIL' OR 'USER'
         B        TYPOMES
NOTANS1  EQU      %
         LI,D3    ','
         SLD,D3   24
         BAL,SR2  KDS8CHM
CHKID    EQU      %
         AI,4     0
         BEZ      SETCR             NO ID
         LW,D4    KDID
         LI,D3    ','               EDIT COMMA
         SLD,D3   24
         BAL,SR2  KDS8CHM
         BAL,11   UBAT
         LW,13    4
         BAL,0    4BYTE
SETCR    EQU      %
         B        ANS%FNM           CHECK ANS FILE NAME
NOTANS2  EQU      %
         BAL,15   TYPEIT
DTPVLOOP EQU      %
         AI,5     1
         BDR,7    KDSTAPA
         B        RELXX
IDSET    RES      0
         CI,R4    -1
         BNE      JJSC
         LI,R2    KDLOCKED
         B        TYPOMES
*
CKSYS   CW,D2    Y8
        BAZ      TYPOMES
        LI,2     KDSYSTEM
        B        TYPOMES
         PAGE
* ADDITIONS FOR ANS TAPES
ANS%SN   EQU      %
         CI,R5    AVRTBLSIZ         TAPE | PACK
         BGE      NOTANS1           PACK
         LB,SR4   ANSFLGS,R5        ANS TAPE ON THIS DRIVE
         CI,SR4   X'C8'             ANS TAPE FLAGS
         BAZ      NOTANS1
         PUSH     SR1
         LW,R2    D1
         BAL,SR4  SIXBACK           DEHASH SERIAL # (SR1-SR2)
         SLD,SR1  -16
         SLD,SR1  8
         OR,SR1   =','**24          EDIT COMMA
         LD,D3    SR1
         PULL     SR1
         B        CHKID-1
*
ANS%FNM  EQU      %
         CI,R5    AVRTBLSIZ         TAPE | PACK
         BGE      NOTANS2           PACK
         LB,SR4   ANSFLGS,R5        ANS TAPE ON THIS DRIVE
         CI,SR4   X'C8'             ANS TAPE FLAGS
         BAZ      NOTANS2
         PUSH     R5
         MI,R5    6*4               AVRFNMT IS A 6 WORD TABLE
ANS%FNM0 EQU      %                 KEEP THIS LABEL ON THIS INSTRUCTION
         LB,SR4   AVRFNMT,R5        COUNT
         BEZ      ANS%FNM1
         CI,SR4   20                IS IT TOO BIG
         BG       ANS%FNM1
         LW,D3    =','''**16        EDIT COMMA, QUOTE
         BAL,SR2  KDS8CHM
         ANLZ,D1  ANS%FNM0          BYTE ADDRESS OF FILE NAME
         ANLZ,D2  KDS8CHM+2         BYTE ADDRESS BUFFER
         AW,R3    SR4               ADD COUNT TO BUFFER INDEX
         STB,SR4  D2                COUNT TO MBS
         MBS,D1   1                 MOVE FILE NAME EXCLUDING COUNT
         LW,D3    =''''**24         EDIT CLOSE QUOTE
         BAL,SR2  KDS8CHM
         ANLZ,R2  ANS%FNM0
         AI,R2    18                DISP TO FILE SEQ #
         LB,D2    0,R2
         BEZ      ANS%FNM1          NO MORE
         LW,D3    =','**24          EDIT COMMA
         BAL,SR2  KDS8CHM
         BAL,SR2  CONVERT           CONVERT TO EBCDIC
         BAL,SR2  KDS8CHM
         LW,D3    =','**24          EDIT COMMA
         BAL,SR2  KDS8CHM
         ANLZ,D1  ANS%FNM0
         ANLZ,D2  KDS8CHM+2
         AI,R3    5                 JULIAN DATE IS 5 CHARACTERS
         MTB,5    D2                COUNT
         MBS,D1   19                MOVE JULIAN DATE
ANS%FNM1 EQU      %
         PULL     R5
         B        NOTANS2
ANS%USE  EQU      %
         CI,R5    AVRTBLSIZ         TAPE | PACK
         BGE      NOTANS0           PACK
         LB,SR4   ANSFLGS,R5
         CI,SR4   X'C8'
         BAZ      NOTANS0
         B        INUSE
         END

