***********************************************************************
*M*      P2RES    DECODES RES CC. BUILDS SG:RCT, SG:RNT, & SG:RTY
***********************************************************************
*
*
         SYSTEM   BPM
         SYSTEM   SIG7FDP
*
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
*
*        REFS AND DEFS
         REF      COREALLOC,MODGEN,SYNTAX,WRITELM
         REF      #RATS,RATPTR,RATBMAXPTR,P2DYNEND
         REF      FIRSTDP
         REF      GETPGPTR
         REF      ENDUSED
         REF      GETPGS
         REF      NOROOM
         REF      LOGIT
         REF      SYMBPTR,SYMBDEV,BTXPTR,OTXPTR,GTXPTR
         REF      DCTSIZE,LDVCONST,TYCOUNT
         REF      TYPMNESZ,TYPMNEAD,READSTRG
         DEF      RESOURCE
*        POINTERS IN TEMPSTACK
SBRTYPTR EQU      P2DYNEND+1
SHRTOTPTR EQU     P2DYNEND+2
SHRBSUMPTR EQU    P2DYNEND+3
DUMBMAX  EQU      P2DYNEND+4
SBRBDFPTR EQU     P2DYNEND+5
SHROSUMPTR EQU    P2DYNEND+6
SBROMXPTR EQU     P2DYNEND+7
SBRODFPTR EQU     P2DYNEND+8
SHRGSUMPTR EQU    P2DYNEND+9
SBRGMXPTR EQU     P2DYNEND+10
SBRGDFPTR EQU     P2DYNEND+11
STACKEND EQU      P2DYNEND+12
         PAGE
PKWD     CNAME
         PROC
         GEN,8,7,17 AF(1),AF(2),AF(3)
         PEND
*        KEYWORD TABLE FOR SYNTAX ROUTINE
*
*
KWD      EQU      %
         TEXT     'TOT'
         PKWD     1,0,TOTLOC
         TEXT     'BSUM'
         PKWD     1,0,BSUMLOC
         TEXT     'BMAX'
         PKWD     1,0,BMAXLOC
         TEXT     'BDEF'
         PKWD     1,0,BDEFLOC
         TEXT     'OSUM'
         PKWD     1,0,OSUMLOC
         TEXT     'OMAX'
         PKWD     1,0,OMAXLOC
         TEXT     'ODEF'
         PKWD     1,0,ODEFLOC
         TEXT     'GSUM'
         PKWD     1,0,GSUMLOC
         TEXT     'GMAX'
         PKWD     1,0,GMAXLOC
         TEXT     'GDEF'
         PKWD     1,0,GDEFLOC
         TEXT     'RES'
         PKWD     6,0,RESLOC
LSTKWD   EQU      %-KWD
         DATA     0                 NO DEFAULTS DONE BY SYNTAX
KWRDPTR  GEN,15,17 LSTKWD,KWD       POINTER FOR SYNTAX
         PAGE
DYN      CNAME
         PROC
LF       GEN,1,15,16 AF(1),AF(2),AF(3)
         PEND
*        SKELETON TEMPSTACK FOR SYNTAX ROUTINE
*
DYNAM    EQU      %
TOTLOC   EQU      %-DYNAM
         DYN      1,0,X'7FFF'
BSUMLOC  EQU      %-DYNAM
         DYN      1,0,X'7FFF'
BMAXLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
BDEFLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
OSUMLOC  EQU      %-DYNAM
         DYN      1,0,X'7FFF'
OMAXLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
ODEFLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
GSUMLOC  EQU      %-DYNAM
         DYN      1,0,X'7FFF'
GMAXLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
GDEFLOC  EQU      %-DYNAM
         DYN      1,0,X'FF'
RESLOC   EQU      %-DYNAM
         DYN      1,0,0
#DYNAM   EQU      %-DYNAM
         PZE      ERRORWRITE+1
         PAGE
*        RESOURCE ROUTINE
*   UPON ENTRY R3=BASE WORD ADDRESS OF P2CCI DYNAMIC DATA R7=PLIST ADDRESS
RESOURCE EQU      %
         LW,SR2   FIRSTDP,R3        GET NDX AND YY PART OF DEV. DP NAME
         BEZ      %+4
         STH,SR2  DPNAME
         LB,SR2   SR2               STORE DEVICE NDX (+1) IN TYPS TABLE
         STB,SR2  TYPS2
         LW,SR2   ENDUSED,R3
         AI,SR2   1
         STW,SR2  RATPTR,R3         ALLOCATE SPACE IN 'PERM' STACK
         AI,SR2   8                 FOR RATS - 8 WORDS
         STW,SR2  RATBMAXPTR,R3     AND FOR RATBMAXPTR
         AI,SR2   4
         CW,SR2   GETPGPTR,R3
         LW,D1    SR1               SR1 CONTAINS NEXT CHAR IN CC
         BL       %+3
         LI,R2    GETPGPTR+1
         BAL,R1   GETPGS
         STW,SR2  ENDUSED,R3
         LI,D4    STACKEND-P2DYNEND SAVE ROOM IN STACK FOR PTRS TO TEMP WORKAREA
         MSP,D4   *R0
         LW,R1    =X'08000001'      GET PAGE
         CAL1,8   R1
         BCS,8    NOROOM
         LI,R1    0
         PSW,D1   *R0               SAVE D1
         LI,R2    511
         STW,R1   *SR2,R2
         BDR,R2   %-1
         STW,R1   *SR2
         STW,SR2  SBRTYPTR,R3
         LI,R2    3
         LI,SR1   -1
         STW,SR1  *SR2,R2
         BDR,R2   %-1
         STW,SR1  *SR2
         AI,SR2   4
         LI,R2    -12
         LI,SR1   SHRTOTPTR+12
         AW,SR1   R3
         STW,SR2  *SR1,R2           ALLOW 8 WORDS FOR TABLES
         AI,SR2   8
         BIR,R2   %-2
         STW,SR2  STACKEND,R3
         LW,R1    RATBMAXPTR,R3     RESET DUMMY
         STW,R1   DUMBMAX,R3        MAX TO BMAX PTR
*                                   INITIALIZE # OF STAND RESOURCES TO
*                                   1 AND PUT 'CO' MNEMONIC IN RAT TBL
         LI,R1    1
         STW,R1   STANDNO
         STW,R1   #RATS,R3
         LW,SR1   RATPTR,R3
         LH,SR2   RATDEFS,R1
         STH,SR2  *SR1,R1
         LI,D3    X'7FFF'           CORE TOT + SUMS
         LW,D1    SHRTOTPTR,R3
         STH,D3   *D1,R1
         LW,D1    SHRBSUMPTR,R3
         STH,D3   *D1,R1
         LW,D1    SHROSUMPTR,R3
         STH,D3   *D1,R1
         LW,D1    SHRGSUMPTR,R3
         STH,D3   *D1,R1
         LW,D1    SBRGMXPTR,R3
         STB,D3   *D1,R1
         LW,D1    SBRGDFPTR,R3
         STB,D3   *D1,R1
*                                   SET BMAX,BDEF,OMAX AND ODEF
*                                   DEFAULTS FOR CORE RESOURCE
         LI,D3    X'10'
         LW,D1    DUMBMAX,R3
         STB,D3   *D1,R1
         LW,D1    SBROMXPTR,R3
         STB,D3   *D1,R1
         LI,D3    X'C'
         LW,D1    SBRBDFPTR,R3
         STB,D3   *D1,R1
         LW,D1    SBRODFPTR,R3
         STB,D3   *D1,R1
         LW,D3    TYCOUNT,R3
         LI,D2    4                 MAX # OF STAND RESOURCES BESIDES CO
         LW,D1    RATPTR,R3
         LI,R1    2                 R1 IS NOW THE RAT INDEX
         LI,R6    2                 R6 IS RES. TYPES INDEX
SETDEFS  EQU      %
         LB,R2    TYPS,R6
         LI,D4    SHRTOTPTR
         LH,SR1   *D3,R2            GET TOTAL DEFINED
         CI,SR1   0
         BEZ      ENDDEFLP
         LH,SR2   RATDEFS,R6        GET RAT MNEMONIC
         STH,SR2  *D1,R1            D1 PTS TO RAT TABLE
         STB,R2   TYPFOUND,R1       SAVE STAND TYPE FOUND NDX
         MTW,1    STANDNO           INCREMENT # OF STAND RESOURCES
         MTW,1    #RATS,R3          INCREMENT SIZE OF RAT TABLE
         AI,R2    -1
         LI,R4    2
         LW,SR2   *D4,R3
         STH,SR1  *SR2,R1           STORE VALUE FOR TOT AND BSUM
         AI,D4    1
         BDR,R4   %-3
         LW,SR2   *D4,R3
         STB,SR1  *SR2,R1           STORE VALUE FOR BMAX
         AI,D4    2
         LW,SR2   *D4,R3
         STH,SR1  *SR2,R1           STORE VALUE FOR OSUM
         AI,D4    3
         LW,SR2   *D4,R3
         STH,SR1  *SR2,R1           STORE VALUE FOR GSUM
         AI,D4    -2
         AI,SR1   -1                TOT-1
         BNEZ     %+2
         LI,SR1   1
         LW,SR2   *D4,R3
         STB,SR1  *SR2,R1           STORE VALUE FOR OMAX
         AI,D4    3
         LI,R4    2
         LW,SR2   *D4,R3
         STB,SR1  *SR2,R1           STORE VALUE FOR GMAX AND GDEF
         AI,D4    1
         BDR,R4   %-3
ENDDEFS  EQU      %
         LW,R4    DCTSIZE,R3        STORE RAT INDEX IN OB B,O,G TX TABLES
         AW,R4    R1                RAT INDEX +  #DEVICES+1
         LW,SR2   BTXPTR,R3
         STB,R4   *SR2,R2
         LW,SR2   OTXPTR,R3
         STB,R4   *SR2,R2
         LW,SR2   GTXPTR,R3
         STB,R4   *SR2,R2
         LW,SR2   SBRTYPTR,R3
         STB,R2   *SR2,R1
         AI,R1    1
ENDDEFLP AI,R6    1
         BDR,D2   SETDEFS
         AI,R1    -1
         LB,SR2   TYPFOUND,R1
         CI,SR2   X'13'             IS IT AN MC DEVICE
         BNE      %+3
         LI,SR2   0
         STH,SR2  STDS,R1
         LI,R2    X'D'              GET SP DEVICE NDX INTO TYCOUNT TBL
         LH,SR2   *D3,R2            SEE IF ANY SP'S PRESENT
         BEZ      GETCMND
         AI,R2    -1                MAKE ENTRY AT SP SLOT FOR FOLLOWING
         LW,SR2   BTXPTR,R3
         STB,R4   *SR2,R2
         LW,SR2   OTXPTR,R3
         STB,R4   *SR2,R2
         LW,SR2   GTXPTR,R3
         STB,R4   *SR2,R2
*        GO TO SYNTAX TO READ COMMAND
GETCMND  EQU      %
         LI,R1    #DYNAM            SIZE OF TEMPSTACK
         LI,R2    DYNAM             START OF SKELETON STACK
         LW,R4    KWRDPTR           KEYWORD PTR
         PLW,SR1  *R0               RESTORE SR1 WITH NEXT CHAR IN CC
         BAL,SR4  SYNTAX
*        R5 = ADDRESS OF GENERATED TEMPSTACK TABLE
         LW,R4    *R0               STORE TOP OF DYNAM
         STW,R4   BFSTACK           AREA FOR CLEANUP LATER
         AI,R5    -1                CHECK FOR RESOURCES
LOOP     LW,R2    #RATS,R3          INDEX FOR RAT CHECK
         LW,D2    RESLOC+1,R5       IS RES SPECIFIED
         BLEZ     BUILD
         AI,R5    #DYNAM+1          GET TO CORRECT DYNAM
         LW,D3    RATPTR,R3         ARE IGNORED AND CONTINUE
         SAS,D2   16
         SAS,D2   -16
         CH,D2    *D3,R2
         BE       FND               FOUND
         BDR,R2   %-2
         CH,D2    YC4D7             IS 1 DP
         BE       %+3
         CH,D2    DPNAME
         BNE      NTFND
         LW,D2    SPDF              DP RESOURCE IDENTIAL TO SP
         LI,R1    X'C'              NDX FOR SP
CHKTFND  LW,R2    STANDNO           NEED TO LOOK FOR SP IN TYPFOUND
         CB,R1    TYPFOUND,R2       TABLE OF STAND. RESOURCES
         BE       FND
         BDR,R2   %-2
         B        ERR10
         LI,R2    5                 SET INDEX TO 5
         B        FND
NTFND    LW,R2    #RATS,R3
         AI,R2    1
         CI,R2    15
         BLE      %+2
         B        ERR2             >15 RES- REMAINING IGNORED
*                                   AND GO TO ALLOC CORE
         LW,R1    SYMBDEV,R3        DON'T STORE TILL COMPLETE
         LW,D4    SYMBPTR,R3        SEARCH OF SYMB
         CH,D2    YD5D6             IS IT NO
         BE       ERR8A
         CH,D2    *D4,R1
         BE       ERR3              PRINT SYMB DEVICE TYPE RESOURCE IGNORED
*                                   AND CONTINUE WITH REST OF RESOURCES
         BDR,R1   %-2               OKAY NOW CAN STORE
         STW,R2   #RATS,R3          #RATS
         LW,R1    TYPMNESZ,R3
         LW,D4    TYPMNEAD,R3
         CH,D2    *D4,R1
         BE       %+3
         BDR,R1   %-2
         B        STORETYP
         AI,R1    -1                GET TRUE TYPMNE INDEX
         LW,D4    DCTSIZE,R3        STORE OB: B,O,G TX
         AW,D4    R2                COMPUTE TRUE RAT INDEX
         LW,D3    BTXPTR,R3
         STB,D4   *D3,R1            R1=TYPMNEMONIC INDEX
         LW,D3    OTXPTR,R3
         STB,D4   *D3,R1
         LW,D3    GTXPTR,R3
         STB,D4   *D3,R1
         AI,R1    1                 RESET FOR TYPE BYTE
STORETYP LW,D4    RATPTR,R3         INDEX=0 OR TYPMNE INDEX
         STH,D2   *D4,R2            STORE RAT
         LW,D4    SBRTYPTR,R3
         CI,R1    0
         BE       %+3
         STB,R1   *D4,R2            STORE RAT
         MTB,-1   *D4,R2
         LI,SR2   0                 FLAG FOR IDENTIFYING CORE PASS
CHKVAL   EQU      %
         CI,R1    0                 IS IT NON DEVICE RES
         BNE      DEVRES            NO
         LW,D4    TOTLOC,R5         YES,GET TOTAL
         BLEZ     ERR4              NOT SPECIFIED ERROR
         B        STORTOT           GO STORE
DEVRES   EQU      %
         LW,D3    TYCOUNT,R3
         LW,D4    TOTLOC,R5         GET TOT VALUE
         BGEZ     %+3
         LH,D4    *D3,R1            GET TOT VALUE FROM TYP CTR
         BEZ      ERR4
         CH,D4    *D3,R1            CF AGAINST TOT ON SYSTEM
         BLE      STORTOT
         BAL,SR4  ERR5
         LH,D4    *D3,R1            GET TOT COUNT
STORTOT  EQU      %
         LW,D3    SHRTOTPTR,R3
         STH,D4   *D3,R2            STORE HALF IN TOT TABLE
         LW,SR1   D4                SAVE TOTAL FOR 3 PASSES
         LI,R6    0                 BATCH LOOP
         LI,D1    BSUMLOC           TO GET SPEC VALUE
         LI,SR3   SHRBSUMPTR
         LW,R4    *SR3,R3
CHKVALS  LW,D3    *D1,R5
         BGEZ     %+2
         LW,D3    D4               DEFLT SUM AS TOT-OK FOR CORE
         CW,D3    D4
         BLE      %+3
         BAL,SR4  ERR6
         LW,D3    D4                DEFAULT SUM TO TOT
         STH,D3   *R4,R2            STORE SUM
         STW,D3   D4
         AI,D1    1
         AI,SR3   1
         LW,R4    *SR3,R3
         LW,D3    *D1,R5
         BGEZ     CFVAL
MAXDEF   CI,SR2   0
         BEZ      %+6
         LB,D3    *R4,R2
         CW,D3    D4
         BLE      CFVAL+4
         LW,D3    D4
         B        CFVAL
         LW,D3    D4                DEFAULT MAX TO SUM FOR BATCH
         BEZ      CFVAL
         CI,R6    0                 SUM-1 FOR ON-LINE,GHOST
*                                   CORE IS FROM TABLE
         BE       CFVAL
         AI,D3    -1
         BNEZ     %+2
         LI,D3    1
CFVAL    CW,D3    D4
         BLE      %+3
         BAL,SR4  ERR7
         B        MAXDEF
         STB,D3   *R4,R2            STORE MAX
         STW,D3   D4
         AI,D1    1
         AI,SR3   1
         LW,R4    *SR3,R3
         LW,D3    *D1,R5
         BGEZ     CFDEF
DFDEF    CI,SR2   0                 DEFAULTING CORE ?
         BNEZ     %+5               YES
         CI,R6    2                 BATCH , ONLINE ?
         BGE      CFDEF-1           NO, GHOST IS DEF. TO MAX
         STW,SR2  D3                YES DEFAULT IS 0
         B        CFDEF             GO CHECK VALUE
         LB,D3    *R4,R2            CORE DEFAULT FROM TBLE
         CW,D3    D4                IS IT VALID
         BLE      CFDEF+4           YES
         LW,D3    D4                GET MAX FOR DEFAULT
CFDEF    CW,D3    D4
         BLE      %+3
         BAL,SR4  ERR8
         B        DFDEF             MAX
         CI,R6    2                 ABOUT TO STORE IN SB:RGDF
         BNE      CONTINUE          BRANCH IF NOT
         CI,R2    2                 IS IT THE 9T OR 7T SLOT
         BNE      CONTINUE          BRANCH IF NOT
         CI,D3    0                 WILL NEED TO CHANGE GDEF TO AT
         BNE      CONTINUE          LEAST 1 IF USER SAID GDEF = 0
         PSW,D3   *R0
         LB,D3    TYPFOUND,R2
         CB,D3    TYPS,R2           IS IT A 9T TAPE
         BE       %+3               BRANCH IF SO
         CI,D3    X'A'              IS IT A 7T TAPE
         BNE      PULLD3            BRANCH IF NEITHER ONE
         LW,D3    *R0
         MTW,1    *D3
         LI,D3    ERR1
         BAL,SR4  LOGIT
PULLD3   PLW,D3   *R0
CONTINUE EQU      %
         STB,D3   *R4,R2
         LW,D4    SR1
         AI,D1    1
         AI,SR3   1
         LW,R4    *SR3,R3
         AI,R6    1
         CI,R6    2
         BLE      CHKVALS
RETURN   EQU      %
         CW,R5    BFSTACK
         BL       LOOP-1
         B        BUILD
FND      EQU      %
         CW,R2    STANDNO
         BG       ERR9              RESOURCE REPEATED IGNORE RESORCE
         MTH,1    STDS,R2           HAS THERE BEEN ANOTHER OF THE STD 4
         BGZ      ERR9              YES
         LB,R1    TYPFOUND,R2       GET DEFAULT STANDARD FOUND TYPE
         CI,R1    1
         BG       DEVRES            TAPES,SP DONE AS OTHERS
         LW,D3    SHRTOTPTR,R3      SET UP FOR PROCESSING CORE
         LI,SR2   1
         B        DEVRES+1
         PAGE
         PZE      ERRORWRITE+1      ERROR RTN FOR COREALLOC, MODGEN
BUILD    LI,D1    24                REFDEF SIZE
         LI,D2    -1
         BAL,SR4  COREALLOC
*        SR1 HAS DATA RECORD ADDRESS
         LW,D2    #RATS,R3          COMPUTE LDEV CONSTANT
         AI,D2    1                 (DEVICES+1+#RATS+1)
         AW,D2    DCTSIZE,R3        TO BE ADDED TO LDEV INDEX
         STW,D2   LDVCONST,R3
         LW,D1    #RATS,R3          CREATE ABS. DEF OF #RATS
         BAL,10   MODGEN
         TEXTC    'SV:RSIZ0'
         TEXTC    'SH:RNM1'         RELOC. DEF OF RAT TABLE
         STW,SR1  SR2
         AI,D1    1+1               FOR 0 ENTRY & FOR SHIFT TO #WORDS (HW)
         SLS,D1   -1
         AW,SR1   D1
         TEXTC    'E2'
         B        %+1               INSURE ADEQUATE SPACE
         STW,D1   HWTBSIZE
         LW,R1    #RATS,R3
         LW,D1    RATPTR,R3         MOVE RAT TABLE
         LH,D2    *D1,R1
         STH,D2   *SR2,R1
         BDR,R1   %-2
         LI,D3    SGRNT
         BAL,SR4  WRITELM
         PAGE
         LI,D1    12
         LI,D2    -1
         BAL,SR4  COREALLOC
         LW,D1    #RATS,R3
         AI,D1    1+3               FOR 0+3 FOR SHIFT TO # WDS (BYTES)
         SLS,D1   -2
         STW,D1   BYTBSIZE
         STW,SR1  SR2
         BAL,10   MODGEN
         TEXTC    'SB:RTY1'
         AW,SR1   D1
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         B        %+1
         LW,D1    SBRTYPTR,R3
         LW,R1    #RATS,R3
         LB,D2    *D1,R1
         STB,D2   *SR2,R1
         BDR,R1   %-2
         LB,D2    *D1
         STB,D2   *SR2
         LI,D3    SGRTY
         BAL,SR4  WRITELM
         PAGE
         LI,D1    150
         LI,D2    -1
         BAL,SR4  COREALLOC
         STW,SR1  SR2               SAVE START OF TABLES
         BAL,10   MODGEN
         TEXTC    'SH:RTOT1'
         AW,SR1   HWTBSIZE
         TEXTC    'SH:RBSUM1'
         AW,SR1   HWTBSIZE
         TEXTC    'SB:RBMX1'
         AW,SR1   BYTBSIZE
         TEXTC    'SB:RBDF1'
         AW,SR1   BYTBSIZE
         TEXTC    'SH:RBCU1'
         AW,SR1   HWTBSIZE
         TEXTC    'SH:ROSUM1'
         AW,SR1   HWTBSIZE
         TEXTC    'SB:ROMX1'
         AW,SR1   BYTBSIZE
         TEXTC    'SB:RODF1'
         AW,SR1   BYTBSIZE
         TEXTC    'SH:ROCU1'
         AW,SR1   HWTBSIZE
         TEXTC    'SH:RGSUM1'
         AW,SR1   HWTBSIZE
         TEXTC    'SB:RGMX1'
         AW,SR1   BYTBSIZE
         TEXTC    'SB:RGDF1'
         AW,SR1   BYTBSIZE
         TEXTC    'SH:RGCU1'
         AW,SR1   HWTBSIZE
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         AI,SR1   -1
         B        %+1
         LI,D1    3                 COUNTER CONTROL
         LI,D2    2
         LI,D3    SHRTOTPTR
BGLP     LW,SR3   *D3,R3            GET ADDRESS OF TABLE FOR MOVING
         LW,R1    #RATS,R3          # ENTRIES
         LH,D4    *SR3,R1           GET ENTRY
         STH,D4   *SR2,R1           STORE
         BDR,R1   %-2               ALL MOVED 1 TABLE
         AI,D3    1                 YES, INCREMENT TO NEXT TABLE PTR
         AW,SR2   HWTBSIZE          INCREMENT TO SET TABLE
         BDR,D2   BGLP              ALL DONE HW MOVES
         LI,D2    2                 # BYTE TABLES (MAX DF)
BYLP     LW,SR3   *D3,R3            STARTING ADDRESS
         LW,R1    #RATS,R3
         LB,D4    *SR3,R1
         STB,D4   *SR2,R1
         BDR,R1   %-2
         AI,D3    1
         AW,SR2   BYTBSIZE
         BDR,D2   BYLP
         AW,SR2   HWTBSIZE          INCREMENT PAST CU TABLE
         LI,D2    1                 HW LOOP NOW 1
         BDR,D1   BGLP
         LW,R1    #RATS,R3
         LW,D3    STANDNO
         STH,D3   R1                LEFT-HALF = STAND# OF RESOURCES
         STW,R1   #RATS,R3          RT-HALF   = TOTAL# OF RESOURCES
         LI,D3    SGRCT
ERRORWRITE BAL,SR4 WRITELM
         LW,R1    =X'09000001'      RELEASE EXTRA PAGE
         CAL1,8   R1
         LI,D1    -#DYNAM
         MSP,D1   *R0               CLEAN UP SYNTAX
         CW,R5    *R0               STACK
         BL       %-2
         LI,R1    -STACKEND         CLEAN UP PTR STACK
         AI,R1    P2DYNEND
         MSP,R1   *R0
         B        READSTRG
         PAGE
*
ERR2     EQU      %
         PSW,D3   *R0
         LI,D3    ERR2M
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         PLW,D3   *R0
         B        BUILD
ERR2M    TEXTC    '*** TOO MANY RESOURCES ONLY 1ST 15 USED'
ERR1     TEXTC    '***SYSGEN DEFAULTED ONE TAPE GDEF RESOURCE',;
                  ' TO 1.'
*
ERR3     EQU      %
         AND,D2   =X'0000FFFF'
         OR,D2    =X'40400000'
         STW,D2   ERR3M+1
         LW,D2    D3
         LI,D3    ERR3M
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         LW,D3    D2
         B        RETURN
ERR3M    TEXTC    '***XXXX A SYMBIONT DEVICE RESOURCE IGNORED'
*
ERR4     EQU      %
         AND,D2   =X'0000FFFF'
         OR,D2    =X'40400000'
         STW,D2   ERR4M+1
         LW,D2    D3
         LI,D3    ERR4M
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         LW,D3    D2
         B        RETURN
ERR4M    TEXTC    '***XXXX TOTAL MISSING, RESOURCE IGNORED'
*
ERR5     EQU      %
         PSW,D3   *R0
         LI,D3    ERR5M
         LH,D4    *D3,R1
         LW,R7    D3
         B        ERRPRINT
ERR5M    TEXTC    '***XXXX TOTAL > #DEFINED ON SYSTEM -',;
                  ' #DEFINED USED'
ERRPRINT EQU      %
         PSW,SR4  *R0
         AND,D2   =X'0000FFFF'
         OR,D2    =X'40400000'
         STW,D2   1,R7
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         PLW,SR4  *R0
         PLW,D3   *R0
         B        *SR4
ERR6     EQU      %
         PSW,D3   *R0
         LI,D3    ERR6M
ERRFIX   LCI      2
         PSM,SR1  *R0
         LD,SR1   ERRTYPE,R6        GET TYPE (B,O,G) FOR MESSAGE
         LW,R7    D3
         STW,SR1  3,R7
         STW,SR2  4,R7
         LCI      2
         PLM,SR1  *R0
         B        ERRPRINT
ERR6M    TEXTC    '***XXXX    XXXXXXXX SUM>TOTAL-OPTION DEFAULTED'
ERR7     EQU      %
         PSW,D3   *R0
         LI,D3    ERR7M
         B        ERRFIX
ERR7M    TEXTC    '***XXXX    XXXXXXXX MAX>SUM-OPTION DEFAULTED'
ERR8     EQU      %
         PSW,D3   *R0
         LI,D3    ERR8M
         B        ERRFIX
ERR8M    TEXTC    '***XXXX    XXXXXXXX DEFAULT>MAX-OPTION DEFAULTED'
ERR8A    EQU      %
         PSW,D3   *R0
         LI,D3    ERR8AM
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         PLW,D3   *R0
         B        RETURN
ERR8AM   TEXTC    '*** NO INVALID RESOURCE-RESOURCE IGNORED'
ERR9     EQU      %
         AND,D2   =X'0000FFFF'
         OR,D2    =X'40400000'
         STW,D2   ERR9M+1
         PSW,D3   *R0
         LI,D3    ERR9M
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         PLW,D3   *R0
         B        RETURN
ERR9M    TEXTC    '***XXXX RESOURCE ALREADY DEFINED OPTION IGNORED'
ERR10    EXU      ERR9
         EXU      ERR9+1
         STW,D2   ERR10M+1
         PSW,D3   *R0
         LI,D3    ERR10M
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         PLW,D3   *R0
         B        RETURN
ERR10M   TEXTC    '***XXXX RESOURCE UNDEFINED AMONG DEVICES'
         PAGE
BFSTACK  DATA     0
STDS     DATA,2   0,-1,-1,-1,-1,-1  MAX OF 5 STAND. RESOURCES
*                                   THESE ARE: NULL,CO,9T,7T,SP,MC
         BOUND    4
SGRNT    TEXTC    'SG:RNT'
SGRTY    TEXTC    'SG:RTY'
HWTBSIZE DATA     0
BYTBSIZE DATA     0
SGRCT    TEXTC    'SG:RCT'
RATDEFS  DATA,2   0,'CO','9T','7T','SP','MC'
TYPFOUND DATA,1   0,1,0,0,0,0       INDEX OF     STAND TYPES FOUND
         BOUND    4
STANDNO  DATA     0                 MAY HAVE A VALUE BETWEEN 2 AND 5
*                                   IS PRESENT IN SET OF DEVICES
TYPS     DATA,1   0,1,9,10          NULL,CO,9T,7T
TYPS2    DATA,1   X'C',X'13'        FIRST BYTE MAY BE FILLED IN BY
*                                   ACTUAL FIRST DP DEVICE NDX, 2ND
*                                   BYTE = MC DEVICE INDEX
         BOUND    8
ERRTYPE  TEXT     'BATCH'
         TEXT     'ONLINE'
         TEXT     'GHOST'
YD5D6    DATA     X'D5D60000'       NO
YC4D7    DATA     X'C4D70000'       DP
DPNAME   DATA     0                 TO BE FILLED IN WITH 1ST DP 'YY'
SPDF     DATA     X'FFFFE2D7'       SP
YD4C3    DATA     X'D4C30000'       MC
         END

