*M*      OX  -  MANAGES ONLINE COMMAND FILES FOR TEL
         SYSTEM   SIG7FDP
UTSPROC  SET      0
S69PROC  SET      1
BITS     SET      1
         SYSTEM   UTS
         SPACE    5
************************************************************************
*P*      NAME:    OX                                                   *
*P*      PURPOSE:     PROCESSES THE TEL OX COMMAND AND HANDLES ALL     *
*P*               FUNCTIONS ASSOCIATED WITH TEL COMMAND FILES.         *
************************************************************************
         TITLE    'OX  --  COMMAND FILES'
*        **********
*        *  DEFS  *
*        **********
         DEF      CPXBREAK          HANDLES CONTROL-Y IN CPX MODE
         DEF      CPXREAD           READS COMMAND FROM FILE
         DEF      ECHO              PROCESSES ECHO COMMAND
         DEF      OX                MAIN ENTRY FOR OX COMMAND
*        **********
*        *  REFS  *
*        **********
         REF      AM:HED            SIZE OF A/M RECORD HEADER
         REF      AM:LNK            A/M POINTER TO 1ST PLIST
         REF      AM:ORG            A/M POINTER TO AVAILABLE SPACE
         REF      AM:STDOP          SAVED IMAGE OF J:OPT
         REF      AMBUF             SPEC. BUFFER 2
         REF      BINDECBCD         CONVERTS BINARY TO DEC. EDCDIC
         REF      CMNERR1           TYPES ERROR MSG & PROMPTS
         REF      CPXEND            ENTRY AT TERMINAL READ
         REF      CPXUSR            BIT IN JIT, WORD 0
         REF      DECBIN            CONVERTS EBCDIC DECIMAL TO BINARY
         REF      DONTBIT           BIT IN J:TELFLGS
         REF      FID               SCANS FOR FILE ID
         REF      FMTELCL           CLOSES M:TEL
         REF      GETFIELD          SCANS NEXT FIELD INTO D1-D3
         REF      HEX2EBC           CONVERTS BINARY TO HEX EBCDIC
         REF      J:ACCN            USER'S CURRENT ACCOUNT
         REF      J:JIT             JUMBLE INFORMATION TOGETHER
         REF      J:OPT             OPTION BITS, RESET BY 'DONT'
         REF      J:TELFLGS         TEL'S FLAG WORD IN JIT
         REF      JB:CCARS          ARS OF COMMAND IN CCBUF
         REF      JSTEP             JOB STEP FLAG IN J:TELFLGS
         REF      M:TEL             TEL'S DYNAMIC DCB
         REF      MSTRMODE          FPT FOR M:MASTER BEFORE SUA
         REF      NAME              NAME,ACCT,PSWD VLPS DUMMY
         REF      NFND              MAKES FILE NAME TEXTC
         REF      NTJBST            REPORTS 'QUIT OR CONTINUE'
         REF      PROMPT            PROMPT USER & READ COMMAND
         REF      PROMPTF           ENTRY TO TEL PAST M:UC READ
         REF      READAM            READS A/M RECORD INTO AMBUF
         REF      RETN              TEXT CARRIAGE RETURN
         REF      SETBUF            SCRATCH AREA IN CONTEXT PAGE
         REF      SYNTAX            TYPES 'EH @ NN'
         REF      T%ERR             READS ERRMSG & PRINTS IT
         REF      T%ERRTXT          READS ERRMSG TEXT FROM FILE
         REF      T%WRTERR          WRITES MSG FROM BUFR IN TELSTACK
         REF      TELBUF            CMND BUFFER IN TEL'S CONTEXT PAGE
         REF      TELSTACK          TEL'S INTERNAL STACK
         REF      VERB2             BLANKS
         REF      WRITE             TERMINAL WRITE FPT (M:UC)
         REF      WRITEAM           WRITES OUT A/M RECORD
         PAGE
************************************************************************
*  THESE PROCS ARE USED TO MANIPULATE TEL'S STACK IN SBUF1VPA          *
************************************************************************
*
* PROC TO CHANGE STACK POINTER THE AMOUNT SPECIFIED BY THE 1ST ARGUMENT
* USING THE REGISTER SPECIFIED BY THE 2ND ARGUMENT.
*
BUMP     CNAME
         PROC
LF       LI,AF(2) AF(1)
         MSP,AF(2)  TELSTACK
         PEND
*
* PUSH OR PULL N WORDS SPECIFIED BY 1ST ARGUMENT INTO REGS STARTING
* AT 2ND ARGUMENT.
*
PUSH     CNAME    X'9',X'B'
PULL     CNAME    X'8',X'A'
         PROC
         DO       NUM(AF)=1
LF       GEN,1,7,4,3,17  0,NAME(1),AF(1),0,TELSTACK
         ELSE
         DO       AF(1)=1
LF       GEN,1,7,4,3,17  0,NAME(1),AF(2),0,TELSTACK
         ELSE
         DO       AF(1)=16
LF       LCI      0
         ELSE
LF       LCI      AF(1)
         FIN
         GEN,1,7,4,3,17  0,NAME(2),AF(2),0,TELSTACK
         FIN
         FIN
         PEND
         PAGE
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
         CSECT    1
CPXAMSIZ EQU      8                 SIZE OF CPX FILE INFO ENTRY
AMNAME   EQU      AM:HED
AMACCT   EQU      AM:HED+3
AMPASS   EQU      AM:HED+5
AMRCNT   EQU      AM:HED+7
         PAGE
************************************************************************
*P*      NAME:    OX                                                   *
*P*      PURPOSE:     HANDLES ALL PROCESSING ASSOCIATED WITH COMMAND   *
*P*               FILES IN TEL.                                        *
*P*      DESCRIPTION:     COMMAND FILES ARE INVOKED BY THE 'XEQ'       *
*P*               COMMAND.   THE FILE NAME AND STARTING RECORD NUMBER  *
*P*               ARE STORED IN THE A/M RECORD AND THE CPX BIT IS      *
*P*               SET IN J:JIT TO INDICATE COMMAND FILE MODE.  TEL IS  *
*P*               THEN RE-ENTERED AT THE TERMINAL READ LOGIC POINT,    *
*P*               WHERE THE CPX BIT CAUSES THE NEXT COMMAND TO BE READ *
*P*               FROM THE FILE SPECIFIED IN THE A/M RECORD.  TEL      *
*P*               COMMANDS WILL BE READ FROM THE FILE UNTIL EOF OR     *
*P*               ANOTHER CONDITION TERMINATES THE COMMAND FILE.       *
************************************************************************
OX       EQU      %
         LW,R5    CPXUSR            IS USER ALREADY CPX?
         LS,R4    J:JIT
         BEZ      NEWCPX            NO, DON'T NEED TO CLEAN UP
         BAL,R0   KILLCPX           DELETE CPX FILE INFO IN A/M
NEWCPX   EQU      %
         LW,SR3   J:TELFLGS         ARE WE AT
         CI,SR3   JSTEP             JOB STEP?
         BANZ     %+2               YES, CONTINUE.
         B        NTJBST            FORCE QUIT OR CONTINUE
*
         BAL,SR3  GETFIELD          SCAN FOR COMMAND FILE NAME
         CI,R7    0                 WAS FILE NAME SPECIFIED?
         BE       SYNTAX            NO, SYNTAX ERROR
         CI,R6    ','               DOES RECORD NUM FOLLOW IMMEDIATELY?
         BNE      SCNACCT           NO.
         LCI      2                 YES, RUNNING ACCT AND
         LM,SR2   J:ACCN            NO
         LI,R7    0                 PASSWORD
         LI,SR1   0
         B        DFACT             DON'T SCAN FOR ACCT,PSWD
SCNACCT  EQU      %
         BAL,SR4  FID               YES, SCAN FID INTO REGISTERS
DFACT    PUSH     R6                SAVE TERMINATOR
         PUSH     4,R7              SAVE ACCT & PASSWD
         BAL,SR4  SHUFFLDN          MAKE ROOM IN THE A/M
         PULL     4,R7              RETRIEVE ACCT & PASSWD
         LCI      2
         STM,SR2  AMBUF+AMACCT      STORE ACCOUNT
         STM,R7   AMBUF+AMPASS      STORE PASSWORD
         BAL,SR3  NFND              CONVERT FILE NAME TO TEXTC
         LCI      3
         STM,R6   AMBUF+AMNAME      STORE FILE NAME
*  IF THE USER SPECIFIED A STARTING RECORD NUMBER, STORE IT.
         LI,R7    0                 PRESUME NONE
         PULL     R6                RETRIEVE TERMINATOR
         CI,R1    0                 ANY MORE TO SCAN?
         BLE      NOSTREC           NO.
         CI,R6    ','               LEGAL TERMINATOR?
         BNE      SYNTAX            NO.
         BAL,SR3  GETFIELD          SCAN FOR RECORD NUMBER
         CI,R7    0                 WAS FIELD NULL?
         BE       SYNTAX            YES (DELETES IN-CORE A/M)
         BAL,SR4  DECBIN            CONVERT RECORD NUMBER TO BINARY
         CI,R7    0                 RECORD NUMBER MUST
         BLE      SYNTAX            BE GREATER THAN ZERO
         AI,R7    -1                DECREMENT FOR INDEX ZERO
NOSTREC  STW,R7   AMBUF+AMRCNT      STORE STARTING RECORD NUMBER.
*
         BAL,SR4  WRITEAM           WRITE OUT A/M RECORD
         LW,R5    CPXUSR            SET
         STS,R5   J:JIT             CPX MODE
         B        PROMPT
         PAGE
CPXBREAK EQU      %
         PUSH     SR4               SAVE RETURN
         LW,SR4   CPXUSR            ARE WE IN
         CW,SR4   J:JIT             CPX MODE?
         BAZ      PLBISR4           NO, RETURN
         BAL,SR4  READAM            READ IN A/M RECORD
         LW,D4    AMBUF+AMRCNT      GET CURRENT RECORD NMBR
         BAL,R0   KILLCPX           TERMINATE CPX MODE
************************************************************************
*E*      ERROR:   GRP 03,  0F-03                                       *
*E*      DESCRIPTION:   THE USER DID A CONTROL-Y OR OTHER ESCAPE       *
*E*               TO TEL WHILE IN CPX MODE.  WE GIVE THE USER A        *
*E*               CPX TERMINATION MESSAGE WHICH INCLUDES THE           *
*E*               RECORD NUMBER OF THE LAST RECORD READ.               *
************************************************************************
         LI,D1    X'030F03'         ERRMSG KEY
         BAL,SR4  T%ERRTXT          GET MSG
         LW,D1    D4                RETRIEVE RECORD NUMBER
         PUSH     R1                SAVE BUFR ADDRESS
         BAL,SR4  BINDECBCD         CONVERT TO EBCDIC
         PULL     R1                RETRIEVE BUFFER ADDRESS
         STW,D2   10,R1             STORE REC. NUMBER IN MSG
         BAL,R0   T%WRTERR          WRITE MSG
         B        PLBISR4           RETURN
         PAGE
************************************************************************
*F*      NAME:    KILLCPX                                              *
*F*      PURPOSE:     TERMINATES COMMAND FILE MODE, PERFORMING ALL     *
*F*               NECESSARY CLEANUP.                                   *
*F*      DESCRIPTION:     CPX MODE TERMINATION CONSISTS OF RESETING    *
*F*               THE CPX BIT IN J:JIT AND CLEANING THE CPX FILE       *
*F*               INFORMATION OUT OF THE A/M RECORD.  THE A/M IS THEN  *
*F*               REWRITTEN.                                           *
************************************************************************
KILLCPX  EQU      %
         LI,R4    0                 RESET
         LW,R5    CPXUSR            CPX BIT
         STS,R4   J:JIT
*
*  RUN THE PLIST CHAIN, DECREMENTING LINKS BY CPXAMSIZ
*
         LI,SR3   -CPXAMSIZ         CONSTANT
         BAL,SR4  SHFLCMN           UPDATE LINKS
*
*  MOVE THE PLISTS UP OVER THE OLD CPX INFO
*
SHFLUP1  LW,SR2   AMBUF+AM:ORG
         AI,SR2   -(AM:HED+CPXAMSIZ-1)   NUMBER OF WDS TO MOVE+1
         AWM,SR3  AMBUF+AM:ORG      UPDATE AVAILABE PTR
         LI,R7    0
SHFLUP2  LW,SR1   AMBUF+AM:HED+CPXAMSIZ,R7
         STW,SR1  AMBUF+AM:HED,R7
         AI,R7    1
         BDR,SR2  SHFLUP2
         BAL,SR4  WRITEAM           WRITE OUT CLEANED A/M
         B        *R0               RETURN
         PAGE
************************************************************************
*D*      NAME:    SHUFFLDN                                             *
*D*      CALL:    CALLED BY NEWCPX TO MAKE ROOM FOR THE CPX FILE       *
*D*               INFORMATION IN THE A/M RECORD.                       *
*D*      REGISTERS:     NO REGISTERS ARE PRESERVED                     *
*D*      INPUT:   SR4 - LINK                                           *
*D*               CPXAMSIZ - VALUE = SIZE OF CPX ENTRY                 *
*D*               AM:ORG - POINTER IN A/M TO AVAILABLE SPACE           *
*D*      OUTPUT:  AM:ORG - SET TO AM:ORG+CPXAMSIZ                      *
*D*               AM:LNK - SET TO AM:LNK+CPXAMSIZ                      *
*D*               THE A/M RECORD PLISTS ARE MOVED DOWN BY CPVAMSIZ     *
*D*               WORDS.                                               *
*D*      DESCRIPTION:     SEE ABOVE.                                   *
************************************************************************
SHUFFLDN EQU      %
         PUSH     SR4               SAVE LINK
         BAL,SR4  READAM            GET A/M RECORD
         LW,SR2   AMBUF+AM:ORG      AVAILBLE SPACE
         CI,SR2   X'1FF'-CPXAMSIZ   WILL CPX INFO FIT?
         BLE      %+3               YES
************************************************************************
*E*      ERROR:   GRP 03, 0F-00                                        *
*E*      DESCRIPTION:     THERE IS NOT ENOUGH ROOM IN THE A/M TO       *
*E*               HOLD THE CPX ENTRY.                                  *
************************************************************************
         LI,D1    X'030F00'         ERRMSG KEY
         B        CMNERR1           TELL USER....
*
         LI,SR3   CPXAMSIZ
         BAL,SR4  SHFLCMN           UPDATE PLIST FLINKS
         LW,R7    AMBUF+AM:ORG
         AI,R7    -(AM:HED-1)       = NUMBER TO MOVE + 1
*  DO THE SHUFFLE (OR ROCK AROUND THE CLOCK IF YOU PREFER)
         LW,SR2   AMBUF+AM:HED-1,R7
         STW,SR2  AMBUF+AM:HED+CPXAMSIZ-1,R7
         BDR,R7   %-2
         AWM,SR3  AMBUF+AM:ORG      UPDATE AVAILABLE POINTER
PLBISR4  EQU      %
         PULL     SR4
         B        *SR4              RETURN
         PAGE
SHFLCMN  EQU      %
         LW,R7    AMBUF+AM:LNK      WE'RE DONE IF
         BEZ      SHFL3             INITIAL PTR IS NULL.
SHFL1    EQU      %
         LW,R6    AMBUF,R7          IS THIS THE LAST PLIST?
         BEZ      SHFL2             YES, DONE...
         AWM,SR3  AMBUF,R7          NO, UPDATE POINTER
         LW,R7    R6                SET UP TO CHECK NEXT PLIST
         B        SHFL1
SHFL2    EQU      %
         AWM,SR3  AMBUF+AM:LNK      UPDATE INITIAL PLIST PTR
SHFL3    EQU      %
         B        *SR4
         PAGE
************************************************************************
*D*      NAME:    CPXREAD                                              *
*D*      CALL:    CALLED BY TELMN INSTEAD OF PROMPTING AT THE TERMINAL *
*D*               IF THE USER IS IN CPX MODE.                          *
*D*      REGISTERS:                                                    *
************************************************************************
CPXREAD  EQU      %
         BAL,SR4  READAM            GET A/M RECORD
         CAL1,8   COCSTAT           GET LINE STATUS
         CI,SR1   X'30000'          CHECK IF USER HIT BREAK
         BANZ     CPXEOF            TERMINATE COMMAND FILE MODE
************************************************************************
*S*      SCREECH CODE:     60-03                                       *
*S*      REPORTED BY:     TEL                                          *
*S*      MESSAGE:     TEL ISSUED SINGLE USER ABORT ON YOU              *
*S*      TYPE:    SINGLE USER ABORT                                    *
*S*      REGISTERS:     SR4 - CONTENTS OF AM:LNK                       *
*S*      REMARKS:     THE A/M RECORD IS INCONSISTENT WITH A USER IN    *
*S*               CPX MODE.  AM:LNK SHOULD ALWAYS POINT PAST THE       *
*S*               CPX FILE INFORMATION, AND IT DOESN'T.                *
************************************************************************
         LW,SR4   AMBUF+AM:LNK      GET PLIST POINTER
         BNEZ     %+2               WE HAVE AT LEAST ONE PLIST
         LW,SR4   AMBUF+AM:ORG      IF NO PLISTS, CHECK AVAIL. PTR
         CI,SR4   AM:HED+CPXAMSIZ   CONSISTENCY CHECK
         BE       AMOK              O.K.
         LI,R4    0                 TERMINATE CPX MODE
         LW,R5    CPXUSR
         STS,R4   J:JIT
         STW,R4   AMBUF+AM:LNK      RESET A/M LINK AND ORG SO ALL
         LI,R5    AM:HED            IS O.K. AFTER SUA
         STW,R5   AMBUF+AM:ORG
         CAL1,6   MSTRMODE
         SUA      X'60',3
AMOK     EQU      %
*
*  MOVE 1ST PART OF FPT TO SETBUF
*
         LCI      7
         LM,R1    CPXOPN
         STM,R1   SETBUF
*
*  MOVE VLPS TO SETBUF
*
         LCI      10
         LM,R1    NAME              01 VLP CONTR. WORD
         LCI      3
         LM,R2    AMBUF+AMNAME      GET FILE NAME
         LCI      2
         LM,R6    AMBUF+AMACCT      GET ACCOUNT
         LCI      2
         LM,SR2   AMBUF+AMPASS
         AI,SR2   0                 IS PASSWORD PRESENT?
         BEZ      %+2               NO
         AI,SR1   X'0200'           YES, TURN ON NSW
         LCI      10
         STM,R1   SETBUF+7
*
*  DO THE OPEN
*
         CAL1,1   SETBUF            COMPLETE FPT IS IN SETBUF
         LW,R7    AMBUF+AMRCNT      NUMBER OF RECORDS TO SKIP
         BEZ      NOSKIP            START AT THE BEGINNING
         CAL1,1   PRECFPT           DO THE SKIP
NOSKIP   CAL1,1   CMNDRFPT          READ THE COMMAND
         LW,R1    M:TEL+13          GET ARS OF COMMAND (FROM RWS)
         PUSH     R1                SAVE ARS
         BAL,R4   FMTELCL           CLOSE THE COMMAND FILE
*
*  THE RECORD IS NOW IN TELBUF.  IF WE ARE IN ECHO MODE, TYPE THE
*  RECORD NUMBER, FOLLOWED BY THE RECORD ITSELF
*
         LW,D1    AMBUF+AMRCNT      GET OLD RECORD COUNT
         AI,D1    1                 INCREMENT
         STW,D1   AMBUF+AMRCNT      STORE FOR WRITE
         LC       J:OPT             IS ECHO FLAG SET?
         BCR,8    DONTECHO          NO.
         BAL,SR4  BINDECBCD         CONVERT RECORD NUM TO EBCDIC
         LW,D3    VERB2             BLANKS TO INDENT ECHO
         PUSH     D3                MOVE TO BUFFER IN TELSTACK
         LW,R1    TELSTACK          BUFFER ADDRESS IN TELSTACK
         LW,D3    SPACER            TEXT SEPARATOR
         PUSH     2,D2              MOVE TEXT TO 'BUFFER'
         LI,R2    11                BYTE COUNT FOR WRITE
         CAL1,1   WRITE             WRITE RECORD NUMBER
         BUMP     -3,R4             CLEAN STACK
         LI,R1    TELBUF            BUFR ADDR FOR RECORD
         PULL     R2                BYTE COUNT FOR RECORD
         CAL1,1   WRITE             RECORD
         PUSH     R2
         LI,R1    RETN              WRITE CR
         LI,R2    1
         CAL1,1   WRITE
DONTECHO EQU      %
         BAL,SR4  WRITEAM           AND WRITE OUT A/M
         PULL     R1                RETRIEVE ARS
         STB,R1   JB:CCARS          STORE ARS IN JIT
         LB,R2    TELBUF            CHECK FIRST BYTE OF COMMAND
         CI,R2    '!'               IS IT A BANG?
         BNE      NOBANG            NO - ILLEGAL
         AI,R1    -1                SUBTRACT ZEROTH CHAR FOR CHECK
         LB,R2    TELBUF,R1         CHECK RECORD TERMINATOR
         CI,R2    X'15'             IS IT CR?
         BE       NOINCR            YES
         CI,R2    X'0D'             IS IT LF?
         BE       NOINCR            YES
         AI,R1    2
         STB,R1   JB:CCARS
         AI,R1    -1
         LI,SR4   X'0D'
         STB,SR4  TELBUF,R1
NOINCR   EQU      %
         B        PROMPTF           GO SCAN COMMAND
         PAGE
CPXOERR  EQU      %
PRECABN  EQU      %
         LB,SR4   SR3               CHECK FOR
         CI,SR4   6                 END-OF-FILE.
         BE       CPXEOF            IT'S AN EOF
************************************************************************
*E*      ERROR:   GRP 03,  0F-01                                       *
*E*      DESCRIPTION:     AN I/O ERROR OF SOME SORT OCCURRED WHILE     *
*E*               ACCESSING THE COMMAND FILE.  WE GIVE THE USER A      *
*E*               MESSAGE WITH THE ERROR CODE AND TERMINATE CPX MODE.  *
************************************************************************
         SCD,SR3  8                 ERROR CODE TO SR4
         SLS,SR3  -1                RIGHT JUSTIFY SUBCODE
         SCD,SR3  8                 AND POSITION.
         STW,SR4  SETBUF            SAVE ERROR CODE & SUB-CODE
         LI,D1    X'030F01'         ERRMSG KEY
         BAL,SR4  T%ERRTXT          GET SKELETON MSG
         INT,SR2  SETBUF            GET ERROR CODE & SUBCODE
         BAL,SR4  HEX2EBC           CONVERT TO TEXT
         STW,D2   2,R1              INSERT CODE INTO MSG
         BAL,R0   T%WRTERR          WRITE MSG
CPXERRX  LI,R0    CPXEND            ENTRY AT TERMINAL READ
         B        KILLCPX
         SPACE    3
************************************************************************
*E*      ERROR:   GRP 03,  0F-02                                       *
*E*      DESCRIPTION:     WE REACHED THE EOF WHILE POSITIONING THE     *
*E*               COMMAND FILE.  THIS IS EITHER BECAUSE WE READ TO THE *
*E*               EOF, OR THE USER GAVE A STARTING RECORD NUMBER WHICH *
*E*               WAS TOO LARGE.                                       *
************************************************************************
CPXEOF   LI,D1    X'030F02'         ERRMSG KEY
         BAL,R0   T%ERR             TELL USER
         B        CPXERRX           CLEAN UP AND EXIT
*************************************************************
*E*      ERROR:   GRP 03,0F-04                              *
*E*      DESCRIPTION:  FIRST CHARACTER OF COMMAND RECORD    *
*E*                    IS NOT A BANG                        *
*************************************************************
NOBANG   LI,D1    X'030F04'
         BAL,R0   T%ERR
         B        CPXERRX
         PAGE
*        ***************
*        * FPTS & DATA *
*        ***************
CPXOPN   GEN,8,24     X'14',M:TEL
         DATA     X'C3400009'
         DATA     CPXOERR           ERR ADDR.
         DATA     CPXOERR           ABN ADDR
         DATA     1                 SEQUENTIAL
         DATA     1                 IN
         DATA     2                 SAVE
*
PRECFPT  GEN,8,24     X'1D',M:TEL
         DATA     X'C0000000'
         PZE      *R7               NUMBER RECS IN R1
         DATA     PRECABN           ABN ADDR
*
CMNDRFPT GEN,8,24     X'10',M:TEL
         DATA     X'F0000010'
         DATA     CPXOERR
         DATA     CPXOERR
         DATA     TELBUF            BUFFER
         DATA     80                SIZE
*
COCSTAT  GEN,8,4,20 6,4,0           TERMINAL STATUS
*
SPACER   TEXT     ' - '
         PAGE
************************************************************************
*F*      NAME:    ECHO                                                 *
*F*      PURPOSE:     THE ECHO COMMAND SETS THE 'ECHO' FLAG (Y8) IN    *
*F*               J:OPT TO CONTROL TERMINAL ECHOING OF COMMAND FILES.  *
*F*      DESCRIPTION:     THE FLAG IS SET WITH 'ECHO' AND RESET WITH   *
*F*               'DONT ECHO'.  IN ECHO MODE, RECORDS READ FROM A      *
*F*               COMMAND FILE ARE PRINTED, PREDEDED BY THE FOUR LEAST *
*F*               SIGNIFICANT DIGITS OF THE RECORD NUMBER.             *
************************************************************************
ECHO     EQU      %
         LI,R4    0                 ASSUME DONT ECHO
         LW,R5    Y8                ECHO BIT (MASK FOR STS)
         LI,R3    DONTBIT
         CW,R3    J:TELFLGS         WAS IT DONT ECHO?
         BANZ     DECHO             YES
         LW,R4    Y8                NO, SET ECHO FLAG
DECHO    STS,R4   J:OPT
         LI,R3    JSTEP             CHECK FOR
         CW,R3    J:TELFLGS         JOB STEP.
         BAZ      PROMPT            NOT JOB STEP.
         BAL,SR4  READAM            JOB STEP, CHANGE
         STS,R4   AMBUF+AM:STDOP    A/M COPY OF J:OPT
         BAL,SR4  WRITEAM
         B        PROMPT
         END

