PCL      DSECT    1
PLSECT   CSECT    1
         PAGE
VERSION  EQU      2                 1=BPM,2=UTS
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
         TITLE    'PCL'
         SYSTEM   SIG7
         SYSTEM   BPM
*
* PCL             PCL EXECUTIVE
*
* INPUT
*        ARGBUF   ARGUMENT BUFFER
*        NCHAR    LENGTH OF CURRENT ARGUMENT
*        TERM     TERMINATOR OF CURRENT ARGUMENT
*        D2       MAXIMUM ERROR SEVERITY
*        PCL CONTRL COMMANDS FROM TTYS OR CR
*       R0        ZERO REGISTER
* OUTPUT
*        D1       CURRENT ACTION CODE
*        PREVACT  PREVIOUS ACTION COD%
*        CMDBUF   CONTROL COMMAND BUFFER
*        CMBX     -CMDBUF- INDEX OF FIRST ARGUMENT
*        MAXCMBX  MAXIMUM -CMDBUF- INDEX
*        DIAGADD  INITIALIZED DIAGNOSTIC ADDRESS
*        CALL TO APPROPRIATE COMMAND PROCESSOR
*
*
         DEF      TRANSACT
         DEF      RSTACK
         DEF      CMDBUF,CMBX,MAXCMBX
         DEF      ARGBUFF,NCHAR,TERM
         DEF      ARGTBL,DEVICE,FILE,CODE,MODE,SEQUENCE,SELECT
         DEF      DVLARG,TOSWT
         DEF      PRTBUF,ERRFLAG,IOERR
         DEF      DCBADD,INSWT,IOBUF,NPAGE,OPNFPT,PREVACT
         DEF      TOARG,RDFPT,WRTFPT,FPARAM
         DEF      ARGBUF4,PRTBUF4,ERRFLG4
         DEF      TOVER
         DEF      PRNTBUF,RECNUM
         DEF      FPTCONSL
         DEF      ERCMDBUF,CMBXDIFF
         DEF      TLABEL,SYNFLAG
         DEF      BUFSIZE
         DO1      VERSION=2
         DEF      FPTPROMT
         DEF      SAVCMBX
         DEF      ATTRB,RDACCT,WRTACCT,TLBLSIZE
         DEF      #DELIM
         DEF      CIBUSED,CIBLEFT,CIBTOTAL,CIWORD,RECSIZE,CISEQ
         DEF      COBUSED,COBLEFT,COWORD
         DEF      KEY,CARDSEQ
         DEF      TABSET
         DEF      RSSAVE
         DEF      SYNONYM
         DEF      COPYSTDF,STRDFPT
         DEF      LINENO
         DEF      SFARG,SFCNT,SFACCT
         DEF      SFDEV,EATTRB,COPYSK,DATETBL
         DEF      RDTBL,WRTBL
         DEF      EXTBL,UNTBL
         DEF      EXACCT,UNACCT
         DEF      LINE%NO,LINE%NO1
         DEF      LINE%NO2
         DEF      DENSITY
         DEF      DEL%CT
         DEF      FROMFILE,TOFILE,REVIEW,DELETEF
         DEF      SFTEMP
         DEF      SCRATCH
         DEF      GRANCNT
         DEF      SEQNUM
         DEF      COPYPHY
         DEF      FROMCMBX
         DEF      LISTCMBX,LISTTERM
         DEF      ANSBLK
         DEF      BLKBUFF
         DEF      BLKSIZE
         DEF      UNBADR
         DEF      CONTINUE
         DEF      EXPIRE
         DEF      IN%ARG,OUT%ARG
         DEF      DEV%IN,DEV%OUT
         DEF      DEV%SAV
         DEF      DEV%SAV1     SIDR# PRE7-0744
         DEF      CMBXHLD      SIDR#SIG7-11335
*
         REF      GETARG,ERROR,PRTERR,COPYTO,FIXARG
         REF      COPYALL
         REF      M:EI
         REF      M:SI,M:UC,M:LO
         DO1      VERSION=2
         REF      J:JIT
         DO1      VERSION=1
         DEF      J:JIT
         REF      DELETEAL,DELETE,LIST
         DO1      VERSION=2
         REF      J:CCBUF
         REF      REW,SPF,SPE,WEOF
         REF      INTARG
         REF      UNPRINT
         REF      ADDFILEN
         DO1      VERSION=2
         REF      REVRP,LIST26
         REF      M:DO
         REF      M:LL
         REF      DEVTRAN
*
*
         USECT    PCL
         CAL1,8   FPTGP
         USECT    PLSECT
         DO1      VERSION=2
FPTGP    DATA     X'08000002'       REQUEST 2 PAGES
         DO1      VERSION=1
FPTGP    DATA     X'08000100'       REQUEST ALL OF MEMORY
         USECT    PCL
         CI,SR1   2                 MUST HAVE AT LEAST 2 PAGES
         BGE      BASEREG           OK
         CAL1,1   PGMSG             PRINT MESSAGE INDICATING CORE LIMIT TOO LOW.
         USECT    PLSECT
PGMSG    GEN,8,7,17   X'11',0,M:UC
         DATA     X'34000000'
         DATA     %+3
         DATA     49
         DATA     0
         TEXT     ' PCL CANNOT EXECUTE '
         TEXT     'UNTIL CORE LIMIT IS INCREASED'
         USECT    PCL
         M:ERR
*
BASEREG  LW,R7    SR2               DEFINE BASE REGISTER
*
         LI,R1    511               CLEAR USER STORAGE
         LI,R0    0
         STW,R0   *R7,R1
         BDR,R1   %-1
         SLS,SR1  11                CONVERT PAGES TO BYTES
         AI,SR1   -2048             RESERVE PAGE FOR DATA
         STW,SR1  BUFSIZE,R7        INITIALIZE I/O BUFFER SIZE
         LI,R1    STACK             SET UP STACK POINTER
         STW,R1   0,R7
         LW,R1    =X'01360000'      SPACE COUNT 310 WORDS
         STW,R1   1,R7
*
         DO       VERSION=2
         LI,R1    4*CONTINUE
         STW,R1   CONTPTR,R7   INITIALIZE CONTINUATION PTR
         MTW,0    J:JIT             ONLINE MODE
         BGEZ     NXCMD             NO-READ FIRST COMMAND
         LW,R0    R7                YES-SET BREAK CONTROL
         CAL1,8   FPTINT
         USECT    PLSECT
FPTINT   GEN,8,7,17      X'0E',0,INT
         USECT    PCL
         LI,R0    0                 RESTORE R0
         CAL1,1   FPTPROMT          SET PROMT CHAR
         USECT    PLSECT
FPTPROMT GEN,8,16,8      X'2C',0,'<'
         USECT    PCL
*
         LW,R2    M:UC+4
         SLS,R2   -17
         LI,R4    CMDBUF
         AW,R4    R7                ADDRESS OF CMDBUF
         LW,R1    R2
         LW,R5    R2                SAVE LENGTH
         AI,R1    -2                DONT COPY OD CHAR
         BLZ      PCL3
         LB,R3    J:CCBUF,R1
         STB,R3   *R4,R1
         BDR,R1   %-2               COPY TELL COMMAND TO CMDBUF
         LB,R3    J:CCBUF
         STB,R3   *R4               COPY FIRST BYTE OF TEL COMMAND
         AI,R2    4*CMDBUF-1
         STW,R2   MAXCMBX,R7        MAX COMMAND BUFFER INDEX
         LI,R2    4*CMDBUF
         STW,R2   CMBX,R7           INITIALIZE COMMAND BUFFER INDEX
         STW,R2   CMBXHLD,R7     SAVE INITIAL VALUE OF CMBX.
         LI,D2    0                 CLEAR MAXIMUN SEVERITY
         LI,R1    ERCMDBUF-1
         AW,R1    R7
         LI,R2    35
         LW,R3    ='    '
         STW,R3   *R1,R2            BLANK COMMAND LINE ERROR POINTER
         BDR,R2   %-1
         LW,R4    R5                GET LINE LENGTH
         BAL,SR4  CONTCHK           TEST FOR CONTINUATION LINE
         B        PCL88             CONTINUED LINE RETURN
         NOP                        LAST OF CONTINUATION
         NOP                        ERROR RETURN
PCL82    EQU      %
         BAL,SR4  TRANSACT          GO TRANSLATE FIRST VERB
         CI,D1    5                 TEL LIST COMMAND
         BE       PCL8              YES
         CI,D1    3                 TEL DELETE COMMAND
         BE       PCL8              YES
         CI,D1    2                 TEL COPY COMMAND
         BNE      PCL3              NO - READ FIRST COMMAND
PCL8     EQU      %
         BAL,SR4  ACTION            GO-DO THE COMMAND
         CI,D2    1                 TEST ERR SEVERITY LEVEL
         BLE      %+2               NO MESSAGES TO PRINT
         BAL,SR4  PRTERR            YES-PRINT THE MESSAGES
         B        ENDPCL       CLOSE DCBS BEFORE RETURN TO TEL.
PCL88    MTW,1    TELCONT,R7        SET FLAG FOR TEL CONTINUATION
         B        NXCMD             GET NEXT LINE
*
PCL3     CAL1,1   FPTHERE           PRINT 'PCL HERE'
         USECT    PLSECT
FPTHERE  GEN,8,7,17      X'11',0,M:UC
         DATA     X'34000000'
         DATA     %+3
         DATA     13
         DATA     0
         TEXT     'PCL '
         TEXT     'C00 '
         TEXT     'HERE
'
         USECT    PCL
         FIN
*
NXCMD    LW,R1    R7                READ NEXT COMMAND
         AI,R1    CMDBUF
         LI,R6    M:SI
NXCMD1   EQU      %
         CAL1,1   FPTCONSL          READ COMMAND
         USECT    PLSECT
FPTCONSL GEN,8,7,17      X'90',0,R6
         DATA     X'F4000010'
         DATA     TERMPCL           TERMINATE ON ERROR
         DATA     TERMPCL           TERMINATE ON ABNORMAL
         PZE      *R1
         DATA     140               SIZE
         DATA     0                 NO BYTE DISPLACEMENT
         USECT    PCL
         STW,R0   BREAK             CLEAR BREAK
         LW,R2    M:SI+4
         SLS,R2   -17               GET COUNT
         MTW,0    J:JIT             BATCH MODE
         BLZ      PCL1              NO
         CI,R2    120               BINARY CARD READ
         BE       NXCMD1            YES-SKIP IT
         LW,R3    *R1
         CW,R3    =' PCL'
         BE       NXCMD             BATCH PCL COMMAND
         CAL1,1   FPTCOMD           PRINT THE BATCH COMMAND
         USECT    PLSECT
FPTCOMD  GEN,8,7,17      X'11',0,M:LL
         DATA     X'34000010'
         PZE      *R1
         PZE      *R2               SIZE
         DATA     0                 NO BYTE DISPLACEMENT
         USECT    PCL
         CAL1,1   FPTCOMP           COMPARE M:LL AND M:LO
         USECT    PLSECT
FPTCOMP  GEN,8,7,17      X'2B',0,M:LL
         GEN,15,17             0,M:LO
         USECT    PCL
         CI,SR1   1                 SAME DEVICE
         BE       PCL5              YES
         CAL1,1   FPTCOMD1          NO-PRINT COMMAND AGAIN ON M:LO
         USECT    PLSECT
FPTCOMD1 GEN,8,7,17      X'11',0,M:LO
         DATA     X'34000010'
         PZE      *R1               BUFFER
         PZE      *R2               SIZE
         DATA     0                 NO BYTE OFF SET
         DO       VERSION=2
FPTCOMP2 GEN,8,24 X'2B',M:UC
         DATA     M:SI
FPTCOMD2 GEN,8,24 X'11',M:UC
         DATA     X'34000010'
         PZE      *R1
         PZE      *R2
         DATA     0
FPTCOMD3 GEN,8,24 X'11',M:UC
         DATA     X'34000010'
         DATA     FPTPROMT
         DATA     1
         DATA     3
         FIN
         USECT    PCL
PCL5     EQU      %
         AI,R2    1
         CI,R2    73
         BLE      PCL4
         LI,R2    73                CHARS/CARD PLUS ONE
         B        PCL4
*
PCL1     EQU      %
         DO       VERSION=2
         CAL1,1   FPTCOMP2          COMPARE M:UC AND M:SI
         CI,SR1   1
         BE       PCL4              SAME DEVICE
         LI,R4    CMDBUF
         AW,R4    R7
         SLS,R4   2                 BYTE ADDRESS OF COMMAND BUFFER
         AW,R4    R2
         AI,R4    -1                GET LOC OF LAST CHAR
         LB,R3    0,R4
         CI,R3    X'15'             TEST IF LAST CHAR IS CR
         BE       PCL7              YES
         CI,R3    X'0D'
         BE       PCL7              YES
         AI,R4    1
         LI,R3    X'15'
         STB,R3   0,R4              SET CARRIAGE RETURN IN LINE
         AI,R2    1
PCL7     EQU      %
         CAL1,1   FPTCOMD3          WRITE PROMPT
         CAL1,1   FPTCOMD2          PRINT COMMAND TO UC
         FIN
PCL4     EQU      %
         LW,R4    R2                SAVE STMT LENGTH
         AI,R2    4*CMDBUF-1        MAX COMMAND BUFFER INDEX
         STW,R2   MAXCMBX,R7
*
         LI,R2    4*CMDBUF          INITIALIZE COMMAND BUFFER INDEX
         STW,R2   CMBX,R7
         STW,R2   CMBXHLD,R7   SAVE INITIAL VALUE OF CMBX.
         STW,R0   ERRFLAG,R7        CLEAR ERROR FLAGS
         STW,R0   IOERR,R7          CLEAR I/O ERROR FLAG
         LI,D2    0                 CLEAR MAXIMUM SEVERITY
         LI,R1    ERCMDBUF-1
         AW,R1    R7
         LI,R2    35
         LW,R3    ='    '
         STW,R3   *R1,R2
         BDR,R2   %-1               BLANK COMMAND LINE ERROR POINTER
*
         BAL,SR4  CONTCHK           TEST FOR CONTINUATION
         B        NXCMD             CONTINUED LINE RETURN
         B        PCL42             LAST OF CONTINUATION
         B        ENDCMD1           ERROR RETURN
PCL42    EQU      %                 NORMAL RETURN
         MTW,0    TELCONT,R7        WAS TEL CMD CONTINUED
         BNEZ     PCL82             YES-GO PROCESS
         BAL,SR4  TRANSACT          TRANSLATE COMMAND ACTION VERB
         CI,D1    0                 TEST FOR ERROR RETURN
         BNE      PCL2              NO-DO THE COMMAND
PCL6     EQU      %
         LI,R1    18                ERROR-ILLEGAL ACTION VERB
         BAL,SR4  ERROR
         B        ENDCMD1
PCL2     BAL,SR4  ACTION            GO-DO THE COMMAND
         DO       VERSION=2
         MTW,-1   BREAK             BREAK SET
         BLEZ     ENDCMD1           NO
         LI,R2    2
         MTB,0    M:EI+22,R2        FILE NAME TO PRINT
         BEZ      ENDCMD1           NO
         CAL1,1   FPTFILHD          PRINT 'LAST FILE COPYED'
         USECT    PLSECT
FPTFILHD GEN,8,7,17      X'11',0,M:UC
         DATA     X'34000000'
         DATA     %+3
         DATA     17
         DATA     0
         TEXT     'LAST FILE NAME = '
         USECT    PCL
         LI,D3    FPARAM
         AW,D3    R7                BUFFER ADDRESS
         LI,R1    M:EI+23
         BAL,SR4  UNPRINT           MOVE FILE NAME TO BUFFER
         AI,R2    1
         LI,R3    X'15'
         STB,R3   *D3,R2
         CAL1,1   FPTFILNM          PRIN FILE NAME
         USECT    PLSECT
FPTFILNM GEN,8,7,17      X'11',0,M:UC
         DATA     X'34000010'
         PZE      *D3               BUFFER
         PZE      *R2
         DATA     1
         USECT    PCL
         FIN
ENDCMD1  CI,D2    1                 TEST ERR SEVERITY LEVEL
         BLE      NXCMD             NO MESSAGES TO PRINT
         BAL,SR4  PRTERR            YES-PRINT ERROR LINES
         CI,D2    4                 TEST IF ABORT WANTED
         BE       TERMPCL2          YES
         MTW,0    TELCONT,R7        WAS TEL CMD CONTINUED
         BEZ      NXCMD             NO-READ NEXT COMMAND
         M:EXIT                     GO BACK TO TEL
*
ACTION   EQU      %                 DO THE COMMAND
         PSW,SR4  *R7
         STW,R0   IN%ARG,R7    ZERO AREAS IN WHICH
         STW,R0   OUT%ARG,R7   SYSTEM DEVICE
         STW,R0   DEV%IN,R7    INFORMATION IS TO
         STW,R0   DEV%OUT,R7   BE STORED.
         STW,R0   COPYSTDF,R7       ZERO COPYSTD FLAG
         STW,R0   SFACCT,R7         ZERO STD FILE ACCT FLAG
         STW,R0   DENSITY,R7
         STW,R0   DEL%CT,R7
         STW,R0   RDTBL
         STW,R0   WRTBL
         STW,R0   EXTBL
         STW,R0   UNTBL
         STW,R0   FROMFILE
         STW,R0   TOFILE
         STW,R0   COPYSK
         STW,R0   COPYPHY
         STW,R0   DELETEF
         LI,R1    4
         STW,R0   ANSBLK-1,R1       ZERO ANS OPTIONS
         BDR,R1   %-1
         LW,R1    D1
         EXU      ACTTBL,R1
ENDCMD   PLW,SR4  *R7
         B        *SR4              RETURN FROM COMMAND PROCESSING
*
ACTTBL   EQU      %-1
         B        PCL6              TO - ERROR
         B        COPY1             COPY OR COPYALL
         B        DEL1              DELETE OR DELETEALL
         B        TERMPCL           END
         B        LIS               LIST
         BAL,SR4  REW               REMOVE
         BAL,SR4  REW               REW
         BAL,SR4  SPF               SPF
         BAL,SR4  SPE               SPE
         BAL,SR4  WEOF              WEOF
         B        PCL6              ON - ERROR
         B        PCL6              OVER - ERROR
         BAL,SR4  TABS              TABS
         BAL,SR4  REVIEW            REVIEW
         B        PCL6
         B        PCL6
*
COPY1    LW,R1    ARGBUFF+1,R7      TEST FOR COPYALL COMMAND
         CW,R1    =C'YALL'
         BE       COPY3             YES
         CW,R1    =C'YSTD'          TEST FOR COPYSTD
         BNE      COPY2             NO
         MTW,1    COPYSTDF,R7       SET COPYSTD FLAG
COPY3    EQU      %
         BAL,SR4  COPYALL           EDIT AND EXECUTE COPYALL COMMAND
         B        ENDCMD
COPY2    BAL,SR4  COPYTO            EDIT AND EXECUTE COPY COMMAND
         B        ENDCMD
*
DEL1     LW,R1    ARGBUFF+1,R7
         CW,R1    =C'ETEA'          DELETE
         BNE      DEL2              YES
         LW,R1    ARGBUFF+2,R7
         AND,R1   =X'FFFFFF00'
         CW,R1    =X'D3D34000'   CHECK IF REALLY DELETEALL.
         BNE      PCL6         NOT DELETEALL
         BAL,SR4  DELETEAL          NO-DELETEALL
         B        ENDCMD
DEL2     BAL,SR4  DELETE
         B        ENDCMD
*
LIS      MTW,0    J:JIT
         BGEZ     LIS2              BATCH MODE
         LI,R5    1                 SET NO TOP OF PAGE FLAG
         LH,R2    M:LO+1,R5
         BGZ      LIS5              DEVICE BIT NOT SET
         AND,R2   =X'FFFF'
         CI,R2    'LP'
         BE       LIS2
         AND,R2   =X'F00'
         CI,R2    X'600'            IS DEVICE LP
         BNE      LIS5              NO
LIS2     LI,R5    0                 SET TOP OF PAGE FLAG
         CAL1,1   TOPPAGE           TOP OF PAGE ON LINE PRINTER
         USECT    PLSECT
TOPPAGE  GEN,8,7,17      X'04',0,M:LO
         USECT    PCL
LIS5     EQU      %
         BAL,SR4  LIST              PROCESS LIST COMMAND
         AI,R5    0
         BNEZ     ENDCMD            NO TOP OF PAGE NEEDED
         CAL1,1   TOPPAGE           TOP OF PAGE ON LP
         B        ENDCMD
*
TERMPCL2 EQU      %
         LI,R4    M:LO
         LI,R3    9
         DO       VERSION=2
         MTW,0    J:JIT
         BGEZ     %+3               BATCH MODE
         LI,R4    M:UC
         LI,R3    10
         FIN
         CAL1,1   FPTABORT          PRINT ABORT MESSAGE
         B        ENDPCL
TERMPCL  EQU      %
         MTW,0    J:JIT             ONLINE
         BLZ      ENDPCL            YES
         LB,R2    TXTRMPCL          MESSAGE SIZE
         CAL1,1   FPTRMPCL          PRINT 'PCL PROCESSING TERMINATE'
         USECT    PLSECT
FPTRMPCL GEN,8,7,17     X'11',0,M:LO
         DATA     X'34000000'
         DATA     TXTRMPCL
         PZE      *R2
         DATA     1
TXTRMPCL TEXTC    'PCL PROCESSING TERMINATED'
FPTABORT GEN,8,24 X'91',R4
         DATA     X'34000000'
         DATA     TXTABORT
         PZE      *R3
         DATA     0
TXTABORT TEXT     'PCL ABOR'
         DATA     X'E3150000'
         USECT    PCL
ENDPCL   EQU      %
         LI,R2    M:LO
         BAL,SR4  CLOSDCB           CLOSE M:LO
         LI,R2    M:LL
         BAL,SR4  CLOSDCB           CLOSE M:LL
         LI,R2    M:DO
         BAL,SR4  CLOSDCB           CLOSE M:DO
         LC,R2    J:JIT
         BCS,12   %+3
         CI,D2    4
         BE       ERR%JOB
         M:EXIT
ERR%JOB  EQU      %
         M:ERR
*
CLOSDCB  LW,R1    0,R2              CLOSE DCB WHOSE ADR IS IN R2
         CW,R1    =X'00200000'
         BAZ      *SR4              NOT OPEN - EXIT
         CAL1,1   CLOSFPT
         USECT    PLSECT
CLOSFPT  GEN,8,24 X'95',R2
         DATA     X'80000000'
         DATA     2                 SAVE
         USECT    PCL
         B        *SR4              EXIT
         PAGE
*CONTCHK TESTS IF A COMMAND IS CONTINUED OR IS A CONTINUATION.
*IF NEITHER, EXIT IS TO C(SR4)+3. IF CONTINUED, EXIT IS TO C(SR4).
*IF LAST OF CONTINUATION LINES, EXIT IS TO C(SR4)+1. IF TOO MANY
*CONTINUATIONS, EXIT IS TO C(SR4)+2. LINES ARE CONCATENATED IN THE
*BUFFER BEGINNING AT LOCATION CONTINUE + C(R7).
CONTCHK  EQU      %
         LI,R2    CMDBUF
         AW,R2    R7                COMMAND BUFFER LOCATION
         AI,R4    -2                ADJUST LENGTH FOR INDEXING
         BEZ      CONT33
         BLZ      CONT4
CONT2    EQU      %
         LB,R3    *R2,R4
         CI,R3    X'40'             TEST END OF STMT
         BE       CONT3
         CI,R3    ';'               FOR PRESENCE OF CONT CHAR
         BNE      CONT4
         BAL,R6   MVSTMT            GO MOVE TO CONCAT AREA
CONT1    MTW,1    CONTMODE,R7       SET CONTINUATION MODE
         CI,D2    2                 TEST IF ERROR
         BL       *SR4              NO - RETURN
         B        CONT6             YES - TOO MANY CONT STMTS
CONT3    BDR,R4   CONT2             LOOP THROUGH STMT
CONT33   LB,R3    *R2               ONE SIGNIFICANT CHAR IN STMT
         CI,R3    ';'
         BE       CONT1
CONT4    MTW,0    CONTMODE,R7
         BNEZ     CONT5             LAST STMT OF CONT STMT
         AI,SR4   3                 NON-CONT STMT - BUMP RETURN REG
         B        *SR4
CONT5    AI,R4    2                 RESTORE STMT LENGTH
         BAL,R6   MVSTMT            GO MOVE LAST STMT
CONT6    LI,R1    4*CONTINUE
         STW,R1   CONTPTR,R7        RESET CONT STMT POINTER
         STW,R0   CONTMODE,R7       TURN OFF CONTINUATION MODE
         CI,D2    2                 TEST IF ERROR
         BGE      CONT7             YES
         AI,R3    -1
         STW,R3   MAXCMBX,R7        SET MAX CMD BUFFER INDEX
         STW,R1   CMBX,R7           CURRENT INDEX
         AI,SR4   1                 LAST STMT RETURN
         B        *SR4
CONT7    AI,SR4   2                 ERROR RETURN
         B        *SR4
*
MVSTMT   LW,R3    R7
         SLD,R2   2                 BYTW ADR OF CMDBUF
         AW,R3    CONTPTR,R7        COMPUTE ADR IN CONCAT AREA
         AWM,R4   CONTPTR,R7        BUMP FOR NEXT STMT
         SLS,R4   24                POSITION COUNT
         AW,R3    R4
         MBS,R2   0                 CONCATENATE STMT
         LW,R3    CONTPTR,R7
         CI,R3    4*IOBUF           TEST IF TOO MANY STMTS
         BLE      0,R6              NO - RETURN
         LI,R1    53                TOO MANY CONTINUATION LINES
         PSW,SR4  *R7
         BAL,SR4  ERROR             REPORT ERROR
         PLW,SR4  *R7
         B        0,R6
         PAGE
REVIEW   PSW,SR4  *R7
         MTW,1    FROMFILE          INITIALIZE FOR NULL FIELD
         MTW,1    TOFILE
         LI,R5    1                 FLAG FOR FILE NAME
         LI,R2    3
         STW,R2   SFDEV             SET DEVICE CODE FOR DC (REV CMD)
         LW,R1    TERM,R7
         CI,R1    X'40'
         BE       REVC
         CI,R1    ','
         BE       REV8              NULL FROM FIELD
         CI,R1    X'15'
         BE       REV6              END OF COMMAND
REVC     MTW,0    COPYSK
         BNEZ     REV1              NOT REVIEW COMMAND
         LW,R2    CMBX,R7
         STW,R2   SAVCMBX,R7        INDICATE DEVICE CODE OPTIONAL
         BAL,SR4  DEVTRAN           GET DEVICE CODE
         STW,R0   SAVCMBX,R7
         LI,R1    34
         LW,R2    DEVICE,R7
         BNEZ     %+2          PCL DEVICE.
         LW,R2    DEV%IN,R7    SYSTEM INPUT DEVICE.
         CI,R2    3
         BE       %+3               DC
         CI,R2    5                 TEST IF DP
         BNE      REV5+1            NO - ERROR
         STW,R2   SFDEV             SAVE DEVICE CODE
         LCI      2
         LM,R1    DEVICE+1,R7
         STM,R1   SFARG
REV1     BAL,SR4  ADDFILEN          GET FIRST FILE NAME
         CI,D2    1
         BG       REV3              ERROR
         MTW,0    NCHAR,R7
         BEZ      REV9              NULL FROM FIELD
         LCI      4
         LM,R1    ARGBUFF,R7        MOVE FILE NAME
         STM,R1   FROMFILE
         LM,R1    ARGBUFF+4,R7
         STM,R1   FROMFILE+4
         LW,R1    CMBX,R7
         STW,R1   FROMCMBX          SAVE POINTER TO END OF FIELD
REV9     LW,R1    TERM,R7
         CI,R1    ','               IS 'TO' FIELD PRESENT
         BNE      REV6              NO
REV8     BAL,SR4  ADDFILEN          GET SECOND FILE NAME
         CI,D2    1
         BG       REV3              ERROR
         MTW,0    NCHAR,R7
         BEZ      REVA              NULL 'TO' FIELD
         LCI      4
         LM,R1    ARGBUFF,R7        MOVE FILE NAME
         STM,R1   TOFILE
         LM,R1    ARGBUFF+4,R7
         STM,R1   TOFILE+4
         LB,R2    FROMFILE
         BEZ      REVA              NULL FROM FIELD
         MTW,0    COPYPHY           WAS PHY OPTION USED
         BNEZ     REVA              YES - NOT SORT ORDER
         LI,R3    1
REV7     LB,R4    FROMFILE,R3       TEST IF 'FROM' GR THAN 'TO'
         CB,R4    TOFILE,R3
         BL       REVA              OK
         BG       REV5              YES - ERROR
         AI,R3    1
         BDR,R2   REV7
REVA     EQU      %
         LW,R1    TERM,R7           GET DELIMITER
REV6     MTW,0    COPYSK
         BGZ      REV3              COPYALL
         BLZ      REVB              DELETEALL
REV4     CI,R1    X'15'
         BE       REV2              END OF STATEMENT
DELERR   LI,R1    30                INVALID DELIMITER
         BAL,SR4  ERROR
REV2     MTW,0    J:JIT
         BLZ      %+2               ONLINE MODE
         CAL1,1   TOPPAGE           DO TOP-OF-PAGE FOR BATCH
         BAL,SR4  LIST              PROCESS REVIEW COMMAND
         MTW,0    J:JIT
         BLZ      REV3              ONLINE MODE
         CAL1,1   TOPPAGE           DO TOP-OF-PAGE
REV3     PLW,SR4  *R7
         B        *SR4
REV5     LI,R1    8                 FILE RANGE SPECIFICATION INVALID
         BAL,SR4  ERROR
         B        REV3
REVB     CI,R1    X'15'
         BE       REV3              END OF COMMAND
         LI,R1    17                SYNTAX ERROR
         B        REV5+1
         PAGE
TABS     LCI      7
         PSM,R5   *R7
         LI,R5    TABSET
         AW,R5    R7                ADDRESS OF TAB TABLE
         LI,R6    0
         LI,R1    3
         STW,R6   *R5,R1            ZERO TABLE
         BDR,R1   %-1
         STW,R6   0,R5
TABS2    CI,R6    16                MORE THAN 16 TABS SPECIFIED
         BE       TABSERR2          YES
         BAL,SR4  GETARG            GET NEXT VALUE
         LI,R1    0                 MIN VALUE
         LI,R2    255               MAX VALUE
         BAL,SR4  INTARG            CONVERT TO BINARY
         AI,R2    0
         BNE      TABSERR           CONVERSION OR RANGE ERROR
         STB,R1   *R5,R6            ENTER TAB VALUE IN TABLE
         AI,R6    1                 INCREMENT TAB COUNT
         LW,R1    TERM,R7
         CI,R1    ','
         BE       TABS2             ANOTHER VALUE
         CI,R1    X'15'
         BE       TABSEND           END OF COMMAND
         LI,R1    17                DELIMITER OUT OF SYNTAX
         BAL,SR4  ERROR
TABSEND  STW,R5   TABSET+4,R7       SET ADDRESS OF TAB TABLE
         LCI      7
         PLM,R5   *R7
         B        *SR4
TABSERR  LI,R1    45                INVALID TAB SPECIFICATION
         B        TABSEND-1
TABSERR2 LI,R1    51                MORE THAN 16 VALUES ON TABS CMD
         B        TABSEND-1
         PAGE
TRANSACT PSW,SR4  *R7
*
         STW,D1   PREVACT,R7        SAVE PREVIOUS ACTION CODE
*
         BAL,SR4  GETARG            GET ACTION VERB
*
         LI,R1    ARGBUF4           FORCE LENGTH TO 3 CHARACTERS
         LI,R2    1
         CB,R2    *R7,R1            TEST IF ONE CHAR CMD
         BNE      %+3               NO
         LW,R1    =X'12000000'+CMDTBLX
         B        ACTION3+1
         LI,R2    3
         STB,R2   *R7,R1
*
ACTION3  LW,R1    =X'12000000'+CMDTBL   EDIT ACTION VERB
         BAL,SR4  FIXARG
         CI,R1    11                -ON- THE ACTION VERB
         BNE      %+2               NO
         LI,R1    1                 YES-SET-TO-
RETURN   STW,R1   D1                SAVE ACTION CODE
          PLW,SR4 *R7
         B        *SR4
*
*
RSTACK   EQU      0                 USER STORAGE LAYOUT
*        +0
*        +1       STACK POINTER
*        +2       HEADING FLAG
SYNFLAG  EQU      RSTACK+3          HAS A SYNNONYM FILE NAME BEEN ENCOUN
BUFSIZE  EQU      RSTACK+4          BYTE SIZE OF RD/WR BUFFER
ERCMDBUF EQU      BUFSIZE+1         ERROR COMMAND LINE POINTER BUFFER
ARGBUFF  EQU      ERCMDBUF+35       CURRENT ARGUMENT BUFFER
ARGTBL   EQU      ARGBUFF+16
CMBX     EQU      ARGTBL+36
CMDBUF   EQU      CMBX+1
DCBADD   EQU      CMDBUF+35         CURRENT DCB ADDRESS
ERRFLAG  EQU      DCBADD+1
INSWT    EQU      ERRFLAG+10
IOERR    EQU      INSWT+1
MAXCMBX  EQU      IOERR+1
NCHAR    EQU      MAXCMBX+1
NPAGE    EQU      NCHAR+1
PREVACT  EQU      NPAGE+1
RDFPT    EQU      PREVACT+1
TERM     EQU      RDFPT+7
TOARG    EQU      TERM+1
TOSWT    EQU      TOARG+15
WRTFPT   EQU      TOSWT+1
TOVER    EQU      WRTFPT+8          OUTPUT ACTION VERB
SFACCT   EQU      TOVER+1           STD FILE ACCT FLAG
PRNTBUF  EQU      SFACCT+2          HEX DUMP PRINT BUF (EVEN ADR)
RECNUM   EQU      PRNTBUF+34        NUMBER OF CURRENT RECORD
SAVCMBX  EQU      RECNUM+1          CMBX SAVE WORD
ATTRB    EQU      SAVCMBX+1         ATTRIBUTE FLAG
#DELIM   EQU      ATTRB+1           # DELIMITER FLAG
CARDSEQ  EQU      #DELIM+1          2-WORD SEQUENCE INFORMATION
KEY      EQU      CARDSEQ+2
TABSET   EQU      KEY+1
RSSAVE   EQU      TABSET+5
SYNONYM  EQU      RSSAVE+1          SYNON FLAG
SFTEMP   EQU      SYNONYM+1         NAME OF TEMP STD FILE
SCRATCH  EQU      SFTEMP+1          SCRATCH TAPE SN
COPYSTDF EQU      SCRATCH+1
*
DEVICE   EQU      ARGTBL            ARGUMENT TABLE LAYOUT
FILE     EQU      DEVICE+3
CODE     EQU      FILE+2
MODE     EQU      CODE+1
SEQUENCE EQU      MODE+4
SELECT   EQU      SEQUENCE+5
CIBUSED  EQU      SELECT+1
CIBLEFT  EQU      CIBUSED+1
CIBTOTAL EQU      CIBLEFT+1
CIWORD   EQU      CIBTOTAL+1
RECSIZE  EQU      CIWORD+1
CISEQ    EQU      RECSIZE+1
COBUSED  EQU      COPYSTDF+1
COBLEFT  EQU      COBUSED+1
COWORD   EQU      COBLEFT+1
CONTPTR  EQU      COWORD+1          CONT STMT POINTER
CONTMODE EQU      CONTPTR+1         CONT STMT FLAG
TELCONT  EQU      CONTMODE+1        TEL CONT STMT FLAG
EXPIRE   EQU      TELCONT+1         EXP DATE -3-WD TEXTC FORMAT
IN%ARG   EQU      EXPIRE+3
OUT%ARG  EQU      IN%ARG+1
DEV%IN   EQU      OUT%ARG+1
DEV%OUT  EQU      DEV%IN+1
DEV%SAV  EQU      DEV%OUT+1
DEV%SAV1 EQU      DEV%SAV+1
CMBXHLD  EQU      DEV%SAV1+1   SIDR#SIG7-11335
UNACCT   EQU      CMBXHLD+1    VEHICLE ACCOUNT.
DENSITY  EQU      UNACCT+3     DENSITY CODE FOR DUAL DENSITY DRIVES.
DEL%CT   EQU      DENSITY+1    COUNTER FOR DELETE
*
ARGBUF4  EQU      ARGBUFF*4         BYTE EQUIVALENTS
PRTBUF4  EQU      PRTBUF*4
ERRFLG4  EQU      ERRFLAG*4
*
RDACCT   EQU      SELECT            TABLE OF READ ACCTS
WRTACCT  EQU      PRNTBUF           TABLE OF WRITE ACCTS
EXACCT   EQU      WRTACCT+17   TABLE OF EXECUTE ACCTS.
TLBLSIZE EQU      255               BYTE SIZE OF TLABEL
CONTINUE EQU      256               CONT STMT CONCAT AREA
IOBUF    EQU      512
FPARAM   EQU      IOBUF+35
OPNFPT   EQU      IOBUF+256
LINE%NO  EQU      IOBUF-43
LINE%NO1 EQU      IOBUF-42
LINE%NO2 EQU      IOBUF-41
PRTBUF   EQU      IOBUF-40
SEQNUM   EQU      IOBUF-5
LINENO   EQU      IOBUF-3
STRDFPT  EQU      PRTBUF            STD FILE READ FPT
*
CMBXDIFF EQU      CMDBUF+CMDBUF+CMDBUF+CMDBUF-ERCMDBUF-ERCMDBUF;
                  -ERCMDBUF-ERCMDBUF
*
CMDTBL   DATA     CMDTBL1-%         COMMAND ACTION VERB TABLE
         TEXTC    'TO '
         TEXTC    'COP'
         TEXTC    'DEL'
         TEXTC    'END'
         TEXTC    'LIS'
         TEXTC    'REM'
         TEXTC    'REW'
         TEXTC    'SPF'
         TEXTC    'SPE'
         TEXTC    'WEO'
         TEXTC    'ON '             11
         TEXTC    'OVE'             12
         TEXTC    'TAB'
         TEXTC    'REV'
         TEXTC    'PCL'
         TEXTC    ' PC'             BURN BATCH PCL COMMAND
CMDTBL1  EQU      %-1
CMDTBLX  DATA     CMDTBLX1-%
         TEXTC    ' '
         TEXTC    'C'
         TEXTC    'D'
         TEXTC    'E'
         TEXTC    'L'
CMDTBLX1 EQU      %-1
         DO1      VERSION=1
J:JIT    DATA     0                 SIMULATE JIT FOR BATCH MODE
*                                   TESTING UNDER BPM
         PAGE
         DO       VERSION=2
INT      EQU      %                 BREAK CONTROL ROUTINE
         MTW,1    BREAK             SET BREAK
         LI,R3    X'1FFFF'
         LS,R2    0,R1
         CI,R2    REVRP             ON READ CAL OF REVIEW
         BNE      %+3               NO
         LI,R2    LIST26            CHANGE RETURN ADR IN PSD
         STS,R2   0,R1
         CAL1,9   5                 RETURN TO PROGRAM
         FIN
*
BREAK    DSECT    0
         DATA     0                 BREAK CONTROL FLAG
STACK    RES      511               STACK AREA
BLKSIZE  EQU      STACK+318         SIZE OF ANS BLOCK
UNBADR   EQU      STACK+319         POINTER INTO ANS INPUT BLOCK
BLKBUFF  EQU      STACK+320         PTR INTO ANS OUTPUT BLOCK
ANSBLK   EQU      STACK+321         4-WD TABLE OF ANS OPTIONS
DVLARG   EQU      STACK+325         DEVICE LEVEL ARGUMENTS (36 WD)
SFDEV    EQU      STACK+361         2 WD SAVE FOR COPYSTD DEV CODES
DELETEF  EQU      STACK+363         FLAG SET IF ONLINE REVIEW COMMAND
FROMFILE EQU      STACK+364         1ST FILE NAME ON REVIEW,COPYALL,
*                                   OR DELETEALL COMMAND
TOFILE   EQU      STACK+372         2ND FILE NAME ON REVIEW,COPYALL,
*                                   OR DELETEALL COMMAND
RDTBL    EQU      STACK+380       RD OPTION COUNT AND CMBX
WRTBL    EQU      STACK+382       WR OPTION COUNT AND CMBX
DATETBL  EQU      STACK+384         TABLE OF DATES FROM VLP
COPYSK   EQU      STACK+392         COPYALL SELECT FLAG
EATTRB   EQU      STACK+393         EXTENDED ATTRIBUTE FLAG (EA)
SFARG    EQU      STACK+395         SAVE AREA FOR STD FILE ARGS
LISTCMBX EQU      STACK+441         SAVE PTR FOR LIST MULT FIDS
LISTTERM EQU      STACK+442         SAVE DELIM FOR LIST MULT FIDS
FROMCMBX EQU      STACK+443         POINTER TO END OF FROM FIELD
COPYPHY  EQU      STACK+444         COPY TAPE IN PHYSICAL ORDER
SFCNT    EQU      STACK+445         STANDARD FILE COUNT
GRANCNT  EQU      STACK+446         GRANULE COUNT FOR LIST(A)
EXTBL    EQU      STACK+447    EX OPTION COUNT AND CMBX.
UNTBL    EQU      STACK+449    UN OPTION COUNT AND CMBX.
TLABEL   EQU      STACK+451    64-WORD TAPE LABEL BUFFER.
         USECT    PCL
         END      PCL

