C
C	COPYRIGHT Warren K. Falls.  1984, 1985, 1986.
C
	IMPLICIT INTEGER*4 (A-Z)
	PARAMETER	SPACE=32
	PARAMETER	TAB=9
	PARAMETER	ESCAPE=27
	INTEGER*2	LIST_STATE,LIST_COUNT,L_TEMP_OFF,L_TEMP_LENG,L_LENGTH
	INTEGER*2	LIST_LENGTH(20),LIST_SOURCE,S_OFF,S_LENGTH,CONSUME
	INTEGER*2	LINE,LINE1,LINE2,NO_CR_LF,BUILD
	INTEGER*2	VARS(14),OFFSET,SCRFOR,ENDTSK,ENDLN,LENGTH,STATE
	INTEGER*2	GRAPHC,GRPHLN,SEL
	INTEGER*2	SELPNT(99),SELECT(1000),SELCT1(100),CHOPNT(2,99)
	INTEGER*2	LINPNT(99),SUB(4),BMASK(16),TTSTAT(4),DOUBLE,IFFLAG
	INTEGER*2	IMCR(40),VERBOS,PRNTR,SUBPNT,HARDLEN,MASK_BLK,SETFLG
	INTEGER*2	RTURN,INIT1,SILNT,LENGX,NOMCR,SCOPE,SPWNST,PRINT
	INTEGER*2	DEBUG,CALLFL,CLEAR,WHOLE,DUMB,DCL,JET,BOTTOM,DSW,PRNTER
	INTEGER*2	MASTER_LOCK,SUB_CALLED,UNFORMAT_SCREEN
	INTEGER*4	ISTAT,SPSTAT,READF1,READF2,READF3,SYS$TRNLOG,CTLMASK
	INTEGER*4	PARM1,PARM4,PARM6,PARM10,SPRM10,PARM1D,BIGMASK(32)
	INTEGER*4	TIMER(2),MODEST(3),NOWAIT,GLOB,JETTER,MASK,TEMP
	INTEGER*4	SYS$EXIT,SYS$SETIMR,SYS$WAITFR,SYS$QIOW,SYS$ASSIGN
	INTEGER*4	SAVE_SELFUN,SAVE_I
	BYTE		LIST_BUFFER(132,20),L_BUFFER(132),S_BUFFER(132)
	BYTE		BMCR(80),CRB(1),LFB(1),ESCB(1),NULLB(1),SLASHB(1)
	BYTE		BIT1(132),ONEFIL(50),TIMSTR(24),TMSTR(35),BSB(1)
	BYTE		BIT(132),BILNAM(50),SCREEN(2500),MCRBB(80)
	BYTE		STRING(4000),SELCMP(99),BSBUF(3),SUBBUF(100)
	BYTE		HELP1(50),BBMCR(79),LINSUB(6,30),AMCR(2)
	BYTE		SELBUF(21),CURBUF(17),BTBUF(2),TTNUM(4),CURBF2(18)
	BYTE		NUMS(2,99),HELP3(9),SYMBBF(80),SLCMP2(99)
	BYTE		NAMSAV(10,50),HARDBUF(60),LEVEL,CONTEXT_LEVELB
	BYTE		CNUMS(2,80),BLIBUF(18),LSTLST(50),PASSWD(26)
	BYTE		FILPRE(11),LSTFIL(50),GRPHBF(80),ENDBUF(80)
	BYTE		PRON(5),PROFF(5),PRSCRN(3),PRENAB(4),PRDISA(4)
	CHARACTER	LIST_CHAR(20)*132,L_CHAR*132,S_CHAR*132
	CHARACTER	MCR*80,HELP1C*50,TIMCHR*17,MCRB*80
	CHARACTER	BUFFER*132,FILNAM*50,BCKSLH*1,YESNO*4,TMCHR*17
	CHARACTER	TTBUF*2,BUFF1*132,BYE*3,HELP3C*9,SLASH*1,SYMEXIT*11
	CHARACTER	BBMCRC*79,GRPSTR*80,ENDSTR*80,CR*1,LF*1,ESC*1,NULL*1
	CHARACTER	PRV0*8,PRV1*10,PRV2*8,CONTEXT*600,SCRFILE*8,BS*1
	CHARACTER	SYMSTR*10,SYMHLP*8,YEP*3,NOPE*2,ZIP*2,NUMBS*160
	CHARACTER	SYMBUF*80,CSTRNG*4000,CONTEXT_LEVEL,SCRCONTEXT4*12
	CHARACTER	SCRCONTEXT1*12,SCRCONTEXT2*12,SCRCONTEXT3*12
	EQUIVALENCE	(VARS(1),OFFSET)
	EQUIVALENCE	(VARS(2),DOUBLE)
	EQUIVALENCE	(VARS(3),HARDLEN)
	EQUIVALENCE	(VARS(4),LENGX)
	EQUIVALENCE	(VARS(5),LINE)
	EQUIVALENCE	(VARS(6),SCRFOR)
	EQUIVALENCE	(VARS(7),ENDTSK)
	EQUIVALENCE	(VARS(8),ENDLN)
	EQUIVALENCE	(VARS(9),LENGTH)
	EQUIVALENCE	(VARS(10),CONSUME)
	EQUIVALENCE	(VARS(11),STATE)
	EQUIVALENCE	(VARS(12),GRAPHC)
	EQUIVALENCE	(VARS(13),GRPHLN)
	EQUIVALENCE	(VARS(14),SEL)
	EQUIVALENCE	(LIST_BUFFER(1,1),LIST_CHAR(1)(1:1))
	EQUIVALENCE	(S_CHAR(1:1),S_BUFFER(1))
	EQUIVALENCE	(L_CHAR(1:1),L_BUFFER(1))
	EQUIVALENCE	(CONTEXT(1:1),NAMSAV(1,1))
	EQUIVALENCE	(CONTEXT(501:501),LSTLST(1))
	EQUIVALENCE	(CONTEXT(551:551),LSTFIL(1))
	EQUIVALENCE	(CONTEXT_LEVELB,CONTEXT_LEVEL)
	EQUIVALENCE	(SYMBUF,SYMBBF)
	EQUIVALENCE	(CSTRNG,STRING)
	EQUIVALENCE	(NUMBS,CNUMS)
	EQUIVALENCE	(BSB,BS)
	EQUIVALENCE	(CRB,CR)
	EQUIVALENCE	(LFB,LF)
	EQUIVALENCE	(ESCB,ESC)
	EQUIVALENCE	(NULLB,NULL)
	EQUIVALENCE	(SLASHB,SLASH)
	EQUIVALENCE	(SPWNST,SPSTAT)
	EQUIVALENCE	(BBMCR,BBMCRC)
	EQUIVALENCE	(GRPHBF,GRPSTR)
	EQUIVALENCE	(ENDBUF,ENDSTR)
	EQUIVALENCE	(HELP1,HELP1C)
	EQUIVALENCE	(HELP3,HELP3C)
	EQUIVALENCE	(TIMSTR(8),TIMCHR)
	EQUIVALENCE	(TMSTR(11),TMCHR)
	EQUIVALENCE	(BMCR(2),BBMCR(1))
	EQUIVALENCE	(BIT1,BUFF1)
	EQUIVALENCE	(BIT,BUFFER)
	EQUIVALENCE	(TTBUF,BTBUF)
	EQUIVALENCE	(IMCR,BMCR)
	EQUIVALENCE	(MCR,BMCR)
	EQUIVALENCE	(MCRB,MCRBB)
	EQUIVALENCE	(FILNAM,BILNAM)
	DATA		FILPRE /'S','Y','S','$','S','C','R','I','P','T',':'/
	DATA		PASSWD /10,13,'P','l','e','a','s','e',' ','e','n',
	9	't','e','r',' ','p','a','s','s','w','o','r','d',':',' ',' '/
	DATA		SYMSTR /'SCR$RETURN'/
	DATA		SYMHLP /'SCR$HELP'/
	DATA		SYMEXIT /'SCR$COMMAND'/
	DATA		SCRFILE /'SCR$FILE'/
	DATA		SCRCONTEXT1 /'SCR$CONTEXT1'/
	DATA		SCRCONTEXT2 /'SCR$CONTEXT2'/
	DATA		SCRCONTEXT3 /'SCR$CONTEXT3'/
	DATA		SCRCONTEXT4 /'SCR$CONTEXT4'/
	DATA		YEP /'YES'/
	DATA		NOPE /'NO'/
	DATA		ZIP /' 0'/
	DATA		GLOB /2/
	DATA BMASK	/1,2,4,8,16,32,64,128,256,512,1024,2048,4096,
	9 8192,16384,32768/
	DATA BIGMASK	/'1'X,'2'X,'4'X,'8'X,
	9		'10'X,'20'X,'40'X,'80'X,
	9		'100'X,'200'X,'400'X,'800'X,
	9		'1000'X,'2000'X,'4000'X,'8000'X,
	9		'10000'X,'20000'X,'40000'X,'80000'X,
	9		'100000'X,'200000'X,'400000'X,'800000'X,
	9		'1000000'X,'2000000'X,'4000000'X,'8000000'X,
	9		'10000000'X,'20000000'X,'40000000'X,'8000000'X/
	DATA PARM4	/21/
	DATA		BSBUF /8,32,8/
	DATA		CRB /13/
	DATA		LFB /10/
	DATA		ESCB /27/
	DATA		NULLB /0/
	DATA		BSB /8/
	DATA		SLASHB /47/
	DATA		SELBUF /32,32,32,27,'[',48,49,59,50,52,'r',
	9 27,'[',0,0,';',0,0,'H',13,10/
	DATA		BCKSLH /'\'/
	DATA		PRSCRN	/27,'[','i'/
	DATA		PROFF	/27,'[','?','4','i'/
	DATA		PRON	/27,'[','?','5','i'/
	DATA		PRDISA	/27,'[','4','i'/
	DATA		PRENAB	/27,'[','5','i'/
	DATA		BYE /'LOG'/
	DATA		PRV0 /'SCR$MASK'/
	DATA		PRV1 /'PRV$RESULT'/
	DATA HELP1 /72,69,76,80,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	9 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/
	DATA HELP3 /72,69,76,80,32,77,69,78,85/
	DATA NUMS /32,49,32,50,32,51,32,52,32,53,32,54,32,55,32,56,
	9 32,57,49,48,49,49,49,50,49,51,49,52,49,53,49,54,49,55,49,
	9 56,49,57,50,48,50,49,50,50,50,51,50,52,50,53,50,54,50,55,
	9 50,56,50,57,51,48,51,49,51,50,51,51,51,52,51,53,51,54,51,
	9 55,51,56,51,57,52,48,52,49,52,50,52,51,52,52,52,53,52,54,
	9 52,55,52,56,52,57,53,48,53,49,53,50,53,51,53,52,53,53,53,
	9 54,53,55,53,56,53,57,54,48,54,49,54,50,54,51,54,52,54,53,
	9 54,54,54,55,54,56,54,57,55,48,55,49,55,50,55,51,55,52,55,
	9 53,55,54,55,55,55,56,55,57,56,48,56,49,56,50,56,51,56,52,
	9 56,53,56,54,56,55,56,56,56,57,57,48,57,49,57,50,57,51,57,
	9 52,57,53,57,54,57,55,57,56,57,57/
	DATA CNUMS /48,49,48,50,48,51,48,52,48,53,48,54,48,55,48,56,
	9 48,57,49,48,49,49,49,50,49,51,49,52,49,53,49,54,49,55,49,
	9 56,49,57,50,48,50,49,50,50,50,51,50,52,50,53,50,54,50,55,
	9 50,56,50,57,51,48,51,49,51,50,51,51,51,52,51,53,51,54,51,
	9 55,51,56,51,57,52,48,52,49,52,50,52,51,52,52,52,53,52,54,
	9 52,55,52,56,52,57,53,48,53,49,53,50,53,51,53,52,53,53,53,
	9 54,53,55,53,56,53,57,54,48,54,49,54,50,54,51,54,52,54,53,
	9 54,54,54,55,54,56,54,57,55,48,55,49,55,50,55,51,55,52,55,
	9 53,55,54,55,55,55,56,55,57,56,48/
	DATA CURBUF /19,32,32,32,27,'[',0,0,';','3','H','-',
	9 '>',8,8,8,17/
	DATA CURBF2 /19,32,32,32,27,'[',0,0,';','4','3','H','-',
	9 '>',8,8,8,17/
	DATA TIMSTR /27,'[','1',';','5','5','H',0,0,0,0,0,0,0,0,0,0,
	9 0,0,0,0,0,0,0/
	DATA TMSTR /10,13,9,9,9,42,42,42,32,32,0,0,0,0,0,0,0,0,0,0,
	9 0,0,0,0,0,0,0,32,32,42,42,42,10,10,13/
	DATA	SUB_CALLED /0/
	DATA	RTURN	/0/
	DATA	INIT1	/1/
	DATA	JET	/0/
	DATA	BOTTOM	/0/
	DATA	SILNT	/1/
	DATA	IFFLAG	/0/
	DATA	VERBOS	/0/
	DATA	MASTER_LOCK /0/
	DATA	UNFORMAT_SCREEN /0/
	DATA	HARDLEN /0/
	DATA	BUILD	/0/
	DATA	NO_CR_LF /0/
	DATA	PRINT	/0/
	DATA	PRNTER	/0/
	DATA	PRNTR	/0/
	DATA	DOUBLE	/0/
	DATA	LENGX	/0/
	DATA	LEVEL	/1/
	DATA	CLIMOD	/0/
	DATA	NOMCR	/0/
	DATA	DEBUG	/0/
	DATA	SETFLG	/0/
	DATA	DCL	/0/
	DATA	SCOPE	/1/
	DATA	DUMB	/0/
	DATA	CALLFL	/0/
	DATA	OVERID	/1/
	DATA	READF1	/'31'X/
	DATA	READF2	/'7A'X/
	DATA	TIMER	/0,-1/
	DATA	NOWAIT	/1/
	DATA	JETTER	/6/
	DATA	CTLMASK /'2000000'X/
	DATA	MASK	/0/
	DATA	MASK_BLK /0/
	COMMON	/TIMER/TIMER
	COMMON	/ISTAT/ISTAT
	COMMON	/CLEAR/CLEAR
	COMMON	/WHOLE/WHOLE
	COMMON	/BOTTOM/BOTTOM
	COMMON	/SCOPE/SCOPE
	COMMON	/DUMB/DUMB
	COMMON	/ESC/ESC
	COMMON	/CR/CR
	COMMON	/LF/LF
	INTEGER*2 CHAN
	CHARACTER*10 LGCNM
	DATA LGCNM /'SYS$OUTPUT'/
	INTEGER*4 SYS$GETJPI
	INTEGER*4 ITEM(4),PRILEN,PRILIST(2)
	INTEGER*2 WITEM(2),WPRILST(4)
	EQUIVALENCE (WPRILST,PRILIST)
	EQUIVALENCE (ITEM,WITEM)
	DATA	WITEM	/8,'204'X/
	DATA	ITEM(4)	/0/
	ITEM(2)	= %LOC(PRILIST)
	ITEM(3) = %LOC(PRILEN)




C		ENTRY POINT INITIALIZATION

	CALL ERRSET (24,.TRUE.,.FALSE.,.TRUE.,.FALSE.)
	CALL ERRSET (29,.TRUE.,.FALSE.,.TRUE.,.FALSE.)
	CALL ERRSET (31,.TRUE.,.FALSE.,.TRUE.,.FALSE.)
	CALL ERRSET (64,.TRUE.,.FALSE.,.TRUE.,.FALSE.)
	CALL ERRSET (67,.TRUE.,.FALSE.,.TRUE.,.FALSE.)

	ISTAT = SYS$ASSIGN(LGCNM,CHAN,,)

	PARM10=%LOC(SCREEN)
	SPRM10=PARM10

C

C		DETERMINE IF SCOPE OR HARD_COPY HERE

 	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('27'X),,,,%REF(MODEST),
	9	%VAL(12),,,,)
	IF (IAND(MODEST(2),'1000'X) .NE. 0) THEN
	 IF (IAND(MODEST(3),'1000000'X) .EQ. 0) THEN
	  SCOPE = 0
	  DUMB = 1
	 ELSE
	  SCOPE = 1
	 ENDIF
	ELSE
	  SCOPE = 0
	ENDIF


C		PRIVILEGE TERMINAL CHECK

	ISTAT = SYS$GETJPI (,,,ITEM,,,)
	PRVMSK=0
	IF (IAND(WPRILST(2),'10004'O) .NE. 0) PRVMSK=1

C		LOAD TERMINAL NUMBER INTO "\\0" SUBSTITUTION STRING

	ISTAT = SYS$TRNLOG ('ID',DSW,MCR,,,)
	DSW=DSW-4
	DO 6,I=1,4
	TTNUM(I)=BMCR(DSW+I)
6	CONTINUE

C		GET SCRIPT MASK

	ISTAT = LIB$GET_SYMBOL (PRV0,PRV2,PRV3)

	IF (ISTAT .EQ. 1) DECODE (PRV3,2000,PRV2) MASK


C		GET COMMAND LINE AND PARSE COMMAND INVOKE TO FIRST SPACE

	ISTAT = LIB$GET_FOREIGN (MCR,'Please enter script file:  ',DSW)

	MLENG=1

C 	HERE FOR SWITCH PARSEING

	IF (BMCR(MLENG) .NE. '/') GOTO 11
3	DSW=DSW-1
	MLENG=MLENG+1
	  IF (BMCR(MLENG) .EQ. 'H') SCOPE=0
	  IF (BMCR(MLENG) .EQ. 'D') DEBUG=1
	  IF (BMCR(MLENG) .EQ. 'N') NOMCR=1
	  IF (BMCR(MLENG) .EQ. 'S') DCL=1
	  IF (BMCR(MLENG) .EQ. 'V') VERBOS=1
	  IF (BMCR(MLENG) .EQ. 'B') BUILD=1
	  IF (BMCR(MLENG) .EQ. 'L') THEN
	   MASTER_LOCK=1
	   ISTAT = LIB$DISABLE_CTRL (CTLMASK)
	  ENDIF
	  IF (BMCR(MLENG) .EQ. 'C') THEN
	   ISTAT = LIB$GET_SYMBOL (SCRCONTEXT1,CONTEXT(1:250))
	   ISTAT = LIB$GET_SYMBOL (SCRCONTEXT2,CONTEXT(251:500))
	   ISTAT = LIB$GET_SYMBOL (SCRCONTEXT3,CONTEXT(501:600))
	   ISTAT = LIB$GET_SYMBOL (SCRCONTEXT4,CONTEXT_LEVEL)
	   LEVEL=CONTEXT_LEVELB-48
	   IF ((LEVEL .LE. 0) .OR. (LEVEL .GT. 10)) LEVEL=1
	  ENDIF
	  IF (BMCR(MLENG) .EQ. ' ') GOTO 11
4	CONTINUE
	DSW=DSW-1
	MLENG=MLENG+1
	IF (BMCR(MLENG) .EQ. ' ') GOTO 11
	IF (BMCR(MLENG) .EQ. '/') GOTO 3
	GOTO 4


C		PARSE COMMAND LINE SUBSTITUTION STRINGS

11	CONTINUE
	IF (BMCR(MLENG) .EQ. ' ') THEN
	  MLENG=MLENG+1
	  DSW=DSW-1
	  IF (DSW .NE. 0) GOTO 11
	ENDIF
	IF (BMCR(MLENG) .NE. '"') GOTO 69

	LENGX=LENGX+1
	IF (LENGX .EQ. 7) GOTO 87

	FILIND=0
	MLENG=MLENG+1
	DSW=DSW-1

	DO 60, I=1,DSW

	  IF (BMCR(MLENG) .NE. '"') THEN
	    LINSUB(LENGX,I)=BMCR(MLENG)
	    MLENG=MLENG+1
	    DSW=DSW-1
	    GOTO 60

	  ELSE
	    MLENG=MLENG+2
	    DSW=DSW-2
	    GOTO 61

	  ENDIF
60	CONTINUE

	GOTO 87
61	CONTINUE
	GOTO 11

C		COMMON SCRIPT FILENAME PARSE ROUTINE
C		COMMON ENTRY FOR ALL FILE PARSE FROM P-CODE

69	CONTINUE

	FILIND=1
	FLAGEX=0
	IF (BMCR(MLENG) .NE. '$') GOTO 14

	DO 12, I=1,11
	  BILNAM(FILIND)=FILPRE(I)
	  FILIND=FILIND+1
12	CONTINUE	

	MLENG=MLENG+1
	DSW=DSW-1

	DO 13, I=1,DSW
	  BILNAM(FILIND)=BMCR(MLENG)
	  IF (BILNAM(FILIND) .EQ. '.') FLAGEX=1
	  MLENG=MLENG+1
	  FILIND=FILIND+1
13	CONTINUE
	GOTO 20

14	CONTINUE

	DO 15, I=1,DSW
	  BILNAM(FILIND)=BMCR(MLENG)
	  IF (BILNAM(FILIND) .EQ. '.') FLAGEX=1
	  IF (BILNAM(FILIND) .EQ. ']') FLAGEX=0
	  MLENG=MLENG+1
	  FILIND=FILIND+1
15	CONTINUE

20	CONTINUE
	IF (FLAGEX .EQ. 1) GOTO 25

	BILNAM(FILIND)='.'
	BILNAM(FILIND+1)='S'
	BILNAM(FILIND+2)='C'
	BILNAM(FILIND+3)='R'
25	CONTINUE

C		FIRST TIME THRU SAVE FILENAME FOR ZERO AND PF3 COMMANDS

	IF (INIT1 .EQ. 0) GOTO 50

	INIT1=0
	DO 30,I=1,50
	  ONEFIL(I)=BILNAM(I)
30	CONTINUE

C		OPEN THE FILE

50	CONTINUE
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1)) THEN
	 TYPE 1011,FILNAM
	 CALL DELAY
	ENDIF

	OPEN (UNIT=1,ERR=80,NAME=FILNAM,TYPE='OLD',READONLY,SHARED)

C		INITIALIZATION EVERY NEW SCRIPT

	IF (OVERID .EQ. 1) THEN
	  CLI=CLICLI
	  LOGOFF=0
	  IF (MASTER_LOCK .EQ. 0) THEN
	   LOCK=0
	  ELSE
	   LOCK=1
	  ENDIF
	  CURSOR=1
	  ALLOW=0
	  CLEAR=1
	  STPER=0
	  SILNT=1
	  PRINT=0
	  PRNTER=0
	  PRNTR=0
	  DOUBLE=0
	  UNFORMAT_SCREEN=0
	  WHOLE=1
	  BOTTOM=0
	  SPWN=5
	  CLEARD=1
	  STPERD=0
	  SILNTD=1
	  WHOLED=1
	  SPWND=5
	  ENDTSK=0
	  READF1='31'X
	  READF2='7A'X
	  PARM1=0

	ELSE
	  CLEAR=CLEARD
	  STPER=STPERD
	  SILNT=SILNTD
	  WHOLE=WHOLED
	  SPWN=SPWND
	  PARM1=PARM1D
	  IF (PARM1D .GT. 0) THEN
	   READF1='B1'X
	   READF2='FA'X
	  ELSE
	   READF1='31'X
	   READF2='7A'X
	  ENDIF

	ENDIF

	INITP=1
	NO_CR_LF=0
	GRAPHC=0
	PARM10=SPRM10
	TOPFLG=0
	OFFSET=1
	STATE=1
	FIRST=0
	LINE=1
	SEL=0
	SELOFF=1
	STROFF=1
	IF (NOMCR .EQ. 1) THEN
	  SILNT=0
	  SILNTD=0
	ENDIF

	SELBUF(6)=48
	SELBUF(7)=49

	IF (SCOPE .EQ. 1) THEN

	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='2'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='4'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=';'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='8'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='0'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='H'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='1'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='J'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='0'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='1'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=';'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='2'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='4'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='r'
	OFFSET=OFFSET+1

	ELSE

	SCREEN(OFFSET)=13
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=10
	OFFSET=OFFSET+1

	ENDIF

C		READ RECORD -- SCRIPT PARSING LOOP

	I = 0
	READ (1,2002,END=86)LENGX,BUFF1
	IF ((LENGX .EQ. 7) .AND. (BIT1(3) .EQ. '}')) GOTO 1101
	IF ((LENGX .NE. 1) .OR. (BIT1(1) .NE. ']')) GOTO 86

	DO 1, I=1,32000

	IF (LIST_STATE .EQ. 0) THEN

	 READ (1,2002,END=90)LENGTH,BUFFER

	ELSE

	 IF (LIST_STATE .EQ. 1) THEN
	  IF (L_BUFFER(1) .EQ. '@') THEN
	   OPEN (UNIT=3,ERR=1060,NAME=L_CHAR(2:L_LENGTH),TYPE='OLD'
	9  ,READONLY,SHARED)
	   LIST_STATE=2
	   LIST_SOURCE=1
	  ELSE
	   ISTAT = LIB$GET_SYMBOL (L_CHAR(1:L_LENGTH),S_CHAR,S_LENGTH)
	   IF (ISTAT .NE. 1) GOTO 1060
	   S_OFF=1
	   LIST_SOURCE=2
	   LIST_STATE=2
	  ENDIF
	 ENDIF

	 IF (LIST_STATE .EQ. 2) THEN
	  IF (LIST_SOURCE .EQ. 1) THEN
	   READ (3,2002,END=1060)L_LENGTH,L_CHAR
	  ELSE
	   IF (S_LENGTH .LE. 0) GOTO 1060
	   L_LENGTH=0
	   DO 2060 M=1,S_LENGTH
	    IF (S_BUFFER(S_OFF) .EQ. ',') GOTO 3060
	    L_LENGTH=L_LENGTH+1
	    L_BUFFER(M)=S_BUFFER(S_OFF)
	    S_OFF=S_OFF+1
	    S_LENGTH=S_LENGTH-1
2060	   CONTINUE
	   GOTO 4060
3060	  CONTINUE
	   S_OFF=S_OFF+1
	   S_LENGTH=S_LENGTH-1
4060	  CONTINUE
	  ENDIF
	  LIST_STATE=3
	  L_TEMP_OFF=0
	 ENDIF
	 IF (LIST_STATE .EQ. 3) THEN
	  L_TEMP_OFF=L_TEMP_OFF+1
	  LENGTH=LIST_LENGTH(L_TEMP_OFF)
	  BUFFER=LIST_CHAR(L_TEMP_OFF)
	  IF (L_TEMP_OFF .EQ. LIST_COUNT) LIST_STATE=2
	 ELSE
1060	  IF ((LIST_STATE .GT. 1) .AND.
	9     (LIST_SOURCE .EQ. 1)) CLOSE (UNIT=3)
	  LIST_STATE=0
	  GOTO 1
	 ENDIF

	ENDIF

C		SUBSTITUTION ROUTINES

	LENGX=0
	MLENG=1
	ENDMRK=1

	IF (LENGTH .EQ. 0) GOTO 66

1061	CONTINUE

	IF (BIT(MLENG) .NE. '^') GOTO 1067

	    FLAGEX = MLENG+1
	    LENGXX = LENGTH

1062	CONTINUE

	    LENGXX = LENGXX-1

	    IF ((BIT(FLAGEX) .EQ. ' ') .OR. (BIT(FLAGEX) .EQ. '\') .OR.
	9   (LENGXX .EQ. 0)) GOTO 1067

	    IF (BIT(FLAGEX) .NE. '^') THEN

	     FLAGEX = FLAGEX+1
	     GOTO 1062

	    ELSE

	     ISTAT = LIB$GET_SYMBOL (BUFFER(MLENG+1:FLAGEX-1),BUFF1(ENDMRK:),
	9                            LENG)

	     IF (ISTAT .NE. 1) THEN

	       ISTAT = SYS$TRNLOG (BUFFER(MLENG+1:FLAGEX-1),LENG,
	9			   BUFF1(ENDMRK:),,,)

	       IF (ISTAT .NE. 1) GOTO 1067

	     ENDIF

	     LENGTH = LENGXX
	     LENGX = LENGX+LENG
	     ENDMRK = ENDMRK+LENG
	     MLENG = FLAGEX + 1
	     GOTO 1068

	    ENDIF

1067	CONTINUE

	BIT1(ENDMRK) = BIT(MLENG)

	MLENG = MLENG+1
	LENGX = LENGX+1
	ENDMRK = ENDMRK+1

1068	CONTINUE

	LENGTH = LENGTH-1

	IF (LENGTH .GT. 0) GOTO 1061

	MLENG=1
62	CONTINUE
	IF (LENGX .EQ. 0) GOTO 68

	IF ((BIT1(MLENG) .NE. '\') .OR. (BIT1(MLENG+1) .NE.
	9 '\') .OR. (LENGX .LT. 3)) GOTO 67

	IF ((BIT1(MLENG+2) .EQ. '*') .AND. (LIST_STATE .NE. 0)) THEN
	  DO 1063 ,J=1,L_LENGTH
	    LENGTH=LENGTH+1
	    BIT(LENGTH)=L_BUFFER(J)
1063	  CONTINUE
	ELSE
	 FLAGEX=(BIT1(MLENG+2))-48

	 IF ((FLAGEX .LT. 0) .OR. (FLAGEX .GT. 6)) GOTO 67
	 IF (FLAGEX .EQ. 0) THEN

	  LENGTH=LENGTH+1
	  BIT(LENGTH)=TTNUM(1)
	  LENGTH=LENGTH+1
	  BIT(LENGTH)=TTNUM(2)
	  LENGTH=LENGTH+1
	  BIT(LENGTH)=TTNUM(3)
	  LENGTH=LENGTH+1
	  BIT(LENGTH)=TTNUM(4)

	 ELSE

	  DO 63 ,J=1,30
	    IF (LINSUB(FLAGEX,J) .EQ. 0) GOTO 63
	    LENGTH=LENGTH+1
	    BIT(LENGTH)=LINSUB(FLAGEX,J)
63	  CONTINUE

	 ENDIF
	ENDIF

	MLENG=MLENG+3
	LENGX=LENGX-3
	IF (LENGX .EQ. 0) GOTO 68
	GOTO 62

67	CONTINUE
	LENGTH=LENGTH+1
	BIT(LENGTH)=BIT1(MLENG)
	MLENG=MLENG+1
	LENGX=LENGX-1
	GOTO 62

68	CONTINUE
	IF ((LENGTH .GE. 132) .OR. (LENGTH .LE. 0)) GOTO 66

	DO 65, J=LENGTH+1,132
	  BIT(J)=0
65	CONTINUE

C		EOR DELIMITTER CHECK

66	CONTINUE
	LENGX=LENGTH

	IF (LENGTH .EQ. 0) THEN
	 IF ((MASK_BLK .NE. 1) .AND. (NO_CR_LF .NE. 1)) THEN
	  SCREEN(OFFSET)=10
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=13
	  OFFSET=OFFSET+1
	  LINE=LINE+1
	 ENDIF
	  GOTO 1
	ENDIF

	BOFF=1

C		RETURN POINT FOR PARTIAL RECORD


2	CONTINUE

	ENDMRK=INDEX(BUFFER(BOFF:),BCKSLH(1:1))

	IF (ENDMRK .EQ. 0) GOTO 101

	LENSAV=LENGTH
	LENGTH=ENDMRK-1
	LENGX=LENGTH

	IF (LENGTH .EQ. 0) THEN
	 IF ((MASK_BLK .NE. 1) .AND. (NO_CR_LF .NE.1)) THEN
	  SCREEN(OFFSET)=012
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=015
	  LINE=LINE+1
	  OFFSET=OFFSET+1
	 ENDIF
	  GOTO 190
	ENDIF

C		CONTROL CHARACTER PARSE

101	BOFFX=BOFF
	LENGX=LENGTH
	CONSUME=0
	DHDW=0
	DH=0

	DO 102,J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB)) 
	9     GOTO 103
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
102	CONTINUE

	IF (MASK_BLK .EQ. 1) GOTO 190
	GOTO 110

103	CONTINUE

	IF (BIT(BOFFX) .EQ. ';') GOTO 190
	IF (BIT(BOFF) .EQ. ']') GOTO 160

	IF (MASK_BLK .EQ. 1) THEN
	  IF ((BIT(BOFF) .NE. '$') .AND. (BIT(BOFF) .NE. '%') .AND.
	9 (BIT(BOFF) .NE. '~')) THEN
	    IF (STATE .NE. 4) GOTO 190
	    MASK_BLK=0
	    GOTO 110
	  ENDIF
	  IF ((STATE .EQ. 4) .AND. (BIT(BOFF) .EQ. '~')) THEN
	    MASK_BLK=0
	    GOTO 1103
	  ENDIF
	  IF (BIT(BOFF) .NE. '~') STATE=4
	  GOTO 190
	ENDIF

	IF (((STATE .EQ. 2) .OR. (STATE .EQ. 4)) .AND.
	9 (BIT(BOFF) .EQ. '~')) THEN

1103	 CONTINUE

	 LENGTH=LENGTH-1
	 IF (LENGTH .EQ. 0) GOTO 4103
	 BOFF=BOFF+1

	 DO 2103,J=1,LENGTH
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB)) 
	9 GOTO 3103
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
2103	 CONTINUE

	 GOTO 4103

3103	 CONTINUE

	 DECODE (LENGTH,2000,BUFFER(BOFF:LENGTH+BOFF)) FLAGEX

	 IF (FLAGEX .GT. 32) GOTO 190
	 IF (FLAGEX .EQ. 0) GOTO 4103

	 IF (IAND(BIGMASK(FLAGEX),MASK) .NE. 0) GOTO 190
	 STATE=3
	 MASK_BLK=1
	 GOTO 190

4103	 CONTINUE

	 IF(IAND(PRVMSK,1) .NE. 0) GOTO 190
	 STATE=3
	 MASK_BLK=1
	 GOTO 190

	ENDIF


	IF ((BIT(BOFF) .NE. '$') .AND. (BIT(BOFF) .NE. '%')) 
	9 GOTO 110
	IF (BIT(BOFF) .NE. '%') GOTO 120

C		HERE ON CONTROL CHARACTER "%"

	LENGTH=LENGTH-1
	BOFF=BOFF+1

	DO 122,J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB)) 
	9 GOTO 133
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
122	CONTINUE

	GOTO 190
133	CONTINUE

C		LOWERCASE CHECK CONVERT 

	DO 1133,J=1,LENGTH
	  IF (BIT(BOFF-1+J) .LE. ' ') GOTO 2133
	  IF ((BIT(BOFF-1+J) .LT. 'a') .OR. (BIT(BOFF-1+J)
	9 .GT. 'z')) GOTO 1133
	  BIT(BOFF-1+J)=BIT(BOFF-1+J)-SPACE
1133	CONTINUE

2133	CONTINUE

C		STATE DISPATCH FOR %

	GOTO (104,1104,105,106,86)STATE

C		STATE 1 FOR % PCODE GENERATION OF SCRIPT INITIALIZTION

104	CONTINUE

	IF ((BIT(BOFF) .LT. 'A') .OR. (BIT(BOFF) .GT. 'X')) GOTO 109

	FUNC=(BIT(BOFF)-64)

	GOTO (801,802,803,804,805,806,807,808,809,109,811,812,813,
	9     814,815,816,817,818,819,820,821,822,823,824)FUNC

801	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELCT1(SELOFF)=29			!ALLOW
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'P') THEN
	  SELCT1(SELOFF)=66			!APPEND
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELCT1(SELOFF)=70			!AND
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .NE. 'S') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .NE. 'K') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+3) .EQ. 'S') THEN
	  SELCT1(SELOFF)=16			!ASKS
	  GOTO 108
	ELSEIF (BIT(BOFF+3) .EQ. 'L') THEN
	  SELCT1(SELOFF)=73			!ASKL
	  GOTO 108
	ELSEIF ((BIT(BOFF+3) .EQ. 32) .OR. (BIT(BOFF+3) .EQ. 9)) THEN
	  SELCT1(SELOFF)=15			!ASK
	  GOTO 108
	ELSEIF (BIT(BOFF+3) .EQ. '?') THEN
	  SELCT1(SELOFF)=36			!ASK?
	  GOTO 108
	ELSE
	  GOTO 109
	ENDIF

802	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELCT1(SELOFF)=17			!BATCH
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELCT1(SELOFF)=27			!BLOCK
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELCT1(SELOFF)=65			!BOTTOM
	  GOTO 118
	ELSE
	  GOTO 109
	ENDIF

803	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELCT1(SELOFF)=26			!CONTINUE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'H') THEN
	  SELCT1(SELOFF)=56			!CHAIN
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELCT1(SELOFF)=13			!CALL
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .NE. 'L') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'E') THEN
	  SELCT1(SELOFF)=7			!CLEAR
	  GOTO 118
	ELSEIF (BIT(BOFF+2) .EQ. 'I') THEN
 	 SELCT1(SELOFF)=24			!CLI
 	 GOTO 108
	ELSEIF (BIT(BOFF+2) .EQ. 'O') THEN
	 IF (BIT(BOFF+3) .EQ. 'S') THEN
	  SELCT1(SELOFF)=60			!CLOSE
	  GOTO 118
	 ELSEIF (BIT(BOFF+3) .EQ. 'C') THEN
	  SELCT1(SELOFF)=71			!CLOCK
	  GOTO 118
	 ELSE
	  GOTO 109
	 ENDIF
	ELSE
	 GOTO 109
 	ENDIF

804	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELCT1(SELOFF)=30			!DISALLOW
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  GRAPHC=2				!DATE
	  GOTO 190
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELCT1(SELOFF)=76			!DELETE LOGICAL
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'S') THEN
	  SELCT1(SELOFF)=77			!DELETE SYMBOL
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .NE. 'E') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'B') THEN
	  DEBUG=1				!DEBUG
	  GOTO 190
	ELSEIF (BIT(BOFF+2) .EQ. 'L') THEN
	  SELCT1(SELOFF)=48			!DELAY
	  GOTO 108
	ELSE
	  GOTO 109
	ENDIF

805	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELCT1(SELOFF)=52			!END
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'X') THEN
	  SELCT1(SELOFF)=20			!EXIT
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELCT1(SELOFF)=74			!ERROR
	  GOTO 118
	ELSE
	  GOTO 109
	ENDIF

806	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELCT1(SELOFF)=32			!FREE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELCT1(SELOFF)=79			!FILE
	  GOTO 118
	ELSE
	  GOTO 109
	ENDIF

807	CONTINUE
	IF (BIT(BOFF+1) .NE. 'R') GOTO 8807
	GRAPHC=1				!GRAPHIC
	FLAGEX=0
9807	CONTINUE				!GRAPHIC/LAST COMMON CODE
	DO 1807, J=1,LENGTH
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB))
	9  GOTO 2807
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
1807	CONTINUE
	GOTO 109

2807	CONTINUE

	DO 3807, J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9  GOTO 4807
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
3807	CONTINUE
	GOTO 109

4807	CONTINUE

	BOFF=BOFF-1

	IF (FLAGEX .EQ. 0) THEN

	GRPHLN=LENGTH				!GRAPHIC
	DO 5807, K=1,LENGTH
	  GRPHBF(K)=BIT(BOFF+K)
5807	CONTINUE

	ELSE

	IF (BIT(BOFF+1) .NE. '"') THEN

	ENDLN=LENGTH				!LAST
	DO 6807, K=1,LENGTH
	  ENDBUF(K)=BIT(BOFF+K)
6807	CONTINUE

	ELSE

	HARDLEN=LENGTH-2
	BOFF=BOFF+1
	DO 7807, K=1,LENGTH-2
	  HARDBUF(K)=BIT(BOFF+K)		!HARD
7807	CONTINUE
	ENDIF

	ENDIF
	GOTO 190

8807	CONTINUE
	IF (BIT(BOFF+1) .NE. 'O') GOTO 109
	SELCT1(SELOFF)=3			!GOTO
	GOTO 108

808	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELCT1(SELOFF)=6			!HOLD
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .NE. 'A') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'L') THEN
	  SELCT1(SELOFF)=54			!HALT
	  GOTO 118
	ELSEIF (BIT(BOFF+2) .EQ. 'R') THEN	!HARD
	 IF ((SCOPE .EQ. 0) .AND. (DUMB .EQ. 0)) THEN
	  FLAGEX=1
	  GOTO 9807
	 ELSE
	  GOTO 190
	 ENDIF
	ELSE
	  GOTO 109
	ENDIF

809	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELCT1(SELOFF)=19			!INQUIRE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'S') THEN
	  SELCT1(SELOFF)=59			!ISOLATE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .NE. 'F') THEN
	  GOTO 109
	ELSEIF ((BIT(BOFF+2) .EQ. 32) .OR. (BIT(BOFF+2) .EQ. 9)) THEN
	  IFFLAG=1
	  SELCT1(SELOFF)=35			!IF
	  GOTO 108
	ELSEIF (BIT(BOFF+2) .EQ. 'N') THEN
	  IFFLAG=1
	  SELCT1(SELOFF)=49			!IFNOT
	  GOTO 108
	ELSE
	  GOTO 109
	ENDIF

811	CONTINUE
	SELCT1(SELOFF)=55			!KILL LAST
	GOTO 118

812	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'O') THEN
	 IF (BIT(BOFF+2) .EQ. 'C') THEN
	  SELCT1(SELOFF)=40			!LOCK
	  GOTO 118
	 ELSEIF (BIT(BOFF+2) .EQ. 'G') THEN
	  IF (BIT(BOFF+3) .EQ. 'I') THEN
	   SELCT1(SELOFF)=58			!LOGICAL
	   GOTO 108
	  ELSE
	   SELCT1(SELOFF)=81			!LOG
	   GOTO 108
	  ENDIF
	 ELSEIF (BIT(BOFF+2) .EQ. 'O') THEN
	  SELCT1(SELOFF)=72			!LOOP
	  GOTO 118
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  GOTO 1913 				!LIST PROCESSING
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  FLAGEX=1				!LAST
	  ENDTSK=1
	  GOTO 9807				!GOTO LAST/GRAPHIC COMMON CODE
	ELSE
	  GOTO 109
	ENDIF

813	CONTINUE
	SELCT1(SELOFF)=47			!MAINTAIN
	GOTO 118

814	CONTINUE
	SELCT1(SELOFF)=8			!NO CLEAR
	GOTO 118

815	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELCT1(SELOFF)=42			!ON
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'F') THEN
	  SELCT1(SELOFF)=43			!OFF
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'V') THEN
	  SELCT1(SELOFF)=46			!OVERIDE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'P') THEN
	  SELCT1(SELOFF)=61			!OPEN
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELCT1(SELOFF)=69			!OR
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'U') THEN
	  SELCT1(SELOFF)=80			!OUTPUT
	  GOTO 108
	ELSE
	  GOTO 109
	ENDIF

816	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELCT1(SELOFF)=21			!PASSWORD
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .NE. 'R') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'I') THEN
	 IF (BIT(BOFF+3) .EQ. 'V') THEN
	  SELCT1(SELOFF)=34			!PRIVILEGE
	  GOTO 118
	 ELSEIF (BIT(BOFF+3) .EQ. 'N') THEN
	  SELCT1(SELOFF)=67			!PRINTER
	  GOTO 108
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+2) .NE. 'O') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+3) .EQ. 'C') THEN
	  SELCT1(SELOFF)=10			!PROCEED ON ERR
	  GOTO 118
	ELSEIF (BIT(BOFF+3) .EQ. 'M') THEN
	  SELCT1(SELOFF)=28			!PROMPT
	  GOTO 118
	ELSEIF (BIT(BOFF+3) .EQ. 'T') THEN
	  IF ((IAND(1,PRVMSK)) .EQ. 0) GOTO 186	!PROTECT
	  GOTO 190
	ELSE
	  GOTO 109
	ENDIF

817	CONTINUE
	SELCT1(SELOFF)=4			!QUERY
	GOTO 118

818	CONTINUE
	SELCT1(SELOFF)=14			!RETURN
	GOTO 118

819	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'T') THEN
	 IF (BIT(BOFF+2) .EQ. 'O') THEN
	  SELCT1(SELOFF)=9			!STOP ON ERR
	  GOTO 118
	 ELSEIF (BIT(BOFF+2) .EQ. 'R') THEN
	  SELCT1(SELOFF)=75			!STRING
	  GOTO 108
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'P') THEN
	  SELCT1(SELOFF)=23			!SPLIT
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELCT1(SELOFF)=11			!SILENT
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELCT1(SELOFF)=31			!SLAVE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'E') THEN
	  SELCT1(SELOFF)=53			!SET
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'Y') THEN
	  SELCT1(SELOFF)=57			!SYMBOL
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'H') THEN
	  SELCT1(SELOFF)=64			!SHOW FILE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELCT1(SELOFF)=78			!SAVE
	  GOTO 118
	ELSE
	  GOTO 109
	ENDIF

820	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'E') THEN
	  SELCT1(SELOFF)=18			!TEXT
	  GOTO 108
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELCT1(SELOFF)=33			!TIMEOUT
	  GOTO 108
	ELSE
	  GOTO 109
        ENDIF

821	CONTINUE
	IF (BIT(BOFF+1) .NE. 'N') GOTO 109
	IF (BIT(BOFF+2) .EQ. 'L') THEN
	 SELCT1(SELOFF)=41			!UNLOCK
	 GOTO 118
	ELSEIF (BIT(BOFF+2) .EQ. 'F') THEN
	 IF (SCOPE .EQ. 1) UNFORMAT_SCREEN=1	!UNFORMATTED_SCREEN
	 GOTO 190
	ELSE
	 GOTO 109
	ENDIF

822	CONTINUE
	SELCT1(SELOFF)=12			!VERBOSE
	GOTO 118

823	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELCT1(SELOFF)=5			!WAIT
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'H') THEN
	  SELCT1(SELOFF)=22			!WHOLE
	  GOTO 118
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELCT1(SELOFF)=62			!WRITE
	  GOTO 108
	ELSE
	  GOTO 109
	ENDIF

824	CONTINUE
	SELCT1(SELOFF)=50			!XSTATUS
	GOTO 108

C		STATE 1 PCODE STRING POINTER SETUP

118	CONTINUE
	SELOFF=SELOFF+1
	SELCT1(SELOFF)=0
	SELOFF=SELOFF+1
	GOTO 190

108	CONTINUE
	SELOFF=SELOFF+1
	SELCT1(SELOFF)=STROFF
	SELOFF=SELOFF+1
	GOTO 107

C		STATE 3/4 PCODE STRING POINTER SETUP

1118	CONTINUE
	SELOFF=SELOFF+1
	SELECT(SELOFF)=0
	SELOFF=SELOFF+1
	GOTO 190

1108	CONTINUE
	SELOFF=SELOFF+1
	SELECT(SELOFF)=STROFF
	SELOFF=SELOFF+1
	GOTO 107

1104	CONTINUE
	IF ((BIT(BOFF) .EQ. 'L') .AND. (BIT(BOFF+1) .EQ. 'I')) GOTO 1913
	GOTO 86

C		STATE 3 PCODE

105	CONTINUE
	STATE=4

C		STATE 3/4 PCODE PARSE FOR "%"

106	CONTINUE
	IF (BIT(BOFF) .EQ. '?') THEN
1106	  SELECT(SELOFF)=2			!HELP
	  GOTO 1108
	ENDIF

	IF ((BIT(BOFF) .LT. 'A') .OR. (BIT(BOFF) .GT. 'Z')) GOTO 109

	FUNC=(BIT(BOFF)-64)

	GOTO (901,902,903,904,905,906,907,908,909,109,911,912,109,
	9     914,915,916,917,918,919,920,921,922,923,924,109,926)FUNC

901	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'G') THEN
	  SELECT(SELOFF)=25			!AGAIN
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'P') THEN
	  SELECT(SELOFF)=66			!APPEND
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELECT(SELOFF)=70			!AND
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .NE. 'S') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .NE. 'K') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+3) .EQ. 'S') THEN
	  SELECT(SELOFF)=16			!ASKS
	  GOTO 1108
	ELSEIF (BIT(BOFF+3) .EQ. 'L') THEN
	  SELECT(SELOFF)=73			!ASKL
	  GOTO 1108
	ELSEIF ((BIT(BOFF+3) .EQ. 32) .OR. (BIT(BOFF+3) .EQ. 9)) THEN
	  SELECT(SELOFF)=15			!ASK
	  GOTO 1108
	ELSEIF (BIT(BOFF+3) .EQ. '?') THEN
	  SELECT(SELOFF)=36			!ASK?
	  GOTO 1108
	ELSE
	  GOTO 109
	ENDIF

902	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELECT(SELOFF)=17			!BATCH
	  GOTO 1118
        ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELECT(SELOFF)=27			!BLOCK
	  GOTO 1118
        ELSEIF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELECT(SELOFF)=65			!BOTTOM
	  GOTO 1118
	ELSE
	  GOTO 109
	ENDIF

903	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'L') THEN
	 IF (BIT(BOFF+2) .EQ. 'E') THEN
	  SELECT(SELOFF)=7			!CLEAR
	  GOTO 1118
	 ELSEIF (BIT(BOFF+2) .EQ. 'O') THEN
	  IF (BIT(BOFF+3) .EQ. 'S') THEN
	   SELECT(SELOFF)=60			!CLOSE
	   GOTO 1118
	  ELSEIF (BIT(BOFF+3) .EQ. 'C') THEN
	   SELECT(SELOFF)=71			!CLOCK
	   GOTO 1118
	  ELSE
	   GOTO 109
	  ENDIF
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELECT(SELOFF)=13			!CALL
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'H') THEN
	  IF (BIT(BOFF+2) .EQ. 'O') THEN
	    SELECT(SELOFF)=39			!CHOICE
	    GOTO 1118
	  ELSEIF (BIT(BOFF+2) .EQ. 'A') THEN
	    SELECT(SELOFF)=56			!CHAIN
	    GOTO 1108
	  ELSE
	    GOTO 109
	  ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELECT(SELOFF)=26			!CONTINUE
	  GOTO 1118
	ELSE
	  GOTO 109
	ENDIF

904	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'E') THEN
	  SELECT(SELOFF)=48			!DELAY
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELECT(SELOFF)=76			!DELETE LOGICAL
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'S') THEN
	  SELECT(SELOFF)=77			!DELETE SYMBOL
	  GOTO 1108
	ELSE
	  GOTO 109
	ENDIF

905	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'X') THEN
	  SELECT(SELOFF)=20			!EXIT
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	 IF (BIT(BOFF+2) .EQ. 'R') THEN
	  SELECT(SELOFF)=74			!ERROR
	  GOTO 1118
	 ELSEIF (BIT(BOFF+2) .EQ. 'A') THEN
	  SELECT(SELOFF)=44			!ERASE
	  GOTO 1118
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELECT(SELOFF)=52			!END
	  GOTO 1118
	ELSE
	  GOTO 109
	ENDIF

906	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELECT(SELOFF)=32			!FREE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELECT(SELOFF)=79			!FILE
	  GOTO 1118
	ELSE
	  GOTO 109
	ENDIF

	SELECT(SELOFF)=32			!FREE
	GOTO 1118

907	CONTINUE
	SELECT(SELOFF)=3			!GOTO
	GOTO 1108

908	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELECT(SELOFF)=6			!HOLD
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'E') THEN
	  GOTO 1106				!HELP
	ELSE
	  GOTO 109
	ENDIF

909	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELECT(SELOFF)=19			!INQUIRE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'S') THEN
	  SELECT(SELOFF)=59			!ISOLATE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .NE. 'F') THEN
	  GOTO 109
        ELSEIF ((BIT(BOFF+2) .EQ. 32) .OR. (BIT(BOFF+2) .EQ. 9)) THEN
	  IFFLAG=1
	  SELECT(SELOFF)=35			!IF
	  GOTO 1108
	ELSEIF (BIT(BOFF+2) .EQ. 'N') THEN	!IFNOT
	  IFFLAG=1
 	  SELECT(SELOFF)=49
	  GOTO 1108
	ELSE
	  GOTO 109
	ENDIF

911	CONTINUE
	SELECT(SELOFF)=55			!KILL LAST
	GOTO 1118

912	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'O') THEN
	 IF (BIT(BOFF+2) .EQ. 'C') THEN
	  SELECT(SELOFF)=40			!LOCK
	  GOTO 1118
	 ELSEIF (BIT(BOFF+2) .EQ. 'G') THEN
	  IF (BIT(BOFF+3) .EQ. 'I') THEN
	   SELECT(SELOFF)=58			!LOGICAL
	   GOTO 1108
	  ELSE
	   SELECT(SELOFF)=81			!LOG
	   GOTO 1108
	  ENDIF
	 ELSEIF (BIT(BOFF+2) .EQ. 'O') THEN
	  SELECT(SELOFF)=72			!LOOP
	  GOTO 1118
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
1913	 CONTINUE				!LIST PROCESSING
	DO 5913, J=1,LENGTH
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB))
	9  GOTO 15913
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
5913	CONTINUE
	GOTO 109

15913	CONTINUE

	DO 6913, J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9  GOTO 16913
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
6913	CONTINUE
	GOTO 109

16913	CONTINUE

	BOFF=BOFF-1

	L_LENGTH=LENGTH

	DO 7913, K=1,LENGTH
	  L_BUFFER(K)=BIT(BOFF+K)
7913	CONTINUE

	 LIST_COUNT=0

	 DO 2913 J=1,20

	  READ (1,2002,END=109)LIST_LENGTH(J),LIST_CHAR(J)(1:132)

	  LIST_COUNT=LIST_COUNT+1
	  L_TEMP_LENG=LIST_LENGTH(J)
	  L_TEMP_OFF=1

	  DO 12913 K=1,L_TEMP_LENG

	   IF ((LIST_BUFFER(K,J) .NE. SPACE) .AND. (LIST_BUFFER(K,J) .NE. TAB)) 
	9	GOTO 3913
	   L_TEMP_LENG=L_TEMP_LENG-1
	   L_TEMP_OFF=L_TEMP_OFF+1

12913	 CONTINUE

2913	 CONTINUE
	 GOTO 109

3913	 CONTINUE

	 IF (LIST_BUFFER(L_TEMP_OFF,LIST_COUNT) .NE. '%') GOTO 2913

	 L_TEMP_LENG=L_TEMP_LENG-1
	 L_TEMP_OFF=L_TEMP_OFF+1

	 DO 22913 K=L_TEMP_OFF,L_TEMP_LENG+L_TEMP_OFF-1

	   IF ((LIST_BUFFER(K,LIST_COUNT) .NE. SPACE)
	9  .AND. (LIST_BUFFER(K,LIST_COUNT) .NE. TAB)) GOTO 4913
	   L_TEMP_LENG=L_TEMP_LENG-1
	   L_TEMP_OFF=L_TEMP_OFF+1

22913	 CONTINUE
	 GOTO 109

4913	 CONTINUE

	  IF ((LIST_BUFFER(L_TEMP_OFF,LIST_COUNT) .NE. 'L') .AND.
	9    (LIST_BUFFER(L_TEMP_OFF,LIST_COUNT) .NE. 'l')) GOTO 2913
	   L_TEMP_LENG=L_TEMP_LENG-1
	  IF (L_TEMP_LENG .EQ. 0) GOTO 2913
	   L_TEMP_OFF=L_TEMP_OFF+1
	  IF ((LIST_BUFFER(L_TEMP_OFF,LIST_COUNT) .NE. 'I') .AND.
	9    (LIST_BUFFER(L_TEMP_OFF,LIST_COUNT) .NE. 'i')) GOTO 2913

	 LIST_STATE=1
	 ENDMRK=0
	 LIST_COUNT=LIST_COUNT-1
	 IF (LIST_COUNT .LE. 0) LIST_STATE=0
	 GOTO 190

	ELSE
	 GOTO 109
	ENDIF

914	CONTINUE
	SELECT(SELOFF)=8			!NO CLEAR
	GOTO 1118

915	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'N') THEN
	  SELECT(SELOFF)=42			!ON
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'F') THEN
	  SELECT(SELOFF)=43			!OFF
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'P') THEN
	  SELECT(SELOFF)=61			!OPEN
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELECT(SELOFF)=69			!OR
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'U') THEN
	  SELECT(SELOFF)=80			!OUTPUT
	  GOTO 1108
	ELSE
	  GOTO 109
	ENDIF

916	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELECT(SELOFF)=21			!PASSWORD
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .NE. 'R') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'O') THEN
	  IF (BIT(BOFF+3) .EQ. 'C') THEN
	   SELECT(SELOFF)=10			!PROCEED ON ERR
	   GOTO 1118
	  ELSEIF (BIT(BOFF+3) .EQ. 'T') THEN
	   SELECT(SELOFF)=68			!PROTECT
	   GOTO 1118
	  ELSE
	   GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+2) .EQ. 'I') THEN
	 IF (BIT(BOFF+3) .EQ. 'V') THEN
	  SELECT(SELOFF)=34			!PRIVILEGE
	  GOTO 1118
	 ELSEIF (BIT(BOFF+3) .EQ. 'N') THEN
	  SELECT(SELOFF)=67			!PRINTER
	  GOTO 1108
	 ELSE
	  GOTO 109
	 ENDIF
	ELSE
	  GOTO 109
	ENDIF

917	CONTINUE
	SELECT(SELOFF)=4			!QUERY
	GOTO 1118

918	CONTINUE
	IF (BIT(BOFF+1) .NE. 'E') THEN
	  GOTO 109
	ELSEIF (BIT(BOFF+2) .EQ. 'T') THEN
	  SELECT(SELOFF)=14			!RETURN
	  GOTO 1118
	ELSEIF (BIT(BOFF+2) .EQ. 'S') THEN
	  SELECT(SELOFF)=45			!RESET
	  GOTO 1118
	ELSEIF (BIT(BOFF+2) .EQ. 'C') THEN
	  SELECT(SELOFF)=63			!RECALULATE
	  GOTO 1118
	ELSE
	  GOTO 109
	ENDIF

919	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'T') THEN
	 IF (BIT(BOFF+2) .EQ. 'O') THEN
	  SELECT(SELOFF)=9			!STOP ON ERR
	  GOTO 1118
	 ELSEIF (BIT(BOFF+2) .EQ. 'R') THEN
	  SELECT(SELOFF)=75			!STRING
	  GOTO 1108
	 ELSE
	  GOTO 109
	 ENDIF
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	  SELECT(SELOFF)=11			!SILENT
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN
	  SELECT(SELOFF)=31			!SLAVE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'E') THEN
	  SELECT(SELOFF)=53			!SET
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'Y') THEN
	  SELECT(SELOFF)=57			!SYMBOL
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'H') THEN
	  SELECT(SELOFF)=64			!SHOW FILE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELECT(SELOFF)=78			!SAVE
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'U') THEN
	  SELECT(SELOFF)=82			!SUB_ROUTINE
	  GOTO 1108
	ELSE
	  GOTO  109
	ENDIF

920	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'E') THEN
	  SELECT(SELOFF)=18			!TEXT
	  GOTO 1108
	ELSEIF (BIT(BOFF+1) .EQ. 'O') THEN
	  SELECT(SELOFF)=38			!TOP
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'I') THEN
	 IF (BIT(BOFF+2) .EQ. 'T') THEN
	  SELECT(SELOFF)=37			!TITLE
	  GOTO 1108
	 ELSEIF (BIT(BOFF+2) .EQ. 'M') THEN
	  SELECT(SELOFF)=33			!TIMEOUT
	  GOTO 1108
	 ELSE
	  GOTO  109
	 ENDIF
	ELSE
	  GOTO  109
	ENDIF

921	CONTINUE
	SELECT(SELOFF)=41			!UNLOCK
	GOTO 1118

922	CONTINUE
	SELECT(SELOFF)=12			!VERBOSE
	GOTO 1118

923	CONTINUE
	IF (BIT(BOFF+1) .EQ. 'A') THEN
	  SELECT(SELOFF)=5			!WAIT
	  GOTO 1118
	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN
	  SELECT (SELOFF)=62			!WRITE
	  GOTO 1108
	ENDIF

924	CONTINUE
	SELECT(SELOFF)=50			!XSTATUS
	GOTO 1108

926	CONTINUE
	SELECT(SELOFF)=51			!ZERO
	GOTO 1118

C		STRIP % COMMAND AND SPACES

107	CONTINUE

	DO 191, J=1,LENGTH
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB))
	9  GOTO 192
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
191	CONTINUE
	GOTO 109

192	CONTINUE

	DO 193, J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9  GOTO 194
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
193	CONTINUE
	GOTO 109

C		STORE THE STRING

194	CONTINUE


	IF (IFFLAG .NE. 0) THEN

	  IFFLAG=STROFF
	  STRING(STROFF)=0
	  STROFF=STROFF+1
	DO 196, K=BOFF,BOFF+LENGTH-1
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB))
	9  GOTO 197
	  STRING(IFFLAG)=STRING(IFFLAG)+1
 	  STRING(STROFF)=BIT(BOFF)
	  BOFF=BOFF+1
	  STROFF=STROFF+1
	  LENGTH=LENGTH-1
196	CONTINUE
	  IFFLAG=0
	  GOTO 190
197	CONTINUE
	IFFLAG=0
	DO 198, J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9  GOTO 199
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
198	CONTINUE
	GOTO 190
199	CONTINUE
	DO 1199, J=1,LENGTH
	  IF ((BIT(BOFF) .EQ. SPACE) .OR. (BIT(BOFF) .EQ. TAB))
	9  GOTO 2199
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
1199	CONTINUE
	GOTO 190
2199	CONTINUE
	DO 3199, J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9  GOTO 2
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
3199	CONTINUE
	GOTO 190
	ENDIF

	STRING(STROFF)=LENGTH
	STROFF=STROFF+1

	DO 195, K=BOFF,BOFF+LENGTH-1
 	  STRING(STROFF)=BIT(K)
	  STROFF=STROFF+1
195	CONTINUE
	GOTO 190

109	CONTINUE
	GOTO 86

C		COMMAND "$" PARSING

120	CONTINUE
	BOFF=BOFF+1
	LENGTH=LENGTH-1

	DO 144,J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB))
	9    GOTO 155
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
144	CONTINUE
	GOTO 190

C		STATE DISPATCH FOR "$"

155	CONTINUE

	GOTO (150,86,151,152,86)STATE

C		STATE 1 FOR "$"

150	CONTINUE
	SELCT1(SELOFF)=1
	SELOFF=SELOFF+1
	SELCT1(SELOFF)=STROFF
	GOTO 156

C		STATE 3 FOR "$"

151	CONTINUE
	STATE=4

C		STATE 4 FOR "$"

152	CONTINUE
	SELECT(SELOFF)=1
	SELOFF=SELOFF+1
	SELECT(SELOFF)=STROFF

C		COMMON CODE FOR "$"

156	CONTINUE
	SELOFF=SELOFF+1
	STRING(STROFF)=LENGTH
	STROFF=STROFF+1

	DO 157,J=BOFF,BOFF+LENGTH-1
	  STRING(STROFF)=BIT(J)
	  STROFF=STROFF+1
157	CONTINUE
	GOTO 190

C		TEXT RECORDS PROCESSING

110	CONTINUE

	BOFF=BOFFX
	LENGTH=LENGX
	IF (NO_CR_LF .NE. 1) THEN
	 SCREEN(OFFSET)=13
	 OFFSET=OFFSET+1
	ENDIF

	IF (STATE .EQ. 5) THEN
	  IF (FIRST .EQ. 1) THEN
	    FIRST=0
	  ELSE
	   IF (NO_CR_LF .NE. 1) THEN
	    SCREEN(OFFSET)=10
	    OFFSET=OFFSET+1
	    LINE=LINE+1
	   ENDIF
	  ENDIF
	ENDIF

C		TEXT STATE DISPATCHING

	IF ((BIT(BOFF) .EQ. '!') .AND. (LENGTH .GE. 7)
	9  .AND. ((BIT(BOFF+1) .GE. '0') .AND. (BIT(BOFF+1) .LE. '2'))) THEN
	 IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+1)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+2)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=';'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+4)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+5)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='H'
	  OFFSET=OFFSET+1
	  LINE=((BIT(BOFF+1)-48)*10)+(BIT(BOFF+2)-48)
	 ENDIF
	  CONSUME=CONSUME+7
	  BOFF=BOFF+7
	  LENGTH=LENGTH-7
	  IF (LENGTH .EQ. 0) GOTO 190
	ENDIF
	
	GOTO (111,112,113,112,111)STATE

C		TEXT STATE 1/5

111	CONTINUE
	FLAGEX=0
	TTSEL=0

C		TEXT COMMON CODE AND ATTRIBUTE PARSING

115	CONTINUE
	IF ((BIT(BOFF) .NE. '!') .OR. (LENGTH .LT. 2)) THEN

1115	  CONTINUE
	  SCREEN(OFFSET)=BIT(BOFF)
	  OFFSET=OFFSET+1
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
	  IF (LENGTH .EQ. 0 ) GOTO 9115
	  GOTO 115

	ELSEIF (BIT(BOFF+1) .EQ. 'A') THEN	!ASCII CHARACTER SET
	IF (SCOPE .EQ. 1) THEN
	  TTSEL=0
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='('
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='B'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'S') THEN	!SPECAIL CHARACTER SET
	IF (SCOPE .EQ. 1) THEN
	  TTSEL=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='('
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='2'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'G') THEN	!GRAPHIC CHARACTER SET
	IF (SCOPE .EQ. 1) THEN
	  TTSEL=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='('
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='0'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'N') THEN	!NORMAL ATTRIBUTE
	IF (SCOPE .EQ. 1) THEN
	  FLAGEX=0
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='0'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'B') THEN	!BOLD ATTRIBUTE
	IF (SCOPE .EQ. 1) THEN
	  FLAGEX=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='1'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'F') THEN	!FLASH ATTRIBUTE
	IF (SCOPE .EQ. 1) THEN
	  FLAGEX=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='5'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'U') THEN	!UNDERLINE ATTRIBUTE
	IF (SCOPE .EQ. 1) THEN
	  FLAGEX=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='4'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'R') THEN	!REVERSE ATTRIBUTE
	IF (SCOPE .EQ. 1) THEN
	  FLAGEX=1
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='7'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF ((BIT(BOFF+1) .EQ. 'H') .AND. (STATE .EQ. 1)
	9 .AND. (DHDW .EQ. 0) .AND. (DH .EQ. 0)) THEN
	IF (SCOPE .EQ. 1) THEN
	  DHDW=1				! DOUBLE HEIGHT LINE
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='#'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='3'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF ((BIT(BOFF+1) .EQ. 'H') .AND. (STATE .EQ. 1)
	9 .AND. (DHDW .EQ. 1)) THEN
	IF (SCOPE .EQ. 1) THEN
	  DHDW=0
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='#'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='4'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF ((BIT(BOFF+1) .EQ. 'T') .AND. (STATE .EQ. 1)
	9 .AND. (DH .EQ. 0) .AND. (DHDW .EQ. 0)) THEN
	IF (SCOPE .EQ. 1) THEN
	  DH=1					!TALL LINE
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='#'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=':'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF ((BIT(BOFF+1) .EQ. 'T') .AND. (STATE .EQ. 1)
	9 .AND. (DH .EQ. 1)) THEN
	IF (SCOPE .EQ. 1) THEN
	  DH=0
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='#'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=';'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. 'W') THEN	!WIDE LINE
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='#'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='6'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115

	ELSEIF (BIT(BOFF+1) .EQ. '<') THEN	!LEFT
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='D'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. '>') THEN	!RIGHT
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='C'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'd') THEN	!DOWN
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='B'
	  OFFSET=OFFSET+1
	  LINE=LINE+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'l') THEN	!LINEFEED
	  SCREEN(OFFSET)=10
	  OFFSET=OFFSET+1
	  LINE=LINE+1
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'b') THEN	!BS
	  SCREEN(OFFSET)=8
	  OFFSET=OFFSET+1
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'c') THEN	!CR
	  SCREEN(OFFSET)=13
	  OFFSET=OFFSET+1
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'e') THEN	!ESCAPE
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'u') THEN	!UP
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='A'
	  OFFSET=OFFSET+1
	  LINE=LINE-1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'C') THEN	!Clear_line
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='K'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'L') THEN	!Line_clear
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='2'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='K'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 's') THEN	!SAVE CURSOR
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='7'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF (BIT(BOFF+1) .EQ. 'r') THEN	!RESTORE CURSOR
	IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE		
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='8'
	  OFFSET=OFFSET+1
	ENDIF
	  GOTO 2115
	ELSEIF ((LENGTH .GE. 5) .AND. (BIT(BOFF+1) .EQ. 'M')) THEN
	 IF (SCOPE .EQ. 1) THEN
	  TEMP=(10*(BIT(BOFF+3)-48))+(BIT(BOFF+4)-48)
	  IF (TEMP .NE. 0) THEN
	   DO 4115, J=1,TEMP
	    SCREEN(OFFSET)=BIT(BOFF+2)
	    OFFSET=OFFSET+1
4115	   CONTINUE
	  ENDIF
	  CONSUME=CONSUME+3
	  BOFF=BOFF+3
	  LENGTH=LENGTH-3
	 ENDIF
	  GOTO 2115
	ELSEIF ((LENGTH .GE. 6) .AND.
	9 ((BIT(BOFF+1) .GE. '0') .AND. (BIT(BOFF+1) .LE. '2'))) THEN
	 IF (SCOPE .EQ. 1) THEN
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+1)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+2)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=';'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+4)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=BIT(BOFF+5)
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='H'
	  OFFSET=OFFSET+1
	  LINE=((BIT(BOFF+1)-48)*10)+(BIT(BOFF+2)-48)
	  CONSUME=CONSUME+4
	  BOFF=BOFF+4
	  LENGTH=LENGTH-4
	 ENDIF
	  GOTO 2115

	ELSE
	  GOTO 1115
	ENDIF

C		TEXT ATTRIBTE COMMON END CODE--REMOVE COMMAND

2115	CONTINUE
	CONSUME=CONSUME+2
	BOFF=BOFF+2
	LENGTH=LENGTH-2

3115	IF (LENGTH .LE. 0) GOTO 9115
	BOFF=BOFF+1
	LENGTH=LENGTH-1
	CONSUME=CONSUME+1
	IF ((BIT(BOFF-1) .EQ. 32) .OR. (BIT(BOFF-1) .EQ. 9)) THEN
	  IF (LENGTH .EQ. 0) GOTO 9115
	  GOTO 115	
	ELSE
	  GOTO 3115	
	ENDIF

C		LAST CHARACTER, ATTRIBUTE STATE CLOSE OUT

9115	CONTINUE
	IF (FLAGEX .NE. 0) THEN
	 FLAGEX=0
	 IF (NO_CR_LF .NE. 1) THEN
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='0'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='m'
	  OFFSET=OFFSET+1
	 ENDIF
	ENDIF

	IF (TTSEL .NE. 0 ) THEN
	 TTSEL=0
	 IF (NO_CR_LF .NE. 1) THEN
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='('
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='B'
	  OFFSET=OFFSET+1
	 ENDIF
	ENDIF

C		TEXT STATE 1-4 CLOSE OUT

	IF (STATE .NE. 5) THEN
	 IF (NO_CR_LF .NE. 1) THEN
	  SCREEN(OFFSET)=10
	  OFFSET=OFFSET+1
	  LINE=LINE+1
	 ENDIF
	ENDIF

	IF ((DHDW .EQ. 1) .OR. (DH .EQ. 1)) GOTO 110
	GOTO 114

C		TEXT STATE 2 AND 4 PROCESS

112	CONTINUE

	IF (DOUBLE .NE. 0) THEN
	 IF (STATE .EQ. 2) THEN
	  LINE2=LINE
	  LINE1=LINE
	 ELSE
	  IF (DOUBLE .EQ. 1) THEN
	   DOUBLE=2
	   LINE1=LINE
	   LINE=LINE2
	   SCREEN(OFFSET)=ESCAPE
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='['
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(1,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(2,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=';'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='4'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='1'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='H'
	   OFFSET=OFFSET+1
	  ELSE
	   DOUBLE=1
	   LINE2=LINE
	   LINE=LINE1
	   SCREEN(OFFSET)=ESCAPE
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='['
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(1,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(2,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=';'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='1'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='H'
	   OFFSET=OFFSET+1
	  ENDIF
	 ENDIF
	ENDIF
	  
	STATE=3

	IF ((SCRFOR .LT. 5) .OR. (SCRFOR .EQ. 7)) THEN
	  SCREEN(OFFSET)=TAB
	  OFFSET=OFFSET+1
	ENDIF

	IF (SEL .NE. 0) THEN
	  SELECT(SELOFF)=0
	  SELOFF=SELOFF+1
	ENDIF

	SEL=SEL+1
	SELPNT(SEL)=SELOFF
	LINPNT(SEL)=LINE
	CHOPNT(1,SEL)=OFFSET

C		SCREEN FORMAT DISPATCH FOR TEXT STATE 2/4

	GOTO (180,181,182,183,185,1850,1851,1851)SCRFOR

180	CONTINUE			!FORMAT 1
	SELCMP(SEL)=SEL
	IF (SCOPE .EQ. 1) THEN
	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='1'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='m'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=NUMS(1,SEL)
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=NUMS(2,SEL)
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='m'
	OFFSET=OFFSET+1
	ELSE
	SCREEN(OFFSET)=NUMS(1,SEL)
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=NUMS(2,SEL)
	OFFSET=OFFSET+1
	ENDIF
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	GOTO 117			!FORMAT 2

181	CONTINUE
	SELCMP(SEL)=BIT(BOFF)
	LENGTH=LENGTH-1
	BOFF=BOFF+1
	GOTO 184

182	CONTINUE			!FORMAT 3
	SELCMP(SEL)=BIT(BOFF)
	GOTO 117
183	CONTINUE			!FORMAT 4

	SELCMP(SEL)=BIT(BOFF)

184	CONTINUE
	IF (SCOPE .EQ. 1) THEN
	SCREEN(OFFSET)=ESCAPE		!FORMAT 2 AND 4 COMMON
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='1'
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='m'
	OFFSET=OFFSET+1
	IF (SCRFOR .NE. 7) THEN
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	ENDIF
	SCREEN(OFFSET)=SELCMP(SEL)
	OFFSET=OFFSET+1
	IF (SCRFOR .EQ. 7) THEN
	 SCREEN(OFFSET)=SLCMP2(SEL)
	 OFFSET=OFFSET+1
	ENDIF
	SCREEN(OFFSET)=ESCAPE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='['
	OFFSET=OFFSET+1
	SCREEN(OFFSET)='m'
	OFFSET=OFFSET+1
	ELSE
	IF (SCRFOR .NE. 7) THEN
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	ENDIF

	SCREEN(OFFSET)=SELCMP(SEL)
	OFFSET=OFFSET+1
	IF (SCRFOR .EQ. 7) THEN
	 SCREEN(OFFSET)=SLCMP2(SEL)
	 OFFSET=OFFSET+1
	ENDIF
	ENDIF
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	GOTO 117

185	CONTINUE			!FORMAT 5
	SELCMP(SEL)=SEL
	GOTO 117

1850	CONTINUE			!FORMAT 6
	SELCMP(SEL)=BIT(BOFF)
	LENGTH=LENGTH-1
	BOFF=BOFF+1
	GOTO 117

1851	CONTINUE			!FORMAT 7 AND 8
	SELCMP(SEL)=BIT(BOFF)
	LENGTH=LENGTH-1
	BOFF=BOFF+1
	SLCMP2(SEL)=BIT(BOFF)
	LENGTH=LENGTH-1
	BOFF=BOFF+1
	IF (SCRFOR .EQ. 8) GOTO 117
	GOTO 184

C		TEXT STATE 3 PROCESS

113	CONTINUE

	IF (DOUBLE .EQ. 2) THEN
	   SCREEN(OFFSET)=ESCAPE
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='['
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(1,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(2,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=';'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='4'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='1'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='H'
	   OFFSET=OFFSET+1
	ENDIF

	SCREEN(OFFSET)=TAB
	OFFSET=OFFSET+1

	IF (SCRFOR .EQ. 3) GOTO 111

	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	SCREEN(OFFSET)=SPACE
	OFFSET=OFFSET+1
	GOTO 111

C		COMMON TEXT EXIT CODE FOR STATES 2 AND 4

117	CONTINUE
	CHOPNT(2,SEL)=LENGTH+12
	IF (SCRFOR .EQ. 3) CHOPNT(2,SEL)=LENGTH+1
	GOTO 111

114	CONTINUE
	GOTO 190

C		FIELD SEPARTOR "]" PARSING

160	CONTINUE

	MASK_BLK=0

	GOTO (161,86,86,162,86)STATE

C		"]" STATE 1 PROCESSING

161	LENGTH=LENGTH-1
	BOFF=BOFF+1
	SCRFOR=1
	STATE=2
	SELCT1(SELOFF)=0
	SELOFF=1

	IF (LENGTH .EQ. 0) GOTO 190

	DO 164,J=1,LENGTH
	  IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB)) 
	9 GOTO 165
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
164	CONTINUE
	GOTO 190

165	CONTINUE

	IF (BIT(BOFF) .EQ. '2') THEN			!DOUBLE COLUMN
	  BOFF=BOFF+1
	  LENGTH=LENGTH-1
	  IF (SCOPE .EQ. 1) DOUBLE=1
	  IF (LENGTH .LE. 0) GOTO 190
	  DO 166,J=1,LENGTH
	    IF ((BIT(BOFF) .NE. SPACE) .AND. (BIT(BOFF) .NE. TAB)) 
	9   GOTO 167
	    BOFF=BOFF+1
	    LENGTH=LENGTH-1
166	  CONTINUE
	  GOTO 190
167	  CONTINUE
	ENDIF

	IF (BIT(BOFF) .EQ. 'N') GOTO 190		!NUMERIC

	IF (BIT(BOFF) .EQ. 'A') THEN
	  SCRFOR=2					!ALPHA/NUMERIC
	  GOTO 190
	ELSEIF (BIT(BOFF) .EQ. 'B') THEN
	  SCRFOR=3					!BLANK
	  GOTO 190
	ELSEIF (BIT(BOFF) .EQ. 'R') THEN
	  SCRFOR=4					!REPEAT CHARACTER
	  GOTO 190
	ELSEIF ((BIT(BOFF) .EQ. 'U') .OR. (BIT(BOFF) .EQ. 'u')) THEN
	  SCRFOR=5					!UNFORMATTED NUMERIC
	  CURSOR=0
	  IF (BIT(BOFF) .EQ. 'u') NO_CR_LF=1
	  GOTO 190
	ELSEIF ((BIT(BOFF) .EQ. 'C') .OR. (BIT(BOFF) .EQ. 'c')) THEN
	  SCRFOR=6					!UNFORMATTED CHARACTER
	  CURSOR=0
	  IF (BIT(BOFF) .EQ. 'c') NO_CR_LF=1
	  GOTO 190
	ELSEIF (BIT(BOFF) .EQ. 'D') THEN
	  SCRFOR=7					!DOUBLE
	  GOTO 190
	ELSEIF ((BIT(BOFF) .EQ. 'T') .OR. (BIT(BOFF) .EQ. 't')) THEN
	  SCRFOR=8					!UNFORMATTED TWO ALPHA
	  CURSOR=0
	  IF (BIT(BOFF) .EQ. 't') NO_CR_LF=1
	  GOTO 190
	ELSE
	  GOTO 86
	ENDIF

C		"]" STATE 4 PROCESSING

162	CONTINUE
	STATE=5

	IF (DOUBLE .NE. 0) THEN
	  IF (LINE2 .GT. LINE) LINE=LINE2
	  IF (LINE1 .GT. LINE) LINE=LINE1
	   SCREEN(OFFSET)=ESCAPE
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='['
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(1,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=CNUMS(2,LINE)
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)=';'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='1'
	   OFFSET=OFFSET+1
	   SCREEN(OFFSET)='H'
	   OFFSET=OFFSET+1
	ENDIF

	SELECT(SELOFF)=0
	FIRST=1
	GOTO 190

C		COMMON END OF RECORD FOR ALL RECORDS PROCESSING

190	CONTINUE

	IF (ENDMRK .EQ. 0) GOTO 1

	BOFF=BOFF+LENGTH+1
	LENGTH=LENSAV-ENDMRK
	GOTO 2

1	CONTINUE

1101	CONTINUE

	CLOSE (UNIT=1)

	IF ((SCOPE .NE. BIT1(4)) .OR. (DUMB .NE. BIT1(6))) GOTO 1086

	OPEN (UNIT=1,ERR=80,NAME=FILNAM,TYPE='OLD',READONLY,SHARED,
	9	FORM='UNFORMATTED')

	READ (1)
	READ (1) LINPNT
	READ (1) SELCMP
	READ (1) SLCMP2
	READ (1) SELPNT
	READ (1,ERR=2101) SELECT
2101	READ (1,ERR=3101) SCREEN
3101	READ (1) SELCT1
	READ (1,ERR=4101) STRING
4101	READ (1) CHOPNT
	READ (1) GRPHBF
	READ (1) ENDBUF
	READ (1) HARDBUF
	READ (1) VARS
	CLOSE (UNIT=1)





C		SCRIPT FILE PROCESSING DONE, DO SOME INITIALIZATION

90	CONTINUE
	IF ((STATE .NE. 5) .AND. (STATE .NE. 1)) GOTO 86

	CLOSE (UNIT=1)

	IF (BUILD .NE. 0) THEN
	OPEN (UNIT=1,ERR=80,NAME=FILNAM,TYPE='NEW',
	9	RECL=5000,FORM='UNFORMATTED')
	WRITE (1) '}',SCOPE,DUMB
	WRITE (1) LINPNT
	WRITE (1) SELCMP
	WRITE (1) SLCMP2
	WRITE (1) SELPNT
	WRITE (1) (SELECT(J),J=1,SELOFF+1)
	WRITE (1) (SCREEN(J),J=1,OFFSET+1)
	WRITE (1) SELCT1
	WRITE (1) (STRING(J),J=1,STROFF+1)
	WRITE (1) CHOPNT
	WRITE (1) GRPHBF
	WRITE (1) ENDBUF
	WRITE (1) HARDBUF
	WRITE (1) VARS
	CLOSE (UNIT=1)
	GOTO 99
	ENDIF

	IF (CLEAR .EQ. 1) THEN
	  CALL CLR
	  CLEAR=1
	ENDIF

	CALLFL=0

	DO 1925,I=1,50
	  LSTLST(I)=LSTFIL(I)
1925	CONTINUE

	DO 2925,I=1,50
	  LSTFIL(I)=BILNAM(I)
2925	CONTINUE

	LENGX = LENGX+1-CONSUME
	SELBUF(14)=CNUMS(1,LINE)
	SELBUF(15)=CNUMS(2,LINE)
	SELBUF(17)=CNUMS(1,LENGX)
	SELBUF(18)=CNUMS(2,LENGX)
	SELFUN=1


	SUB(1)=0
	SUB(2)=0
	SUB(3)=0
	SUB(4)=0
	SUBPNT=1
	SUBCNT=1

C		EXECUTE INITIALIZATION PCODE

	IF (DCL .EQ. 0) THEN
	DO 94, I=1,50

	IF (SELCT1(SELFUN) .EQ. 0) GOTO 95

	FUNC=SELCT1(SELFUN)
	LENGTH=0

	IF (SELCT1(SELFUN+1) .EQ. 0 ) GOTO 96
	SELSTR=SELCT1(SELFUN+1)
	LENGTH=STRING(SELSTR)

96	CONTINUE
	GOTO 93

94	CONTINUE
	ENDIF
C		POST INITIALIZATION EXECUTE SETUP

95	CONTINUE
	IF (STATE .EQ. 1) GOTO 99

	IF ((CURSOR .NE. 0) .AND. (SCOPE .EQ. 1))THEN
	  PARM10=(PARM10+OFFSET-1)
	  SCREEN(OFFSET)=ESCAPE
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='['
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=(CNUMS(1,(LINPNT(1))))
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=(CNUMS(2,(LINPNT(1))))
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=';'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='3'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='H'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='-'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)='>'
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=8
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=8
	  OFFSET=OFFSET+1
	  SCREEN(OFFSET)=8
	  OFFSET=OFFSET+1
	ENDIF

	PARM6=OFFSET-1

	FLAG1X=1
	INITP=0
	SPWND=SPWN
	SILNTD=SILNT
	STPERD=STPER
	CLEARD=CLEAR
	PARM1D=PARM1

	IF ((SUB_CALLED .NE. 0) .AND. (RTURN .NE. 0)) THEN

	  SELFUN=SAVE_SELFUN
	  I=SAVE_I
	  SUB_CALLED=0
	  RTURN=0
	  GOTO 98

	ENDIF

	RTURN=0

C		BETWEEN SELECTION RE-SETUP

97	CONTINUE
	SUB(1)=0
	SUB(2)=0
	SUB(3)=0
	SUB(4)=0
	SUBPNT=1
	SUBCNT=1

	STPER=STPERD
	SPWN=SPWND
	CLEAR=CLEARD
	SILNT=SILNTD
	PARM1=PARM1D
	IF (PARM1D .GT. 0) THEN
	  READF1='B1'X
	  READF2='FA'X
	ELSE
	  READF1='31'X
	  READF2='7A'X
	ENDIF


	IF ((SCOPE .EQ. 0) .AND. (FLAG1X .EQ. 0) .AND. (DUMB .EQ. 0)) THEN
	  IF (HARDLEN .EQ. 0) THEN
	   WRITE (6) (LF,LF,CR,'SCR>')
	   GOTO 301
	  ELSE
	   WRITE (6) (LF,LF,CR,(HARDBUF(J), J=1,HARDLEN))
	   GOTO 301
	  ENDIF
	ELSE
	  FLAG1X=0
	ENDIF

	IF (DUMB .EQ. 1)
	9 WRITE (6) (LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,
	9	     LF,LF,LF,LF,LF,CR)

C		WRITE-OUT MENU SCREEN

300	CONTINUE

	IF ((PRNTER .EQ. 1) .OR. (PRNTR .EQ. 1))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PROFF),
	9	%VAL(5),,,,)

	IF (UNFORMAT_SCREEN .EQ. 0) THEN
 	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SCREEN),
	9	%VAL(PARM6),,,,)
	ELSE
 	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SCREEN(13)),
	9	%VAL(PARM6-12),,,,)
	ENDIF

	IF ((PRNTER .EQ. 1) .AND. (CURSOR .EQ. 0) .AND. (GRAPHIC .EQ. 0))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)

	IF (GRAPHC .EQ. 1) THEN

C		GRAPHIC OPTION SPAWN (EXECUTES AFTER MENU OUTPUT EVERYTIME)

	  ISTAT = LIB$SPAWN (GRPSTR(1:GRPHLN),,,,,,SPSTAT)

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%VAL(PARM10),
	9	%VAL(12),,,,)
	ENDIF

	IF ((GRAPHC .EQ. 2) .AND. (SCOPE .EQ. 1)) THEN

	  ISTAT = LIB$DATE_TIME(TIMCHR)

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(TIMSTR),
	9	%VAL(24),,,,)

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%VAL(PARM10),
	9	%VAL(12),,,,)
	ENDIF

	IF ((PRNTER .EQ. 1) .AND. (CURSOR .EQ. 0) .AND. (GRAPHIC .NE. 0))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)


C		CURSOR INPUT PROCESSING

301	TTSEL=1
	MLENG=1

	IF ((CURSOR .EQ. 0) .OR. (SCOPE .EQ. 0)) THEN
	IF (SCOPE .EQ. 1) THEN
	  PARM4=19
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)

	  PARM4=21
	ELSE
	  PARM4=3
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)
	ENDIF
	  GOTO 351
	ENDIF

302	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF2),%REF(TTSTAT),,,
	9	%REF(TTBUF),%VAL(1),%VAL(PARM1),,,)

	IF (TTSTAT(1) .EQ. '22C'X) GOTO 500
	IF ((BTBUF(1) .EQ. 26) .OR. (BTBUF(1) .EQ. 3) .OR. (BTBUF(1) .EQ. 25))
	9	GOTO 376
	IF (BTBUF(1) .EQ. 20) GOTO 357
	IF ((BTBUF(1) .EQ. 10) .AND. (LOCK .EQ. 0)) GOTO 214	!<LF>
	IF (BTBUF(1) .EQ. ESCAPE) THEN

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('7A'X),%REF(TTSTAT),,,
	9	%REF(TTBUF),%VAL(2),,,,)
	IF ((BTBUF(1) .EQ. 26) .OR. (BTBUF(1) .EQ. 3) .OR. (BTBUF(1) .EQ. 25))
	9	GOTO 376

	  IF (BTBUF(1) .EQ. '[') THEN
	    IF ((BTBUF(2) .EQ. 'A') .OR. (BTBUF(2) .EQ. 'C')) GOTO 370	!UP
	    IF ((BTBUF(2) .EQ. 'B') .OR. (BTBUF(2) .EQ. 'D')) GOTO 371	!DOWN
	    GOTO 372

	  ELSEIF (BTBUF(1) .EQ. 'O') THEN
	    FUNC=BTBUF(2)-'O'
	    GOTO (373,374,375,376) FUNC			!PF KEY DISPATCH
	    GOTO 372

	  ELSE
	    GOTO 372
	  ENDIF
 
	ELSEIF ((BTBUF(1) .EQ. ' ') .OR. (BTBUF(1) .EQ. '0') .OR.
	9 (BTBUF(1) .EQ. TAB)) THEN					!DOWN
	  GOTO 371

	ELSEIF (BTBUF(1) .EQ. 8) THEN				!UP
	  GOTO 370

	ELSEIF (BTBUF(1) .EQ. 13) THEN			!<CR>
1302	 IF (PRNTR .EQ. 1)
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)
	  SELBUF(20)=13
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)
	 IF ((PRNTER .EQ. 1) .AND. (CURSOR .EQ. 1))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)
	  GOTO 399

	ELSEIF (BTBUF(1) .EQ. '?') THEN			!?
	  TTSEL=TTSEL+100
	  GOTO 1302

	ELSEIF ((BTBUF(1) .LT. SPACE) .OR. (BTBUF(1) .EQ. 127)) THEN
	  GOTO 302

	ELSE
	  GOTO 350			!ALPHA/NUMERIC
	ENDIF

350	CONTINUE
	SELBUF(20)=BTBUF(1)
	BMCR(1)=BTBUF(1)
	MLENG=2
	PARM4=20
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)
	PARM4=21

C		PROMPT INPUT PROCESSING

351	CONTINUE

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF2),%REF(TTSTAT(1)),,,
	9	%REF(TTBUF),%VAL(1),%VAL(PARM1),,,)

	IF (TTSTAT(1) .EQ. '22C'X) GOTO 500			!TIMEOUT
	IF ((BTBUF(1) .EQ. 26) .AND. (LOCK .EQ. 0)) GOTO 99	!^Z
	IF ((BTBUF(1) .EQ. 3) .AND. (LOCK .EQ. 0)) GOTO 99	!^C
	IF ((BTBUF(1) .EQ. 25) .AND. (LOCK .EQ. 0)) GOTO 99	!^Y
	IF (BTBUF(1) .EQ. 13) GOTO 360				!<CR>
	IF (BTBUF(1) .EQ. 20) GOTO 357				!^T
	IF (BTBUF(1) .LT. 32) GOTO 359				!OTHER CTRL CHAR
	IF (BTBUF(1) .EQ. 127) GOTO 358				!DELETE
	IF ((BTBUF(1) .EQ. 10) .AND. (LOCK .EQ. 0)) GOTO 214	!<LF>


	BMCR(MLENG)=BTBUF(1)
	MLENG=MLENG+1
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(TTBUF),
	9	%VAL(1),,,,)
	GOTO 351

357	CONTINUE				!^T PROCESS
	TYPE 1015,FILNAM
	CALL DELAY
	GOTO 300

358	CONTINUE				!DELETE PROCESS
	IF (MLENG .LT. 2) GOTO 351
	MLENG=MLENG-1
	IF ((SCOPE .EQ. 1) .OR. (DUMB .EQ. 1)) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(BSBUF),
	9	%VAL(3),,,,)
	ELSE
	WRITE (6) (SLASH)
	ENDIF
	GOTO 351

359	CONTINUE			!CONTROL CHAR PROCESS
	IF ((BTBUF(1) .EQ. 23) .OR. (BTBUF(1) .EQ. 3)) GOTO 300		!^W/^C
	IF ((BTBUF(1) .NE. ESCAPE) .OR. (SCOPE .EQ. 0)) GOTO 351

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('7A'X),%REF(TTSTAT),,,
	9	%REF(TTBUF),%VAL(2),,,,)

	IF (BTBUF(1) .NE. 'O') GOTO 351		!PF KEY?
	FUNC=BTBUF(2)-'O'

	GOTO (373,351,375,376) FUNC		!PF KEY DISPATCH

	GOTO 351

C		<CR> PROCESSING

360	CONTINUE

	IF (PRNTR .EQ. 1)
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)

	MLENG=MLENG-1
	BTBUF(2)=10
	IF (NO_CR_LF .NE. 1)
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,
	9	%REF(TTBUF),%VAL(2),,,,)

	IF ((PRNTER .EQ. 1) .AND. (CURSOR .EQ. 1))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)

	IF (MLENG .EQ. 0) THEN
	 TTSEL=1
	 GOTO 399
	ENDIF

	IF ((BMCR(1) .EQ. '$') .AND. (LOCK .EQ. 0) .AND. (DCL .EQ. 0)) GOTO 378
	IF ((BMCR(1) .EQ. '@') .AND. (LOCK .EQ. 0) .AND. (DCL .EQ. 0)) GOTO 379
	IF ((BMCR(1) .EQ. '!') .AND. (LOCK .EQ. 0) .AND. (DCL .EQ. 0)) GOTO 380
	IF ((BMCR(1) .EQ. '?') .AND. (DCL .EQ. 0)) GOTO 700

	IF ((MLENG .GE. 4) .AND. (DCL .EQ. 0)) THEN
	  IF (((IMCR(1) .EQ. 'HE') .AND. (IMCR(2) .EQ. 'LP')) .OR.
	9 ((IMCR(1) .EQ. 'he') .AND. (IMCR(2) .EQ. 'lp'))) GOTO 700
	ENDIF

	IF ((SCRFOR .EQ. 1) .OR. (SCRFOR .EQ. 5)) THEN

	  IF (MLENG .GT. 3) GOTO 377

	  IF (MLENG .EQ. 1) THEN
	    TTSEL=BMCR(1)-48
	    IF ((TTSEL .GT. SEL) .OR. (TTSEL .LE. 0)) GOTO 377
	    GOTO 399
	  ELSEIF ((MLENG .EQ. 2) .AND. (BMCR(2) .EQ. '?')) THEN
	    TTSEL=BMCR(1)-48
	    IF ((TTSEL .GT. SEL) .OR. (TTSEL .LE. 0)) GOTO 377
	    TTSEL=TTSEL+100
	    GOTO 399
	  ELSEIF ((MLENG .EQ. 2) .AND. (BMCR(2) .NE. '?')) THEN
	    TTSEL=(((BMCR(1)-48)*10)+(BMCR(2)-48))
	    IF ((TTSEL .GT. SEL) .OR. (TTSEL .LE. 0)) GOTO 377
	    GOTO 399
	  ELSEIF ((MLENG .EQ. 3) .AND. (BMCR(3) .EQ. '?')) THEN
	    TTSEL=(((BMCR(1)-48)*10)+(BMCR(2)-48))
	    IF ((TTSEL .GT. SEL) .OR. (TTSEL .LE. 0)) GOTO 377
	    TTSEL=TTSEL+100
	    GOTO 399
	  ELSE
	    GOTO 377
	  ENDIF

	ELSE

	AMCR(1)=BMCR(1)
	IF ((BMCR(1) .GE. 'a') .AND. (BMCR(1) .LE. 'z')) BMCR(1)=(BMCR(1)-32)

	 IF (SCRFOR .LT. 7) THEN

365	  CONTINUE
	  IF ((SELCMP(TTSEL) .EQ. BMCR(1)) .OR. (SELCMP(TTSEL) .EQ. AMCR(1)))
	9   GOTO 368
	  TTSEL=TTSEL+1
	  IF (TTSEL .LE. SEL) GOTO 365
	  GOTO 377

	 ELSE
	  IF (MLENG .EQ. 1) BMCR(2)=32
	  AMCR(2)=BMCR(2)
	  IF ((BMCR(2) .GE. 'a') .AND. (BMCR(2) .LE. 'z')) BMCR(2)=(BMCR(2)-32)
366	  CONTINUE
	  IF (((SELCMP(TTSEL) .EQ. BMCR(1)) .AND. (SLCMP2(TTSEL) .EQ. BMCR(2)))
	9  .OR. ((SELCMP(TTSEL) .EQ. AMCR(1)) .AND. 
	9        (SLCMP2(TTSEL) .EQ. AMCR(2))))
	9           GOTO 368
	  TTSEL=TTSEL+1
	  IF (TTSEL .LE. SEL) GOTO 366
	  GOTO 377

	 ENDIF

	ENDIF

368	CONTINUE
	IF (BMCR(MLENG) .EQ. '?') TTSEL=TTSEL+100
	GOTO 399

C		CURSOR PROCESSING

370	CONTINUE
	IF (TTSEL .EQ. 1) TTSEL=SEL+1
	TTSEL=TTSEL-1

1371	CONTINUE

	IF ((DOUBLE .NE. 0) .AND. (IAND(TTSEL,1) .EQ. 0)) THEN
	 CURBF2(7)=(CNUMS(1,(LINPNT(TTSEL))))
	 CURBF2(8)=(CNUMS(2,(LINPNT(TTSEL))))
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(CURBF2),
	9	%VAL(18),,,,)
	ELSE
	 CURBUF(7)=(CNUMS(1,(LINPNT(TTSEL))))
	 CURBUF(8)=(CNUMS(2,(LINPNT(TTSEL))))
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(CURBUF),
	9	%VAL(17),,,,)
	ENDIF

	GOTO 302

371	CONTINUE
	IF (TTSEL .EQ. SEL) TTSEL=0
	TTSEL=TTSEL+1
	GOTO 1371

C		OUTPUT A BELL

372	CONTINUE
	BTBUF(1)=7
	BTBUF(2)=7
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(TTBUF),
	9	%VAL(2),,,,)
	GOTO 302

C		PF KEY PROCESSING

373	CONTINUE			!PF1
	GOTO 300

374	CONTINUE			!PF2
	CLEAR=1
	TTSEL=TTSEL+100
	GOTO 399

375	CONTINUE			!PF3
	IF (LOCK .EQ. 1) GOTO 302

1375	DO 2375,I=1,50
	  BILNAM(I)=ONEFIL(I)
2375	CONTINUE

	RTURN=1
	LEVEL=1
	GOTO 50

376	CONTINUE			!PF4
	IF (LOCK .EQ. 1) GOTO 302
	SELBUF(20)=13
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)
	GOTO 99

C		OPTION NOT FOUND

377	CONTINUE
	TYPE 1003
	CALL DELAY
	GOTO 300

C		COMMAND LINE SPAWN

378	CONTINUE
	MLENG=MLENG-1
	CALL CLR
	ISTAT = LIB$SPAWN (BBMCRC(1:MLENG),,,,,,SPSTAT)

	IF (SCOPE .EQ. 0) GOTO 300
	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 300
	 GOTO 99
	ENDIF

	GOTO 300

C		COMMAND LINE GOTO

379	CONTINUE
	DO 1379, J=1,50
	  BILNAM(J)=32
1379	CONTINUE

	DSW=MLENG-1
	MLENG=2
	GOTO 69

C		SYMBOL GEN AND EXIT

380	CONTINUE
	MLENG=MLENG-1
	ISTAT = LIB$SET_SYMBOL (SYMEXIT,BBMCRC(1:MLENG),GLOB)
	ISTAT = SYS$EXIT (%VAL(1))


C		SELECTION FOUND, DISPATCH FUNCTION OR HELP

399	CONTINUE
	IF (DCL .EQ. 1) THEN
	 IF (TTSEL .GE. 100) THEN
	  ISTAT = LIB$SET_SYMBOL (SYMHLP,YEP,GLOB)
	  TTSEL = TTSEL - 100
	 ELSE
	  ISTAT = LIB$SET_SYMBOL (SYMHLP,NOPE,GLOB)
	 ENDIF

	 TTSEL = TTSEL+TTSEL-1
	 ISTAT = LIB$SET_SYMBOL (SYMSTR,NUMBS(TTSEL:TTSEL+1),GLOB)
	 ISTAT = SYS$EXIT (%VAL(1))
	ENDIF

	IF (TTSEL .GT. 100) GOTO 400

	SELFUN=SELPNT(TTSEL)
	IF (SELFUN .EQ. 0) GOTO 97

C		SELECTION PROCESSING

	DO 98, I=1,50
	  IF (SELECT(SELFUN) .EQ. 0) GOTO 92

931	  FUNC=SELECT(SELFUN)
	  LENGTH=0

	  IF (SELECT(SELFUN+1) .EQ. 0 ) GOTO 93
	  SELSTR=SELECT(SELFUN+1)
	  LENGTH=STRING(SELSTR)

93	  CONTINUE

	  SELFUN=SELFUN+2

	  IF (DEBUG .EQ. 1) THEN
	    TYPE 1012,CLEAR,SILNT,SCRFOR,SPWN,WHOLE,LOGOFF,LOCK,
	9 CURSOR,JET,PRINT,PRNTER,PRNTR,DUMB,SCOPE,RTURN
	9 ALLOW,STPER,OVERID,DOUBLE,SETFLG,BOTTOM,INIT1,GRAPHC,LEVEL
	    TYPE 1013,FUNC,TTSEL,LENGTH,PRVMSK,MASK,SPSTAT
	IF (LENGTH .NE. 0) TYPE 1014,CSTRNG(SELSTR+1:SELSTR+LENGTH)
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) GOTO 99
	  ENDIF

C		PCODE DISPATCH

	GOTO (201,202,203,204,205,206,207,208,209,210,211,212,213,
	9     214,215,216,217,218,219,220,221,222,223,224,225,226,
	9     227,228,229,230,231,232,233,234,235,236,237,238,239,
	9     240,241,242,243,244,245,246,247,248,249,250,251,252,
	9     253,254,255,256,257,258,259,260,261,262,263,264,265,
	9     266,267,268,269,270,271,272,273,274,275,276,277,278,
	9     279,280,281,282)FUNC

91	 CONTINUE

	 IF (INITP .EQ. 1) GOTO 94

98	CONTINUE

C		FUNCTION DONE

92	CONTINUE
	IF (TOPFLG .EQ. 0) GOTO 97
	WRITE (6) (ESC,'[1;24r')
	TOPFLG=0
	GOTO 97

C		FILE PROCESSING ERROR

80	TYPE 1007,FILNAM
	CALL DELAY

88	CONTINUE			! TRY TO OPEN AN EARLIER SCRIPT
	IF (LSTFIL(1) .EQ. 0) GOTO 89

	DO 81, I=1,50
	  BILNAM(I)=LSTFIL(I)
81	CONTINUE

	IF (CALLFL .EQ. 1) LEVEL=LEVEL-1
	RTURN=1
	CALLFL=0
	GOTO 50

C		SCRIPT SYNTAX ERROR

86	CONTINUE
	CLOSE (UNIT=1)
	TYPE 1008,I
	CALL DELAY
	GOTO 88

C		COMPILED TERMINAL TYPE MIS-MATCH

1086	CONTINUE
	TYPE 1020,FILNAM
	CALL DELAY
	GOTO 88

C		ACCESS DENIED ERROR

186	CONTINUE
	CLOSE (UNIT=1)
	TYPE 1006
	CALL DELAY
	GOTO 88

C		COMMAND LINE ERROR

87	CONTINUE
	TYPE 1009

C		ERROR EXIT

89	CONTINUE
	FLAGEX=3
	GOTO 1099

C		NORMAL EXIT

99	CONTINUE
	IF (DCL .EQ. 1) THEN
	 ISTAT = LIB$SET_SYMBOL (SYMHLP,NOPE,GLOB)
	 ISTAT = LIB$SET_SYMBOL (SYMSTR,ZIP,GLOB)
	 ISTAT = SYS$EXIT (%VAL(1))
	ENDIF
	FLAGEX=1

1099	CONTINUE

	IF ((WHOLE .EQ. 0) .AND. (SCOPE .EQ. 1))
	9	WRITE (6) (ESC,'7',ESC,'[1;24r',ESC,'8')

C		CHAIN EXIT

	IF (SPWN .EQ. -1) THEN
	  ISTAT = LIB$DO_COMMAND (MCR(1:LENGX))
	  FLAGEX=3
	ENDIF
	
	IF (ENDTSK .EQ. 1) THEN

C		EXIT TASK SPAWN

	  ISTAT = LIB$SPAWN (ENDSTR(1:ENDLN),,,,,,SPSTAT)
	ENDIF


	IF (LOGOFF .EQ. 1)
	9  ISTAT = LIB$DO_COMMAND (BYE(1:3))

	IF ((PRNTER .EQ. 1) .OR. (PRNTR .EQ. 1))
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PROFF),
	9	%VAL(5),,,,)

	ISTAT = SYS$EXIT (%VAL(FLAGEX))

C		PCODE FUNCTION PROCESSING

C		ACTION

201	CONTINUE
	IF ((ALLOW .EQ. 0) .AND. (RTURN .EQ. 1)) GOTO 94

	SELSTR=SELSTR+1
	MLENG=1
	LENGX=0

1201	CONTINUE
	IF ((STRING(SELSTR) .NE. '#') .OR. (STRING(SELSTR+1) .NE.
	9 '#') .OR. (LENGTH .LT. 3)) GOTO 4201

	LENG=(STRING(SELSTR+2))-48
	IF ((LENG .LE. 0) .OR. (LENG .GT. 4)) GOTO 4201

	SPNT=SUB(LENG)
	IF (SPNT .EQ. 0) GOTO 3201

	LENG=SUBBUF(SPNT)
	SPNT=SPNT+1

2201	CONTINUE
	IF (LENG .EQ. 0) GOTO 3201

	BMCR(MLENG)=SUBBUF(SPNT)
	LENGX=LENGX+1
	MLENG=MLENG+1
	SPNT=SPNT+1
	LENG=LENG-1
	GOTO 2201

3201	CONTINUE
	SELSTR=SELSTR+3
	LENGTH=LENGTH-3
	IF (LENGTH .EQ. 0) GOTO 5201
	GOTO 1201

4201	CONTINUE
	BMCR(MLENG)=STRING(SELSTR)
	LENGX=LENGX+1
	SELSTR=SELSTR+1
	MLENG=MLENG+1
	LENGTH=LENGTH-1
	IF (LENGTH .NE. 0) GOTO 1201

5201	CONTINUE
	CALL CLR
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1) .OR. (VERBOS .EQ. 1))
	9 WRITE (6) (CR,LF,'$',(BMCR(J), J=1,LENGX),CR)

6201	CONTINUE

	IF (SPWN .EQ. -1) GOTO 1099

	IF (NOMCR .EQ. 0) THEN
	  IF (SPWN .EQ. 4) THEN
	   ISTAT = LIB$SPAWN (MCR(1:LENGX),,,NOWAIT,,,SPSTAT)
	   GOTO 91
	  ELSEIF (JET .EQ. 0) THEN
	   IF (PRINT .EQ. 1) 
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)
	   ISTAT = LIB$SPAWN (MCR(1:LENGX),,,,,,SPSTAT)
	   IF (PRINT .EQ. 1) 
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PROFF),
	9	%VAL(5),,,,)
	  ELSE
	   JET = 0
	   IF (PRINT .EQ. 1) 
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)
	   ISTAT = LIB$SPAWN (MCR(1:LENGX),,,JETTER,,,SPSTAT)
	   IF (PRINT .EQ. 1) 
	9 ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PROFF),
	9	%VAL(5),,,,)
	  ENDIF
	ENDIF

	IF (NOMCR .EQ. 1) SPSTAT = 1

	IF (SPWN .EQ. 5) GOTO 8201

7201	IF ((SPWNST .EQ. 1) .OR. (SPWNST .EQ. 0)) GOTO 8201
	IF (SPWN .EQ. 3) THEN
	  IF ((STPER .EQ. 0) .OR. (SELECT(SELFUN) .EQ. 0)) GOTO 227
	  GOTO 219
	ENDIF
	IF (SPWN .EQ. 2) THEN
	  IF (STPER .EQ. 0) GOTO 91
	  GOTO 92
	ENDIF
	IF (SPWN .EQ. 6) GOTO 227
	IF (SELECT(SELFUN) .EQ. 0) GOTO 227
	GOTO 219

8201	IF (SPWN .EQ. 3) GOTO 227
	IF ((SELECT(SELFUN) .NE. 0) .AND. (INITP .NE. 1)) GOTO 91
	IF ((SELCT1(SELFUN) .NE. 0) .AND. (INITP .EQ. 1)) GOTO 94
	TIMER(1) = -6*1000*1000
	ISTAT = SYS$SETIMR (%VAL(2),TIMER,,)
	ISTAT = SYS$WAITFR (%VAL(2))
	GOTO 91

C		HELP

202	CONTINUE
	GOTO 91
C		GOTO

203	CONTINUE
	DO 1203,I=1,LENGTH
	  BMCR(I+1)=STRING(SELSTR+I)
1203	CONTINUE

	MLENG=LENGTH+1
	GOTO 379

C		QUERY

204	CONTINUE
	SPWN=1
	GOTO 91

C		WAIT

205	CONTINUE
	SPWN=2
	GOTO 91

C		HOLD

206	CONTINUE
	SPWN=3
	GOTO 91

C		CLEAR

207	CONTINUE
	CLEAR=1
	GOTO 91

C		NO CLEAR

208	CONTINUE
	CLEAR=0
	GOTO 91

C		STOP ON ERR

209	CONTINUE
	STPER=1
	GOTO 91

C		PROCEED ON ERR

210	CONTINUE
	STPER=0
	GOTO 91

C		SILENT

211	CONTINUE
	IF (NOMCR .EQ. 0) SILNT=1
	GOTO 91

C		VERBOSE

212	CONTINUE
	SILNT=0
	GOTO 91

C		CALL

213	CONTINUE
	DO 1213, J=1,50
	  NAMSAV(LEVEL,J)=BILNAM(J)
1213	CONTINUE

	LEVEL=LEVEL+1
	CALLFL=1

	GOTO 203

C		RETURN

214	CONTINUE
	LEVEL=LEVEL-1
	IF (LEVEL .EQ. 0) GOTO 99

	DO 1214, J=1,50
	  BILNAM(J)=NAMSAV(LEVEL,J)
1214	CONTINUE

	RTURN=1

	GOTO 50

C		ASK

4215	CONTINUE
	IF (SUBCNT .EQ. 5) GOTO 91

	MLENG=0
	LENGX=LENGX-1

	IF (LENGX .LE. 0) GOTO 91
	SELSTR=2

	DO 1215, J=1,LENGX
	  IF (BMCR(SELSTR) .EQ. ')') GOTO 2215
	  SUBBUF(SUBPNT+J)=BMCR(SELSTR)
	  MLENG=MLENG+1
	  SELSTR=SELSTR+1
1215	CONTINUE
	IF (FUNC .EQ. 75) GOTO 3215
	GOTO 91

2215	CONTINUE
	IF (MLENG .EQ. 0) GOTO 91
	LENGX=LENGX-MLENG-2
	IF (LENGX .LE. 0) GOTO 91

	SELSTR=SELSTR+1

	CALL CLR

	WRITE (6) (CR,LF,(BMCR(SELSTR+J), J=1,LENGX))

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) GOTO 92

	IF ((YESNO(1:1) .EQ. '?') .AND. (SELECT(SELFUN) .EQ. 36))
	9 GOTO 600

	IF ((YESNO(1:1) .EQ. 'Y') .OR. (YESNO(1:1) .EQ. 'y')) GOTO 3215
	SUB(SUBCNT)=SUBPNT
	SUBBUF(SUBPNT)=0
	SUBCNT=SUBCNT+1
	SUBPNT=SUBPNT+1
	GOTO 91

3215	CONTINUE
	SUB(SUBCNT)=SUBPNT
	SUBBUF(SUBPNT)=MLENG
	SUBCNT=SUBCNT+1
	SUBPNT=SUBPNT+MLENG+1
	GOTO 91

C		ASKS

7216	CONTINUE
	IF (SUBCNT .EQ. 5) GOTO 91

	SELSTR=1

	SUB(SUBCNT)=SUBPNT

	IF (BMCR(SELSTR) .EQ. '(') THEN

	MLENG=0
	LENGX=LENGX-1
	IF (LENGX .LE. 0) GOTO 91
	SELSTR=SELSTR+1

	DO 1216, J=1,LENGX
	  IF (BMCR(SELSTR) .EQ. ')') GOTO 2216
	  SUBBUF(SUBPNT+J)=BMCR(SELSTR)
	  MLENG=MLENG+1
	  SELSTR=SELSTR+1
1216	CONTINUE
	GOTO 91

2216	CONTINUE
	LENGX=LENGX-MLENG-2
	IF (LENGX .LE. 0) GOTO 91

	SELSTR=SELSTR+1

	CALL CLR

	WRITE (6) (CR,LF,(BMCR(SELSTR+J), J=1,LENGX))

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(MCRB),%VAL(80),%VAL(PARM1),,,)

	IF (TTSTAT(3) .NE. 13) GOTO 92
	LENGTH=TTSTAT(2)

	IF ((LENGTH .EQ. 1) .AND. (MCRBB(1) .EQ. '?') .AND.
	9 (SELECT(SELFUN) .EQ. 36)) GOTO 600

	IF (LENGTH .EQ. 0) GOTO 4216

	SUBBUF(SUBPNT)=LENGTH

	DO 3216, J=1,LENGTH
	  SUBBUF(SUBPNT+J)=MCRBB(J)
3216	CONTINUE
	SUBCNT=SUBCNT+1
	SUBPNT=SUBPNT+LENGTH+1
	GOTO 91

4216	CONTINUE
	SUBBUF(SUBPNT)=MLENG
	SUBCNT=SUBCNT+1
	SUBPNT=SUBPNT+MLENG+1
	GOTO 91

	ELSE

	CALL CLR

5216	WRITE (6) (CR,LF,(BMCR(SELSTR+J-1), J=1,LENGX))

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(MCRB),%VAL(80),%VAL(PARM1),,,)

	IF (TTSTAT(3) .NE. 13) GOTO 92
	MLENG=TTSTAT(2)

	IF ((MLENG .EQ. 1) .AND. (MCRBB(1) .EQ. '?') .AND.
	9 (SELECT(SELFUN) .EQ. 36)) GOTO 600

	IF (MLENG .EQ. 0) GOTO 5216
	SUBBUF(SUBPNT)=MLENG

	DO 6216, J=1,MLENG
	  SUBBUF(SUBPNT+J)=MCRBB(J)
6216	CONTINUE

	SUBPNT=SUBPNT+MLENG+1
	SUBCNT=SUBCNT+1
	GOTO 91

	ENDIF


C		BATCH

217	CONTINUE
	SPWN=4
	GOTO 91

C		TEXT

1218	CONTINUE

	CALL CLR

	IF (BMCR(1) .EQ. 34) THEN

	WRITE (6) (CR,LF,(BMCR(J), J=2,LENGX),CR)

	ELSE

	WRITE (6) (CR,LF,(BMCR(J), J=1,LENGX),CR)

	ENDIF
	GOTO 91

C		INQUIRE

219	CONTINUE

	CALL CLR

	TYPE 1002
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 91
	 GOTO 99
	ENDIF

	IF ((YESNO(1:1) .EQ. 'Y') .OR. (YESNO(1:1) .EQ. 'y')) THEN
	 IF (INITP .NE. 1) THEN
	  GOTO 92
	 ELSE
	  GOTO 95
	 ENDIF
	ENDIF

	GOTO 91

C		EXIT

220	CONTINUE
	GOTO 99

C		PASSWORD

221	CONTINUE
	IF (RTURN .EQ. 1) GOTO 91

	CALL CLR

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PASSWD),
	9	%VAL(26),,,,)

	READF3=READF1+'40'X

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF3),%REF(TTSTAT),,,
	9	%REF(MCR),%VAL(80),%VAL(PARM1),,,)

	IF (TTSTAT(3) .NE. 13) GOTO 92
	FLAGEX=TTSTAT(2)

	SELSTR=SELSTR+1

	IF (STRING(SELSTR) .EQ. '"') THEN
	    IF ((INDEX(CSTRNG(SELSTR+1:SELSTR+LENGTH-1),MCR(1:FLAGEX)) .EQ. 1)
	9	.AND. (FLAGEX .EQ. LENGTH-2)) GOTO 91
	    GOTO 6221
	ENDIF

	OPEN (UNIT=1,ERR=91,NAME='SCR$PASSWORD:',
	9 TYPE='OLD',READONLY,SHARED)

	DO WHILE (1)

	  READ (1,2002,END=5221)LENGX,BUFF1

	  IF ((INDEX(CSTRNG(SELSTR:SELSTR+LENGTH),BUFF1(1:LENGX)) .EQ. 1) .AND.
	9	(LENGX .EQ. LENGTH)) THEN
	    READ (1,2002,END=5221)LENGX,BUFF1
	    DO 1221,J=1,LENGX
	     BIT1(J)=BIT1(J)-J-J
1221	    CONTINUE
	    IF ((INDEX(MCR(1:FLAGEX),BUFF1(1:LENGX)) .EQ. 1) .AND.
	9	(FLAGEX .EQ. LENGX)) GOTO 4221
	    GOTO 2221
	  ELSE
	    READ (1,2002,END=5221)LENGX,BUFF1
	  ENDIF

	ENDDO

2221	CONTINUE

	CLOSE (UNIT=1)

6221	CONTINUE

	TYPE 1006
	CALL DELAY

	IF (INITP .EQ. 0) GOTO 97

	IF (LSTLST(1) .EQ. 0) GOTO 89

	DO 3221,J=1,50
	  BILNAM(J)=LSTLST(J)
3221	CONTINUE

	RTURN=1

	GOTO 50

4221	CONTINUE

	CLOSE (UNIT=1)

	GOTO 91

5221	CONTINUE

	TYPE 1017
	GOTO 2221

C		WHOLE

222	CONTINUE
	WHOLE=1
	IF (SCOPE .EQ. 0) GOTO 91
	SELBUF(6)=48
	SELBUF(7)=49
	SCREEN(3)=50
	SCREEN(4)=52
	SCREEN(15)=48
	SCREEN(16)=49
	GOTO 91

C		SPLIT

223	CONTINUE
	IF (SCOPE .EQ. 0) GOTO 91
	WHOLE=0
	SCREEN(3)=CNUMS(1,LINE+1)
	SCREEN(4)=CNUMS(2,LINE+1)
	SCREEN(15)=CNUMS(1,LINE+1)
	SCREEN(16)=CNUMS(2,LINE+1)
	SELBUF(6)=CNUMS(1,LINE+1)
	SELBUF(7)=CNUMS(2,LINE+1)
	GOTO 91

C		CLI

224	CONTINUE
	GOTO 91

C		AGAIN

225	CONTINUE
	CALL CLR
	TYPE 1000

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 91
	 GOTO 99
	ENDIF

	IF ((YESNO(1:1) .NE. 'Y') .AND. (YESNO(1:1) .NE. 'y')) GOTO 91

C
C		LOOP AND AGAIN COMMON CODE
C

272	CONTINUE
	SUB(1)=0
	SUB(2)=0
	SUB(3)=0
	SUB(4)=0
	SUBPNT=1
	SUBCNT=1

	STPER=STPERD
	SPWN=SPWND
	CLEAR=CLEARD
	SILNT=SILNTD
	PARM1=PARM1D
	IF (PARM1D .GT. 0) THEN
	  READF1='B1'X
	  READF2='FA'X
	ELSE
	  READF1='31'X
	  READF2='7A'X
	ENDIF
	SELFUN=SELPNT(TTSEL)
	GOTO 91

C		CONTINUE

226	CONTINUE
	SPWN=5
	GOTO 91

C		BLOCK

227	CONTINUE
	CALL CLR

	IF (SCOPE .EQ. 0) GOTO 91

	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 91
	 GOTO 99
	ENDIF

	GOTO 91

C		PROMPT

228	CONTINUE
	CURSOR=0
	GOTO 91

C		DISALLOW

229	CONTINUE
	ALLOW=1
	GOTO 91

C		ALLOW

230	CONTINUE
	ALLOW=0
	GOTO 91

C		SLAVE

231	CONTINUE

	ISTAT = LIB$DISABLE_CTRL (CTLMASK)

	GOTO 91

C		FREE

232	CONTINUE

	ISTAT = LIB$ENABLE_CTRL (CTLMASK)

	GOTO 91

C		TIMEOUT


233	CONTINUE
	DECODE (LENGTH,2000,STRING(SELSTR+1)) FLAGEX

	IF (FLAGEX .GT. 0) THEN
	  PARM1=FLAGEX
	  READF1='B1'X
	  READF2='FA'X
	ELSE
	  PARM1=0
	  READF1='31'X
	  READF2='7A'X
	ENDIF

	GOTO 91

C		PRIVILEGE

234	CONTINUE

	ISTAT = LIB$GET_SYMBOL (PRV0,PRV2,PRV3)

	IF (ISTAT .EQ. 1) DECODE (PRV3,2000,PRV2) MASK

	ISTAT = LIB$GET_SYMBOL (PRV1,PRV2,PRV3)
	IF (ISTAT .NE. 1) GOTO 91

	DECODE (PRV3,2000,PRV2) SPSTAT

	FLAGEX=IAND(SPWNST,'177776'O)

	IF (IAND(PRVMSK,1) .EQ. 1) FLAGEX=FLAGEX+1
	PRVMSK=FLAGEX

	GOTO 91

C		IF

235	CONTINUE	

	IF ((STRING(SELSTR+1) .EQ. 'E') .OR. (STRING(SELSTR+1) .EQ. 'e')) THEN
	 IF ((SPWNST .EQ. 1) .OR. (SPWNST .EQ. 0)) THEN
	  IF (FUNC .EQ. 35) GOTO 1235
	  GOTO 91
	 ELSE
	  IF (FUNC .EQ. 35) GOTO 91
	  GOTO 1235
	 ENDIF
	ENDIF

	IF ((STRING(SELSTR+1) .EQ. 'C') .OR. (STRING(SELSTR+1) .EQ. 'c')) THEN
	 IF (SCOPE .NE. 1) THEN
	  IF (FUNC .EQ. 35) GOTO 1235
	  GOTO 91
	 ELSE
	  IF (FUNC .EQ. 35) GOTO 91
	  GOTO 1235
	 ENDIF
	ENDIF

	IF ((STRING(SELSTR+1) .EQ. 'P') .OR. (STRING(SELSTR+1) .EQ. 'p')) THEN
	  FLAGEX=1
	  GOTO 2235
	ENDIF

	FLAGEX=0

	IF ((STRING(SELSTR+1) .EQ. 'L') .OR. (STRING(SELSTR+1) .EQ. 'l'))
	9 GOTO 2235

	IF ((LENGTH .GT. 2) .OR. (LENGTH .LE. 0)) GOTO 91

	IF (LENGTH .EQ. 2) THEN
	  IF (STRING(SELSTR+1) .NE. 49) GOTO 91
	  FLAGEX=10
	  SELSTR=SELSTR+1
	ENDIF

	IF ((STRING(SELSTR+1) .LE. 47) .OR. (STRING(SELSTR+1) .GT.
	9 58)) GOTO 91

	FLAGEX=FLAGEX+(STRING(SELSTR+1)-48)

2235	CONTINUE

	IF ((FLAGEX .LT. 0) .OR. (FLAGEX .GE. 17)) GOTO 91

	IF (FLAGEX .EQ. 0) THEN
	  IF ((SETFLG .EQ. 1) .AND. (FUNC .EQ. 35)) GOTO 91
	  IF ((SETFLG .EQ. 0) .AND. (FUNC .EQ. 49)) GOTO 91
	ELSE
	  IF ((IAND(BMASK(FLAGEX),PRVMSK) .NE. 0) .AND.
	9 (FUNC .EQ. 35)) GOTO 91
	  IF ((IAND(BMASK(FLAGEX),PRVMSK) .EQ. 0) .AND.
	9 (FUNC .EQ. 49)) GOTO 91
	ENDIF

	IF ((INITP .EQ. 1) .AND. (SELCT1(SELFUN) .EQ. 0)) GOTO 95
	IF ((INITP .EQ. 0) .AND. (SELECT(SELFUN) .EQ. 0)) GOTO 92

1235	CONTINUE

	SELFUN=SELFUN+2

	IF (DEBUG .EQ. 0) GOTO 91

	CALL CLR
	TYPE 1005
	CALL DELAY
	GOTO 91

C		ASK?

236	CONTINUE
	GOTO 91

C		TITLE

1237	CONTINUE
	IF (SCOPE .EQ. 0) GOTO 91
	IF ((WHOLE .EQ. 0) .OR. (CLEAR .NE. 1)) GOTO 91

	CALL CLR

	WRITE (6) (ESC,'[3;24r')

	IF (SILNT .EQ. 1) THEN
	  WRITE (6) ((BMCR(J), J=1,LENGX),CR,LF,LF)
	ELSE
	  WRITE (6) ((BMCR(J), J=1,LENGX),CR,LF)
	ENDIF

 	TOPFLG=1
	GOTO 91

C		TOP

238	CONTINUE
	IF (SCOPE .EQ. 0) GOTO 91
	IF ((WHOLE .EQ. 0) .OR. (CLEAR .NE. 1)) GOTO 91

	CALL CLR
	WRITE (6) (ESC,'[3;24r')
	TOPFLG=1
	GOTO 91

C		CHOICE

239	CONTINUE
	IF (SCOPE .EQ. 0) GOTO 91
	IF ((WHOLE .EQ. 0) .OR. (CLEAR .NE. 1)) GOTO 91

	CALL  CLR

	WRITE (6) (ESC,'[3;24r')
	WRITE (6) ((SCREEN((CHOPNT(1,TTSEL))+J-1),
	9 J=1,CHOPNT(2,TTSEL)),LF,CR)

 	TOPFLG=1
	GOTO 91

C		LOCK

240	CONTINUE
	LOCK=1
	GOTO 91

C		UNLOCK

241	CONTINUE
	LOCK=0
	GOTO 91

C		ON

242	CONTINUE
	LOGOFF=0
	GOTO 91

C		OFF

243	CONTINUE
	LOGOFF=1
	GOTO 91

C		ERASE

244	CONTINUE
	IF ((WHOLE .EQ. 1) .OR. (SCOPE .EQ. 0)) GOTO 245

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(SELBUF),
	9	%VAL(PARM4),,,,)
	WRITE (6) (ESC,'[J')	

	GOTO 91

C		RESET

245	CONTINUE
	IF (SCOPE .EQ. 0) THEN
	  CALL	CLR
	ELSE
	  WRITE (6) (ESC,'[1;24r',ESC,'[J')
	ENDIF
	GOTO 91

C		MAINTAIN

246	CONTINUE
	OVERID=1
	GOTO 91

C		OVERRIDE

247	CONTINUE
	OVERID=0
	GOTO 91

C		DELAY

1248	CONTINUE
	DECODE (LENGX,2000,MCR) FLAGEX

	IF (FLAGEX .EQ. 0) GOTO 91

	TIMER(1) = -10*1000*1000*FLAGEX
	ISTAT = SYS$SETIMR (%VAL(2),TIMER,,)
	ISTAT = SYS$WAITFR (%VAL(2))

	GOTO 91

C		IFNOT

249	CONTINUE
	GOTO 235

C		XSTATUS

250	CONTINUE
	DECODE (LENGTH,2000,STRING(SELSTR+1)) FLAGEX
	GOTO 1099

C		ZERO

251	CONTINUE
	GOTO 1375

C		END

252	CONTINUE
	IF (INITP .EQ. 1) GOTO 95
	GOTO 92

C		SET

1253	CONTINUE

	IF ((BMCR(1) .EQ. 'L') .OR. (BMCR(1) .EQ. 'l')) THEN
	 SETFLG=1
	 GOTO 91
	ENDIF
	IF ((BMCR(1) .EQ. 'N') .OR. (BMCR(1) .EQ. 'n')) THEN
	 SETFLG=0
	 GOTO 91
	ENDIF

	DECODE (LENGX,2000,BMCR) FLAGEX

	IF (((FLAGEX .EQ. 0) .OR. (FLAGEX .EQ. 1)) .AND. (FUNC .EQ. 53)) THEN

	  IF (FLAGEX .EQ. 0) SETFLG=0
	  IF (FLAGEX .EQ. 1) SETFLG=1

	ELSE

	 IF (FUNC .NE. 69) THEN
	  FLAGEX=IAND(FLAGEX,'177776'O)
	  IF (IAND(PRVMSK,1) .EQ. 1) FLAGEX=FLAGEX+1
	  IF (FUNC .EQ. 53) THEN
	   PRVMSK=FLAGEX
	  ELSE
	   PRVMSK=IAND(PRVMSK,FLAGEX)
	  ENDIF
	 ELSE
	  PRVMSK=IOR(PRVMSK,FLAGEX)
	 ENDIF

	ENDIF

	GOTO 91

C		HALT INIT PROCESS

254	CONTINUE
	IF (RTURN .EQ. 0) GOTO 94
	GOTO 95	

C		KILL LAST REQUEST

255	CONTINUE
	ENDTSK=0
	GOTO 91

C		CHAIN

256	CONTINUE
	SPWN=-1
	GOTO 201

C		SYMBOL
C		LOGICAL

215	CONTINUE
216	CONTINUE
218	CONTINUE
237	CONTINUE
248	CONTINUE
253	CONTINUE
257	CONTINUE
258	CONTINUE
261	CONTINUE
262	CONTINUE
266	CONTINUE
269	CONTINUE
270	CONTINUE
273	CONTINUE
275	CONTINUE
276	CONTINUE
277	CONTINUE
280	CONTINUE
281	CONTINUE

	SELSTR=SELSTR+1
	MLENG=1
	LENGX=0

1257	CONTINUE
	IF ((STRING(SELSTR) .NE. '#') .OR. (STRING(SELSTR+1) .NE.
	9 '#') .OR. (LENGTH .LT. 3)) GOTO 4257

	LENG=(STRING(SELSTR+2))-48
	IF ((LENG .LE. 0) .OR. (LENG .GT. 4)) GOTO 4257

	SPNT=SUB(LENG)
	IF (SPNT .EQ. 0) GOTO 3257

	LENG=SUBBUF(SPNT)
	SPNT=SPNT+1

2257	CONTINUE
	IF (LENG .EQ. 0) GOTO 3257

	BMCR(MLENG)=SUBBUF(SPNT)
	LENGX=LENGX+1
	MLENG=MLENG+1
	SPNT=SPNT+1
	LENG=LENG-1
	GOTO 2257

3257	CONTINUE
	SELSTR=SELSTR+3
	LENGTH=LENGTH-3
	IF (LENGTH .LE. 0) GOTO 5257
	GOTO 1257

9257	CONTINUE
	IF ((STRING(SELSTR) .EQ. TAB) .OR. 
	9	(STRING(SELSTR) .EQ. SPACE)) GOTO 10257
	IF (LENGTH .LE. 0) GOTO 5257
	LENGTH=LENGTH-1
	SELSTR=SELSTR+1
	GOTO 9257
10257	CONTINUE
	LENGTH=LENGTH-1
	SELSTR=SELSTR+1
	GOTO 1257
	

4257	CONTINUE

	IF ((STRING(SELSTR) .EQ. '!') .AND. (LENGTH .GE. 2)) THEN
	 IF (STRING(SELSTR+1) .EQ. 'N') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='m'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'B') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='1'
	   MLENG=MLENG+1
	   BMCR(MLENG)='m'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'F') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='5'
	   MLENG=MLENG+1
	   BMCR(MLENG)='m'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'U') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='4'
	   MLENG=MLENG+1
	   BMCR(MLENG)='m'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'R') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='7'
	   MLENG=MLENG+1
	   BMCR(MLENG)='m'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'W') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='#'
	   MLENG=MLENG+1
	   BMCR(MLENG)='6'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'Z') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='H'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'T') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='#'
	   MLENG=MLENG+1
	   BMCR(MLENG)=':'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 't') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='#'
	   MLENG=MLENG+1
	   BMCR(MLENG)=';'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'H') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='#'
	   MLENG=MLENG+1
	   BMCR(MLENG)='3'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'h') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='#'
	   MLENG=MLENG+1
	   BMCR(MLENG)='4'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'C') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='K'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'E') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='2'
	   MLENG=MLENG+1
	   BMCR(MLENG)='J'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'D') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='J'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'A') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='('
	   MLENG=MLENG+1
	   BMCR(MLENG)='B'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'S') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='('
	   MLENG=MLENG+1
	   BMCR(MLENG)='2'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'G') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='('
	   MLENG=MLENG+1
	   BMCR(MLENG)='0'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'L') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='2'
	   MLENG=MLENG+1
	   BMCR(MLENG)='K'
	   MLENG=MLENG+1
	   LENGX=LENGX+4
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. '<') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='D'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. '>') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='C'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'u') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='A'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'd') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='B'
	   MLENG=MLENG+1
	   LENGX=LENGX+3
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'c') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=13
	   MLENG=MLENG+1
	   LENGX=LENGX+1
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'b') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=8
	   MLENG=MLENG+1
	   LENGX=LENGX+1
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'l') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=10
	   MLENG=MLENG+1
	   LENGX=LENGX+1
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'e') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   LENGX=LENGX+1
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'O') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='?'
	   MLENG=MLENG+1
	   BMCR(MLENG)='6'
	   MLENG=MLENG+1
	   BMCR(MLENG)='h'
	   MLENG=MLENG+1
	   LENGX=LENGX+5
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'o') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='['
	   MLENG=MLENG+1
	   BMCR(MLENG)='?'
	   MLENG=MLENG+1
	   BMCR(MLENG)='6'
	   MLENG=MLENG+1
	   BMCR(MLENG)='l'
	   MLENG=MLENG+1
	   LENGX=LENGX+5
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 's') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='7'
	   MLENG=MLENG+1
	   LENGX=LENGX+2
	  ENDIF
	  GOTO 9257
	 ELSEIF (STRING(SELSTR+1) .EQ. 'r') THEN
	  IF (SCOPE .EQ. 1) THEN
	   BMCR(MLENG)=ESCAPE
	   MLENG=MLENG+1
	   BMCR(MLENG)='8'
	   MLENG=MLENG+1
	   LENGX=LENGX+2
	  ENDIF
	  GOTO 9257
	ELSEIF ((LENGTH .GE. 5) .AND. (STRING(SELSTR+1) .EQ. 'M')) THEN
	 IF (SCOPE .EQ. 1) THEN
	  TEMP=(10*(STRING(SELSTR+3)-48))+(STRING(SELSTR+4)-48)
	  IF (TEMP .NE. 0) THEN
	   DO 8257, I=1,TEMP
	    BMCR(MLENG)=STRING(SELSTR+2)
	    MLENG=MLENG+1
	    LENGX=LENGX+1
8257	   CONTINUE
	  ENDIF
	 ENDIF
	  GOTO 9257
	ELSEIF ((LENGTH .GE. 6) .AND. (STRING(SELSTR+1) .EQ. 'm')) THEN
	 IF (SCOPE .EQ. 1) THEN
	  BMCR(MLENG)=ESCAPE
	  MLENG=MLENG+1
	  BMCR(MLENG)='['
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+2)
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+3)
	  MLENG=MLENG+1
	  BMCR(MLENG)=';'
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+5)
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+6)
	  MLENG=MLENG+1
	  BMCR(MLENG)='r'
	  MLENG=MLENG+1
	  LENGX=LENGX+8
	 ENDIF
	  GOTO 9257
	 ELSEIF ((LENGTH .GE. 6) .AND.
	9 (STRING(SELSTR+1) .GE. '0') .AND.
	9 (STRING(SELSTR+1) .LE. '2')) THEN
	 IF (SCOPE .EQ. 1) THEN
	  BMCR(MLENG)=ESCAPE
	  MLENG=MLENG+1
	  BMCR(MLENG)='['
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+1)
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+2)
	  MLENG=MLENG+1
	  BMCR(MLENG)=';'
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+4)
	  MLENG=MLENG+1
	  BMCR(MLENG)=STRING(SELSTR+5)
	  MLENG=MLENG+1
	  BMCR(MLENG)='H'
	  MLENG=MLENG+1
	  LENGX=LENGX+8
	 ENDIF
	  GOTO 9257
	 ENDIF
	ENDIF

	BMCR(MLENG)=STRING(SELSTR)
	LENGX=LENGX+1
	SELSTR=SELSTR+1
	MLENG=MLENG+1
	LENGTH=LENGTH-1
	IF (LENGTH .NE. 0) GOTO 1257

5257	CONTINUE

	IF ((FUNC .EQ. 15) .OR. (FUNC .EQ. 75)) GOTO 4215
	IF (FUNC .EQ. 16) GOTO 7216
	IF (FUNC .EQ. 18) GOTO 1218
	IF (FUNC .EQ. 37) GOTO 1237
	IF (FUNC .EQ. 48) GOTO 1248
	IF (FUNC .EQ. 53) GOTO 1253
	IF (FUNC .EQ. 69) GOTO 1253
	IF (FUNC .EQ. 70) GOTO 1253
	IF (FUNC .EQ. 61) GOTO 1261
	IF (FUNC .EQ. 62) GOTO 1262
	IF (FUNC .EQ. 66) GOTO 1266
	IF (FUNC .EQ. 73) GOTO 1273
	IF (FUNC .EQ. 76) GOTO 1276
	IF (FUNC .EQ. 77) GOTO 1277
	IF (FUNC .EQ. 80) GOTO 1280
	IF (FUNC .EQ. 81) GOTO 1281

	IF (BMCR(1) .NE. '(') GOTO 91

	SELSTR=2
	MLENG=0
	IF (LENGX .LE. 0) GOTO 91

	DO 6257, J=1,LENGX
	  IF (BMCR(SELSTR) .EQ. ')') GOTO 7257
	  SYMBBF(J)=BMCR(SELSTR)
	  MLENG=MLENG+1
	  SELSTR=SELSTR+1
6257	CONTINUE
	GOTO 91

7257	CONTINUE

	LENGX=LENGX-MLENG-2
	IF (LENGX .LE. 0) GOTO 91

	SELSTR=SELSTR+2

	IF (FUNC .EQ. 57) THEN
	 ISTAT = LIB$SET_SYMBOL (SYMBUF(1:MLENG),MCR(SELSTR:SELSTR+LENGX-2),
	9	GLOB)
	ELSEIF (FUNC .EQ. 58) THEN
	 ISTAT = LIB$SET_LOGICAL (SYMBUF(1:MLENG),MCR(SELSTR:SELSTR+LENGX-2))
	ENDIF

	GOTO 91

C		JET SUB-PROCESS REQUEST

259	CONTINUE
	JET=1
	GOTO 91

C		CLOSE

260	CONTINUE
	CLOSE (UNIT=2)
	GOTO 91

C		OPEN

1261	CONTINUE
	OPEN (UNIT=2,ERR=2261,NAME=MCR(1:LENGX),TYPE='NEW',
	9 CARRIAGECONTROL='LIST')
	GOTO 91
2261	CONTINUE
	GOTO 91

C		WRITE

1262	CONTINUE
	WRITE (2,1016) (MCR(1:LENGX))
	GOTO 91

C		RECALULATE

263	CONTINUE
	GOTO 50

C		SHOW SCRIPT FILENAME

264	CONTINUE
	TYPE 1015,FILNAM
	GOTO 91

C		BOTTOM

265	CONTINUE
	BOTTOM=1
	GOTO 91


C		APPEND

1266	CONTINUE
	OPEN (UNIT=2,ERR=2266,NAME=MCR(1:LENGX),TYPE='UNKNOWN',ACCESS='APPEND',
	9 CARRIAGECONTROL='LIST')
	GOTO 91
2266	CONTINUE
	GOTO 91

C		PRINTER

267	CONTINUE
	IF (SCOPE .EQ. 0) GOTO 91

	SELSTR=SELSTR+1

	IF ((STRING(SELSTR) .EQ. 'A') .OR. (STRING(SELSTR) .EQ. 'a')) THEN
	 PRNTER=1
	ELSEIF ((STRING(SELSTR) .EQ. 'P') .OR. (STRING(SELSTR) .EQ. 'p')) THEN
	 PRNTR=1
	ELSEIF ((STRING(SELSTR) .EQ. 'N') .OR.(STRING(SELSTR) .EQ. 'n')) THEN
	 PRNTER=0
	 PRNTR=0
	ELSEIF ((STRING(SELSTR+1) .EQ. 'L') .OR.
	9 (STRING(SELSTR+1) .EQ. 'l')) THEN
	 PRINT=1
	ELSEIF ((STRING(SELSTR) .EQ. 'R') .OR. (STRING(SELSTR) .EQ. 'r')) THEN
	 PRINT=0
	ELSEIF ((STRING(SELSTR) .EQ. 'S') .OR. (STRING(SELSTR) .EQ. 's')) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRSCRN),
	9	%VAL(3),,,,)
	ELSEIF ((STRING(SELSTR) .EQ. 'D').OR. (STRING(SELSTR) .EQ. 'd')) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRDISA),
	9	%VAL(4),,,,)
	ELSEIF ((STRING(SELSTR) .EQ. 'E') .OR. (STRING(SELSTR) .EQ. 'e')) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRENAB),
	9	%VAL(4),,,,)
	ELSEIF ((STRING(SELSTR+1) .EQ. 'N') .OR.
	9 (STRING(SELSTR+1) .EQ. 'n')) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PRON),
	9	%VAL(5),,,,)
	ELSEIF ((STRING(SELSTR+1) .EQ. 'F') .OR.
	9 (STRING(SELSTR+1) .EQ. 'f')) THEN
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(PROFF),
	9	%VAL(5),,,,)
	ENDIF
	GOTO 91

C
C		PROTECT ON A FUNCTION
C

268	CONTINUE

	IF ((IAND(1,PRVMSK)) .EQ. 0) THEN
	 TYPE 1006
	 CALL DELAY
	 GOTO 92
	ELSE
	 GOTO 91
	ENDIF

C
C		CLOCK STAMP
C

271	CONTINUE

	CALL CLR

	ISTAT = LIB$DATE_TIME(TMCHR)

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL('130'X),,,,%REF(TMSTR),
	9	%VAL(35),,,,)

	GOTO 91

C
C		ASKL
C

1273	CONTINUE

	CALL CLR

	WRITE (6) (CR,LF,(BMCR(J), J=1,LENGX))

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) GOTO 92

	IF ((YESNO(1:1) .EQ. '?') .AND. (SELECT(SELFUN) .EQ. 36))
	9 GOTO 600

	IF ((YESNO(1:1) .EQ. 'Y') .OR. (YESNO(1:1) .EQ. 'y')) GOTO 2273

	SETFLG = 0
	GOTO 91

2273	CONTINUE

	SETFLG = 1
	GOTO 91

C
C		ERROR
C

274	CONTINUE
	SPWN=6
	GOTO 91

C
C		DELETE LOGICAL
C

1276	CONTINUE

	ISTAT=LIB$DELETE_LOGICAL (MCR(1:LENGX))

	GOTO 91
C
C		DELETE SYMBOL
C

1277	CONTINUE

	ISTAT=LIB$DELETE_SYMBOL (MCR(1:LENGX),GLOB)

	GOTO 91

C
C		SAVE CONTEXT
C

278	CONTINUE

	CONTEXT_LEVELB=LEVEL+48
	ISTAT = LIB$SET_SYMBOL (SCRCONTEXT1,CONTEXT(1:250),GLOB)
	ISTAT = LIB$SET_SYMBOL (SCRCONTEXT2,CONTEXT(251:500),GLOB)
	ISTAT = LIB$SET_SYMBOL (SCRCONTEXT3,CONTEXT(501:600),GLOB)
	ISTAT = LIB$SET_SYMBOL (SCRCONTEXT4,CONTEXT_LEVEL,GLOB)

C		FILE CONTEXT SAVE

279	CONTINUE

	ISTAT = LIB$SET_SYMBOL (SCRFILE,FILNAM,GLOB)

	GOTO 91

C		OUTPUT FILE

1280	CONTINUE

	CALL CLR

	OPEN (UNIT=1,ERR=91,NAME=MCR(1:LENGX),
	9 TYPE='OLD',READONLY,SHARED)

	DO WHILE (1)

	 DO 2280, J=1,22
	  READ (1,2002,END=3280)LENGX,BUFF1
	  TYPE 1014,BUFF1(1:LENGX)

2280	CONTINUE

	IF ((SCOPE .EQ. 1) .OR. (DUMB .EQ. 1)) THEN
	 TYPE 1018
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	 IF (TTSTAT(3) .NE. 13) THEN
	  CLOSE (UNIT=1)
	  GOTO 91
	 ENDIF
	ENDIF

	ENDDO

3280	CONTINUE

	CLOSE (UNIT=1)

	IF (SCOPE .EQ. 0) GOTO 91

	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 91
	 GOTO 99
	ENDIF

	GOTO 91

C
C	LOG
C

1281	CONTINUE
	ISTAT = LIB$DATE_TIME(TMCHR)
	WRITE (2,1019) (TMCHR,MCR(1:LENGX))
	GOTO 91

C
C	SUB_ROUTINE
C

282	CONTINUE
	SUB_CALLED=1
	SAVE_I=I
	SAVE_SELFUN=SELFUN
	GOTO 213



C		HELP FROM THE MENU

400	CONTINUE
	TTSEL=TTSEL-100
	SELFUN=SELPNT(TTSEL)
	IF (SELFUN .EQ. 0) GOTO 444

401	IF (SELECT(SELFUN) .EQ. 0) GOTO 444
	IF (SELECT(SELFUN) .EQ. 2) GOTO 410

	SELFUN=SELFUN+2
	GOTO 401

410	CONTINUE
	IF (SELECT(SELFUN+1) .EQ. 0 ) GOTO 444

	SELSTR=SELECT(SELFUN+1)
	LENGTH=STRING(SELSTR)

	IF (STRING(SELSTR+1) .EQ. '(') GOTO 420
	IF (STRING(SELSTR+1) .EQ. '"') GOTO 430	

C		PASS STRING TO "HELP"

	DO 415, J=1,LENGTH
	  HELP1(5+J)=(STRING(SELSTR+J))
415	CONTINUE

	CALL CLR
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1))
	9 WRITE (6) (CR,LF,(HELP1(J), J=1,LENGTH+5),CR)

	ISTAT = LIB$SPAWN (HELP1C(1:LENGTH+5),,,,,SPSTAT)
	GOTO 97

C		PASS STRING TO "TYPE"

420	CONTINUE

	CALL CLR

	OPEN (UNIT=1,ERR=427,NAME=CSTRNG(SELSTR+2:SELSTR+LENGTH-1),
	9 TYPE='OLD',READONLY,SHARED)

	DO WHILE (1)

	 DO 422, J=1,22
	  READ (1,2002,END=427)LENGX,BUFF1
	  TYPE 1014,BUFF1(1:LENGX)

422	CONTINUE

	IF ((SCOPE .EQ. 1) .OR. (DUMB .EQ. 1)) THEN
	 TYPE 1018
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	 IF (TTSTAT(3) .NE. 13) THEN
	  CLOSE (UNIT=1)
	  GOTO 97
	 ENDIF
	ENDIF

	ENDDO

427	CONTINUE

	CLOSE (UNIT=1)

	IF (SCOPE .EQ. 0) GOTO 97

	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 97
	 GOTO 99
	ENDIF

	GOTO 97

C		USE STRING AS HELP TEXT

430	CONTINUE
	SELSTR=SELSTR+1
	LENGTH=LENGTH-2

	WRITE (6) (CR,LF,(STRING(SELSTR+J), J=1,LENGTH),CR)

	GOTO 427

444	CONTINUE
	TYPE 1004
	CALL DELAY
	GOTO 97

C		TIMEOUT PROCESSING

500	CONTINUE
	CALL CLR
	TYPE 1010
	GOTO 214

C		HELP FROM ASK/ASKS PROMPT

600	CONTINUE

	SELSTR=SELECT(SELFUN+1)
	LENGTH=STRING(SELSTR)
	SELFUN=SELFUN-2

	IF (STRING(SELSTR+1) .EQ. '(') GOTO 620
	IF (STRING(SELSTR+1) .EQ. '"') GOTO 630	

C		PASS STRING TO "HELP"

	DO 615, J=1,LENGTH
	  HELP1(5+J)=(STRING(SELSTR+J))
615	CONTINUE

	CALL CLR
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1))
	9 WRITE (6) (LF,CR,(HELP1(J), J=1,LENGTH+5),CR)

	ISTAT = LIB$SPAWN (HELP1C(1:LENGTH+5),,,,,SPSTAT)
	GOTO 91

C		PASS STRING TO "TYPE"

620	CONTINUE

	CALL CLR

	OPEN (UNIT=1,ERR=91,NAME=CSTRNG(SELSTR+2:SELSTR+LENGTH-1),
	9 TYPE='OLD',READONLY,SHARED)

	DO WHILE (1)

	 DO 622, J=1,22
	  READ (1,2002,END=627)LENGX,BUFF1
	  TYPE 1014,BUFF1(1:LENGX)

622	CONTINUE

	IF ((SCOPE .EQ. 1) .OR. (DUMB .EQ. 1)) THEN
	 TYPE 1018
	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	 IF (TTSTAT(3) .NE. 13) THEN
	  CLOSE (UNIT=1)
	  GOTO 91
	 ENDIF
	ENDIF

	ENDDO

627	CONTINUE

	CLOSE (UNIT=1)

	IF (SCOPE .EQ. 0) GOTO 91

	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 91
	 GOTO 99
	ENDIF

	GOTO 91

C		USE STRING AS HELP TEXT

630	CONTINUE
	SELSTR=SELSTR+1
	LENGTH=LENGTH-2

	WRITE (6) (CR,LF,(STRING(SELSTR+J), J=1,LENGTH),CR)

	GOTO 627

C		HELP FROM MENU PROMPT

700	CONTINUE

	IF ((BMCR(1) .EQ. '?') .AND. (MLENG .EQ. 1)) GOTO 720
	IF ((BMCR(1) .NE. '?') .AND. (MLENG .EQ. 4)) GOTO 720

C		HAS A STRING TO PASS TO HELP

	DO 705, J=1,MLENG
	  MLENG=MLENG-1
	  FLAGEX=J
	  IF ((BMCR(J) .EQ. 32) .OR. (BMCR(J) .EQ. 9)) GOTO 710
705	CONTINUE
	GOTO 97
710	CONTINUE

	DO 715, J=1,MLENG
	  HELP1(5+J)=(BMCR(FLAGEX+J))
715	CONTINUE

	CALL CLR
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1))
	9 WRITE (6) (CR,LF,(HELP1(J), J=1,MLENG+5),CR)

	ISTAT = LIB$SPAWN (HELP1C(1:MLENG+5),,,,,SPSTAT)

	GOTO 300

C		NO STRING, USE A CANNED ONE

720	CONTINUE
	CALL CLR
	IF ((SILNT .EQ. 0) .OR. (DEBUG .EQ. 1))
	9 WRITE (6) (CR,LF,(HELP3(J), J=1,9),CR)

	ISTAT = LIB$SPAWN (HELP3C(1:9),,,,,SPSTAT)

727	CONTINUE

	IF (SCOPE .EQ. 0) GOTO 300

	TYPE 1001

	ISTAT = SYS$QIOW (%VAL(2),%VAL(CHAN),%VAL(READF1),%REF(TTSTAT),,,
	9	%REF(YESNO),%VAL(4),%VAL(PARM1),,,)
	IF (TTSTAT(3) .NE. 13) THEN
	 IF (LOCK .EQ. 1) GOTO 300
	 GOTO 99
	ENDIF

	GOTO 300

C		OUTPUT TEXT

1000	FORMAT(/,X,'Do you wish to repeat this selection (Y/N):  ',$)
1001	FORMAT(/,X,'Please press <RETURN> to continue:  ',$)
1002	FORMAT(/,X,'Do you wish to halt this selection (Y/N):  ',$)
1003	FORMAT(/,X,'Selection Not Found')
1004	FORMAT(/,X,'No Help Found for This Selection')
1005	FORMAT(/,X,'Privileged Insufficent')
1006	FORMAT(/,X,'Access Denied')
1007	FORMAT(X,'File Process Error ',A)
1008	FORMAT(X,'Syntax Error on Line ',I)
1009	FORMAT(X,'Command Line Syntax Error')
1010	FORMAT(X,'Terminal Time-Out Exit')
1011	FORMAT(X,'Opening File ',A)
1012	FORMAT(X,I1,I1,I1,I1,X,X,I1,I1,I1,I1,X,X,I1,I1,I1,I1,X,
	9 X,I1,I1,I1,I1,X,X,I1,I1,I1,I1,X,X,I1,I1,I1,I2)
1013	FORMAT(X,'FNC ',I2,' SEL ',I2,' LEN ',I2,
	9 ' PRVMSK ',Z8.8,' BLKMSK ',Z8.8,' SPSTAT ',Z8.8)
1014	FORMAT(X,A)
1015	FORMAT(X,'Present menu script file:  ',A)
1016	FORMAT(A)
1017	FORMAT(/,X,'Password Name not Found -- Contact System Manager -- ')
1018	FORMAT(/,X,'Please press <RETURN> to continue output:  ',$)
1019	FORMAT(A,'  ',A)
1020	FORMAT(X,'Compiled Screen Built for Different Terminal Type, ',A)

C		INPUT FORMATS

2000	FORMAT(I)
2001	FORMAT(A)
2002	FORMAT(Q,A)
	END

C		CLEAR SCREEN SUBROUTINE

	SUBROUTINE CLR
	IMPLICIT INTEGER*4 (A-Z)
	INTEGER*2	SCOPE,CLEAR,WHOLE,DUMB,BOTTOM
	CHARACTER	ESC*1,CR*1,LF*1
	COMMON	/CLEAR/CLEAR
	COMMON	/BOTTOM/BOTTOM
	COMMON	/SCOPE/SCOPE
	COMMON	/WHOLE/WHOLE
	COMMON	/DUMB/DUMB
	COMMON	/ESC/ESC
	COMMON	/LF/LF
	COMMON	/CR/CR
	
	IF ((CLEAR .EQ. 0) .AND. (BOTTOM .EQ. 1)) THEN
	  BOTTOM=0
	  IF (SCOPE .EQ. 1) WRITE (6) (ESC,'[24;1H')
	  RETURN
	ENDIF

	IF (CLEAR .EQ. 0) RETURN

	IF (SCOPE .EQ. 0) THEN
	 IF (DUMB .EQ. 0) THEN
	  WRITE (6) (LF,LF,CR)
	 ELSE
	  WRITE (6) (LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,
	9	     LF,LF,LF,LF,LF,CR)
	 ENDIF
	 CLEAR=0
	 RETURN
	ENDIF
	  

	CLEAR=0

	IF (WHOLE .EQ. 1) WRITE (6) (ESC,'[H',ESC,'[J')
	IF (WHOLE .EQ. 0) WRITE (6) (ESC,'[J')

	RETURN
	END

C		DELAY SUBROUTINE

	SUBROUTINE DELAY
	IMPLICIT INTEGER*4 (A-Z)
	INTEGER*4 TIMER(2),ISTAT
	COMMON	/ISTAT/ISTAT
	COMMON	/TIMER/TIMER

	TIMER(1) = -28*1000*1000
	ISTAT = SYS$SETIMR (%VAL(2),TIMER,,)
	ISTAT = SYS$WAITFR (%VAL(2))

	RETURN
	END
