         PAGE
R0       EQU      0
R1       EQU      1
VERSION  EQU      2                 1=BPM, 2=UTS
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
         TITLE    'ERROR'
         SYSTEM   SIG7
ERROR    DSECT    1
*
* ERROR FLAG
*
* INPUT
*        R1       ERROR TO BE FLAGGED
* OUTPUT
*        ERRFLAG  ERROR FLAG BUFFER
*        D2       MAXIMUM ERROR SEVERITY
*                    (1-WARNING, 2-TERM EXEC, 3-TERM EDIT AND EXEC)
*
*
         REF      CMBXDIFF,ERRFLAG,IOERR
         REF      CMBX
         REF      CMBXHLD
         REF      J:JIT,TERM
         REF      PRNTBUF
*
         USECT    ERROR
         LCI      2
         PSM,R2   *R7
*
         LB,R2    SEVERE,R1         UPDATE MAX SEVERITY
         CW,R2    D2
         BLE      %+2
         STW,R2   D2
         CI,R1    0                 I/O ERROR
         BNE      TST%MODE     NO
         STW,SR3  IOERR,R7          SAVE I/O ERROR CODE AND SUBCODE
         LB,R2    SR3
         CI,R2    X'49'
         BNE      TST%MODE
         LI,R2    4            SET PCL ABORT CODE.
         STW,R2   D2
TST%MODE EQU      %
*
         LW,R2    CMBX,R7
         MTW,0    J:JIT
         BLZ      ERR1              ON-LINE MODE
         LW,R3    TERM,R7
         CI,R3    X'15'             END OF CARD IN BATCH MODE
         BNE      ERR1              NO
         LI,R3    ' '
         AI,R2    -1                BACK UP CMBX TO LAST NON-BLANK
         CB,R3    *R7,R2
         BE       %-2
         AI,R2    2
         STW,R2   CMBX,R7
ERR1     EQU      %
         CI,R2    PRNTBUF+PRNTBUF+PRNTBUF+PRNTBUF
         BGE      ERR2              COPYSTD - DONT FLAG
         CW,R2    CMBXHLD,R7
         BE       RETURN            BLANK PCL COMMAND.
         AI,R2    -CMBXDIFF-1       % SIGN ADDRESS OF PCL COMMAND JUST IN ERROR-
         LI,R3    '%'
         CB,R3    *R7,R2            ERROR ALL READY REPORTED
         BE       RETURN            YES
         STB,R3   *R7,R2            NO-SET POSITION OF ERROR
*
ERR2     EQU      %
         CI,R1    0                 BATCH I/O ERROR
         BE       RETURN            YES
*
         LW,R2    ERRFLAG,R7
         CI,R2    9                 ROOM FOR ERROR KEY
         BE       RETURN            NO-CAN NOT REPORT
         AI,R2    1
         STW,R2   ERRFLAG,R7        COUNT THIS ERROR MESSAGE KEY
         DO       VERSION=2
         MI,R1    100
         AW,R1    KEYCONST          MAKE ERROR FILE KEY FROM PCL ER CODE
         FIN
         AW,R2    R7                PUT ADDRESS OF DATA PAGE
         STW,R1   ERRFLAG,R2
         B        RETURN
*
KEYCONST DATA     X'03010000'       EDIT KEY FORMAT
         PAGE
RETURN   LCI      2
         PLM,R2   *R7               RESTORE REGISTERS
         B        *SR4              RETURN
*
*                 I 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
*                 O 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
*
SEVERE   DATA,1   2,2,2,2,2,2,2,2,3,2,2,2,1,2,3,3
*                 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
*                 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
*
         DATA,1   3,3,2,3,3,2,2,2,2,2,2,2,2,1,1,2
*                 3 3 3 3 3 3 3 3 4 4 4 4
*                 2 3 4 5 6 7 8 9 0 1 2 3
*
         DATA,1   3,3,3,3,3,3,3,3,3,2,3,3
*                 4 4 4 4 4 4 5 5 5 5 5 5
*                 4 5 6 7 8 9 0 1 2 3 4 5
*
         DATA,1   3,3,3,2,1,2,1,1,2,3,3,3
*                 5 5 5 5
*                 6 7 8 9
*
         DATA,1   3,3,3,3
         END

