.ENABLE SUBSTITUTION
;
;                       T A B L E G E N . C M D
;
;     This command file will aid you the user in creating a tailored internal
; table to use with CCL.  It will input data from a standard CCL file and
; Convert it into a format for use as an internal CCL.
;
.START:
.ASKS FILE Enter the name of the CCL file to convert (<CR>->Exit)
.IF FILE EQ "" .GOTO ENDUP
.TESTFILE 'FILE'
.IF <FILERR> NE 1 ; 'FILE' does not exist!
.IF <FILERR> NE 1 .GOTO START
.TESTFILE TABLE.MAC;1
.IF <FILERR> NE 1 .GOTO OPN
; Warning, TABLE.MAC;1 already exists
.ASK SAVE Save existing file
.IFT SAVE ; We will now PAUSE (STOP) and let you rename the TABLE.MAC;1
.IFT SAVE .PAUSE
.OPN:
.OPENR 'FILE'
.IF <FILERR> NE 1 .GOTO START
.OPEN #1 TABLE.MAC;1
.ENABLE DATA #1
	.TITLE TABLE
	.ENABLE LC
	.NLIST	BEX
;
;	DEFINE INTERNAL COMMANDS THAT ARE LEGITIMATE
;
	.PSECT	$TABLE,RO,D,GBL,REL,OVR

$TABLE::
 
.DISABLE DATA #1
.REDLIN:
	.READ STRING
	.IFT <EOF> .GOTO FINISH
	.TEST STRING
	.SETN NUMBR <STRLEN>+0.
	.IF NUMBR LE 0 .GOTO REDLIN
	.SETS DLR STRING[1:1]
	.IF DLR EQ ";" .DATA #1 'STRING'
	.IF DLR EQ ";" .GOTO REDLIN
	.IF DLR NE "$" .GOTO WRTLIN
	.SETS COMAND STRING[6:<STRLEN>]
.ENABLE DATA #1 
;
;	 'COMAND'
;
.DISABLE DATA #1
.WRTLIN:
.ENABLE DATA #1
	.WORD	'NUMBR'.
	.ASCII	&'STRING'&
	.EVEN
.DISABLE DATA #1
.GOTO REDLIN

.FINISH:
.ENABLE DATA #1
 
 
	.WORD	0	;EOF
	.WORD	0
	.END
.DISABLE DATA #1
.CLOSE #1
.CLOSE #0
; 
; TABLE.MAC;1 now contains a prototype Macro-11 internal CCL file.
;
.ENDUP:
