         SYSTEM   BPM
         SYSTEM   SIG9
         SYSTEM   FORTLIB
         REF      M:UI,M:SI,F:117
         REF      9SETN,9ASGOTO,9SET2
         DEF      FASTREAD,V#FASTREAD,FASTWRIT
FASTREAD CSECT    1
         LI,ND    6
         BAL,LL   9SETN
         INTG     DCBNUM
         CHAR     LINE
         INTG     FILEKEY
         INTG     LINEX
         INTG     LINEND
         EVRY     ALTRET
         STW,LC   RETURN
         LW,X1    LINE
         OR,X1    L(140**24)
         MBS,0    BA(L('    '))
         LW,X1    *DCBNUM
         LI,X2    M:UI
         CI,X1    104
         BE       $+2
         LI,X2    M:SI
         LW,X3    LINE
         SLS,X3   -2
         LI,X4    X'3'
         AND,X4   LINE
         M:READ   *X2,(BUF,*X3),(BTD,*X4),(SIZE,140),(ABN,READERR)
         LW,X3    4,X2
         SLS,X3   -17
         LI,X4    ' '
         AW,X3    LINE
         AI,X3    -1
         CB,X4    0,X3
         BLE      $+2
         STB,X4   0,X3
         LW,X1    LINE
         OR,X1    L(140**24)
         CBS,0    BA(L('    '))
         BNE      GOTFIRST
         LW,X1    X3
GOTFIRST AND,X1   L(X'00FFFFFF')
         CW,X3    X1
         BE       GOTLAST
         CB,X4    0,X3
         BNE      GOTLAST
         AI,X3    -1
         B        GOTFIRST+1
GOTLAST  SW,X3    LINE
         SW,X1    LINE
         AI,X3    2
         AI,X1    1
         STW,X3   *LINEND
         STW,X1   *LINEX
         LI,X3    0
         LI,X1    X'F'
         AND,X1   0,X2
         CI,X1    1
         BNE      SETKEY
         LI,X1    X'70'
         AND,X1   5,X2
         CI,X1    X'20'
         BNE      SETKEY
         LW,X1    10,X2
         LW,X3    0,X1
         AND,X3   L(X'FFFFFF')
SETKEY   STW,X3   *FILEKEY
         B        *RETURN
READERR  LW,X7    ALTRET
         BAL,LL   9ASGOTO
         PAGE
FASTWRIT  NOP
         BAL,LL   9SET2
         INTG     FILEKEY
         CHAR     LINE
         LW,X1    LINE
         SLS,X1   -2
         LI,X2    X'3'
         AND,X2   LINE
         LW,X4    *FILEKEY
         OR,X4    L(X'03000000')
         STW,X4   FILEKEY
         M:WRITE  F:117,(BUF,*X1),(BTD,*X2),(SIZE,*LINE+1),(WAIT),;
                  (KEY,FILEKEY),(NEWKEY)
         B        *LC
V#FASTREAD CSECT  0
         RES      1
DCBNUM   RES      2
LINE     RES      2
         DATA     0                 IMPLICIT LENGTH
         RES      1
FILEKEY  RES      2
LINEX    RES      2
LINEND   RES      2
ALTRET   RES      1
RETURN   RES      1
         END
