2!		PROGRAM		: BATDCD.BAS
5!		VERSION		: V10.1
6!		EDIT		: A
7!		EDIT DATE	: 10-MAY-91
8!
10		EXTEND
11	! &
	&
	&
	!		  C O P Y R I G H T &
	&
	&
  !		      Copyright (C) 1974, 1991 by &
  !	        Digital Equipment Corporation, Maynard, Mass. &
  !	&
  !	&
  !	This software is furnished under a license and may be used and &
  !	copied  only  in accordance with the terms of such license and &
  !	with the  inclusion  of  the  above  copyright  notice.   This &
  !	software  or  any  other copies thereof may not be provided or &
  !	otherwise made available to any other person.  No title to and &
  !	ownership of the software is hereby transferred. &
  !	&
  !	The information in this software is subject to change  without &
  !	notice  and should not be construed as a commitment by Digital &
  !	Equipment Corporation. &
  !	&
  !	DIGITAL assumes no responsibility for the use  or  reliability &
  !	of its software on equipment that is not supplied by DIGITAL. &
  !	&
  !******************************************************************* &
	&
	&

20	! &
	&
	&
	!	M O D I F I C A T I O N    H I S T O R Y &
	&
	&

21	! VER/ED	EDIT DATE	REASON &
	! &

99!	&
	&

100	! &
	&
	&
	!	G E N E R A L    D E S C R I P T I O N &
	&
	&

101!	BATDCD IS A SHORT PROGRAM WHICH CREATES A VIRTUAL CORE LOOKUP &
   !	TABLE FROM WHICH BATCH(MODULE 6 IN THE SPOOLING PACKAGE) CAN PERFORM &
   !	CHECKS FOR VALID COMMANDS AND SWITCHES.  THESE COMMANDS AND
102!	SWITCHES ARE DESCRIBED IN THE SYSTEM USER'S GUIDE.  THE FOLLOWING &
   !	IS A SHORT DESCRIPTION OF THE OVERLAID STRUCTURE OF THE VIRTUAL &
   !	CORE LOOKUP TABLE.
103!	THE VIRTUAL CORE ARRAY OCCUPIES (6) 256 WORD BLOCKS ON DISK. THE &
   !	FILENAME IS "BATCH.DCD" AND CAN BE FOUND UNDER ACCOUNT [1,2] ON &
   !	THE PUBLIC STRUCTURE.  FOUR (4) TYPES OF DATA CAN BE FOUND IN
104!	THIS LOOKUP TABLE. &
   !		1.)  OPERATOR RESPONSES &
   !		2.)  COMMAND KEYWORDS &
   !		3.)  COMMAND SWITCHES &
   !		4.)  FILE SPECIFICATION FIELD SWITCHES
105!	&
   !	THE FIRST 16 WORDS OF BLOCK 1 IN THE VIRTUAL CORE ARRAY CONTAIN &
   !	THE OPERATOR RESPONSES.  THERE ARE FOUR OF THEM, EACH UP TO
106!	8 CHARACTERS LONG.  THEY ARE REFERRED TO IN BATCH BY THE ARRAY &
   !	O9$(3%). &
   !
107!	THE REMAINDER OF THE FIRST BLOCK OF THE ARRAY CONTAINS A MAXIMUM &
   !	OF THIRTY (62) COMMAND KEYWORDS.  EACH ARE UP TO 16 CHARACTERS LONG &
   !	AND ARE REFERRED TO IN BATCH BY THE ARRAY C0$(63%).  NOTE
108!	THAT ELEMENTS 0 AND 1 OF THIS ARRAY ARE NOT USED, AS THEY WOULD &
   !	REFER TO THE OPERATOR RESPONSE TABLE DESCRIBED ABOVE. &
   !	REFERENCES TO THE C0$() ARRAY SHOULD THEREFORE USE AN INDEX
109!	VALUE NO LESS THAN 2.  ENTRIES IN THIS ARRAY WHICH DO NOT CORRESPOND &
   !	TO KEYWORDS ARE NULLED (I.E., IF THERE ARE ONLY 16 KEYWORDS, THE &
   !	REMAINDER OF THE ROW WOULD BE NULLED).
110!	&
   !	THE SECOND BLOCK OF THE VIRTUAL CORE TABLE CONTAINS A MAXIMUM &
   !	OF 62 COMMAND SWITCHES.  EACH ARE UP TO 16 CHARACTERS LONG.
111!	THESE SWITCHES ARE REFERRED TO IN BATCH BY THE 2ND ROW OF THE ARRAY &
   !	S0$(2%,63%) (I.E., THE SECOND ROW CORRESPONDS TO AN INDEX &
   !	VALUE OF 1 AS THERE ARE THREE ROWS, 0,1,AND 2).  THE FIRST
112!	TWO ELEMENTS ARE NOT USED AND THEREFORE THE SECOND INDEX &
   !	VALUE SHOULD NEVER BE LESS THAN 2.  ENTRIES IN THIS ROW WHICH &
   !	DO NOT CORRESPOND TO SWITCHES ARE NULLED.
113!	&
   !	THE THIRD BLOCK OF THE VIRTUAL CORE TABLE CONTAINS A MAXIMUM OF &
   !	62 FILE SPECIFICATION FIELD SWITCHES.  THE RULES ARE THE SAME AS
114!	FOR THE COMMAND SWITCHES ABOVE EXCEPT WE REFERENCE THE 3RD ROW OF &
   !	S0$(2%,63%) (I.E., THE FIRST INDEX VALUE MUST BE 2).  AGAIN WE &
   !	DO NOT USE THE 0 AND 1 ELEMENTS, THEREFORE THE SECOND INDEX SHOULD
115!	NEVER HAVE A VALUE LESS THAN 2.
299!	&

300	! &
	&
	&
	!	I / O    C H A N N E L S &
	&
	&

301!	CHANNEL #		USED FOR &
   !
302!	   9%			OUTPUT FOR CREATION OF VIRTUAL CORE &
   !				TABLE "BATCH.DCD"
399!	&

400	! &
	&
	&
	!	V A R I A B L E    D E F I N I T I O N S &
	&
	&

401!	VARIABLE NAME		USED FOR
420!		C0$()		COMMAND KEYWORD OVERLAY ARRAY
430!		D$		TEMPORARY STRING FOR LOADING ARRAYS
470!		I%		INDEX VARIABLE
480!		J%		INDEX VARIABLE
500!		O8$()		OPERATOR RESPONSE OVERLAY ARRAY
550!		S0$()		SWITCH OVERLAY ARRAY
799!	&
   !		C0$()		COMMAND KEYWORD OVERLAY ARRAY. &

900	! &
	&
	&
	!	D I M E N S I O N    S T A T E M E N T S &
	&
	&

901	DIM #9%, O9$(3%)=8% &
		! OPERATOR RESPONSE OVERLAY ARRAY. &

902	DIM #9%, C0$(63%)=16% &
		! COMMAND KEYWORD OVERLAY ARRAY &

903	DIM #9%, S0$(2%,63%)=16%,L$(39%)=64% &
		! SWITCH OVERLAY ARRAY &
		! LITERAL CONSTANT ARRAY. &

904	DIM Q%(30%) &
		! USED TO FIND OUT WHERE WE CAME FROM. &
	&

999	! &
	&
	&
	!	M A I N    C O D I N G    A R E A &
	&
	&

1000	ON ERROR GOTO 19000 &
		! SET UP STANDARD ERROR HANDLER. &

1010	I$="V10.1-A" &
		! START SETTING UP HEADER. &

1020	I$="BATDCD	"+I$+"	"+CVT$$(RIGHT(SYS(CHR$(6%)+CHR$(9%)),3%),4%) &
	\ PRINT I$ &
	\ PRINT &
		! SET UP HEADER AND PRINT IT &

1200	CHANGE SYS(CHR$(12%)) TO Q% &
	\ PKG.LOC$="["+NUM1$(Q%(6%))+","+NUM1$(Q%(5%))+"]" &
	\ PKG.LOC$=CHR$(Q%(23%))+CHR$(Q%(24%)) &
		+NUM1$(Q%(25%))+":"+PKG.LOC$ &
		IF Q%(26%) AND 1% &
	\ PKG.LOC$="_"+PKG.LOC$ &
	\ IF Q%(3%)+SWAP%(Q%(4%))<>15%*2% THEN &
		PRINT "?BATDCD must be COMPILED" &
	\	GOTO 32767 &
		! SET UP THE NAME OF THE DEVICE AND THE ACCOUNT FROM WHICH WE &
		!  WERE RUN. &
		! ISSUE AN ERROR IF IT WAS NOT A COMPILED FILE. &
	&

3000	! &
	&
	&
	!	B U I L D    T H E    F I L E &
	&

3010	OPEN PKG.LOC$+"BATCH.DCD/SI:12" FOR OUTPUT AS FILE 9%,MODE 16% &
		! OPEN FILE FOR OUTPUT. &

3020	READ O9$(I%) FOR I%=0% TO 3% &
		! PUT OPERATOR RESPONSES INTO TABLE. &

3030	FOR I%=2% TO 63% &
		\ READ D$ &
		\ IF D$="" GOTO 3040 &
		 ELSE C0$(I%)=D$ &

3035	NEXT I% &
		! GET COMMAND KEYWORDS &

3040	FOR J%=I% TO 63% &
		\ C0$(J%)="" &
	\ NEXT J% &
		! NULL THE REST OF THE COMMAND KEYWORD LOOKUP TABLE. &

3050	FOR I%=2% TO 63% &
		\ READ D$ &
		\ IF D$="" GOTO 3060 &
		 ELSE S0$(1%,I%)=D$ &

3055	NEXT I% &
		! GET COMMAND SWITCHES. &

3060	FOR J%=I% TO 63% &
		\ S0$(1%,J%)="" &
	\ NEXT J% &
		! NULL THE REST OF THE COMMAND SWITCH LOOKUP TABLE. &

3070	FOR I%=2% TO 63% &
		\ READ D$ &
		\ IF D$="" GOTO 3080 &
		 ELSE S0$(2%,I%)=D$ &

3075	NEXT I% &
		! GET FILE SPEC FIELD SWITCHES. &

3080	FOR J%=I% TO 63% &
		\ S0$(2%,J%)="" &
	\ NEXT J% &
		! NULL THE REST OF THE FILE SPEC FIELD SWITCH LOOKUP TABLE &

3090	FOR I%=0% TO 39% &
		\ READ L$(I%) &
	\ NEXT I% &
	\ L$(2%)=				CHR$(13%)+CHR$(10%)+ &
			L$(2%)			+CHR$(13%)+CHR$(10%)+ &
			"/"			+CHR$(13%)+CHR$(10%)+ &
			"HISEG=BASIC2"		+CHR$(13%)+CHR$(10%)+ &
			"UNITS = 12"		+CHR$(13%)+CHR$(10%) &
		! READ ALL THE LITERAL CONSTANTS. &

9499	DATA	CONTINUE,RESTART,KILL,DEFER
9500	DATA	SEQUENCE,JOB,EOJ
9501	DATA	EOD,DATA,PRINT
9502	DATA	DELETE,RUN,DIRECTORY
9503	DATA	COPY,CREATE,BASIC
9504	DATA	MESSAGE,MOUNT,DISMOUNT
9505	DATA	COBOL,SORT,FORTRAN
9519	DATA	""
9520	DATA	WAIT,NAME,LIMIT
9521	DATA	CCL,RUN,OBJECT
9522	DATA	LIST,ACC,HELP
9523	DATA	MAP,LOD,CVF
9524	DATA	DELETE,USW,FORMAT
9526	DATA	FILES,PROCESS,KEYS
9527	DATA	INDEXEDSEQUENTIAL,ROUT,PRIORITY
9528	DATA	QUEUE,ERROR,CPU,FOR,EXECUTE,BP1,BP2
9529	DATA	LINE,CHAIN,CREF,SYM
9531	DATA	DEVICE,ALLOCATION,BUCKETSIZE,CONTIGUOUS
9532	DATA	RELATIVE,SEQUENTIAL,SIZE,BLOCKSIZE,DCL
9539	DATA	""
9540	DATA	INPUT,SOURCE,BASIC
9541	DATA	PHYSICAL,WRITE,VID
9542	DATA	OUTPUT,OBJECT,DIRECTORY
9543	DATA	LOGICAL,LIST,COBOL
9544	DATA	SPECIFICATION,FILESTRUCTURE,MAP
9545	DATA	EXECUTE,LIBRARY,DENSITY,PARITY
9546	DATA	LINE,CHAIN,FORTRAN
9547	DATA	""
9558	DATA	"$14 RUN $SORT"
9559	DATA	"$FORLIB.OBJ","LB:BASIC2.OLB/LB"
9560	DATA	"/RUN/OBJ/LIS/ACC/HEL/MAP/LOD/CVF/ERR/USW/CRE/SYM/NORUN"
9562	DATA	"/FOR/IND/SIZ/FIL/PRO/KEY/DEV/BLO"
9564	DATA	"/NOLINE","/NOCHAIN"
9566	DATA	"$14 RUN ","$14 RUN $PIP","$14 RUN $QUE","$14 RUN $DIRECT","$14 RUN $BASIC2"
9568	DATA	"$14 RUN $TKB","/ALL/BUC/CON/REL/SEQ/SIZ/BLO","$14 RUN $FORTRAN","$14 RUN $LINK"
9570	DATA	"WRITE LOCKED","REPLACE ","COMPILE ","$14 OLD ","$14 NEW "
9572	DATA	"WARNING","NONE","FATAL"
9574	DATA	"$9 CTRL/Z","$14 PAUSE","$10 BYE YES","$1 HELLO"
9576	DATA	"?????????????","CANNOT USE THAT ACCOUNT"
9578	DATA	"CANNOT INCREASE PRIORITY","SEQUENCE NOT SUPPORTED YET"
9580	DATA	"INVALID COMMAND","CONTINUATION MISSING"
9582	DATA	"UNMATCHED PARENTHESES OR BRACKETS","UNMATCHED QUOTATION MARKS"
9584	DATA	"INVALID OR MISSING SWITCH","INVALID SPECIFICATION FIELD"
9586	DATA	"LINE TOO LONG - TRUNCATED"
9588	DATA	"$8 ------------"
10000!
19000	ON ERROR GOTO 0 &
		! DUMMY ERROR ROUTINE &

32767	END &

