.;	LA50.CMD - Print file on LA50
.;
.;	 16-JAN-1990 09:49:15
.;
	.ENABLE CONTROL-Z
	.ENABLE QUIET
	.SETN TW <TICWID>
	.SETS F P1
	.IF F EQ "?"		.GOTO 110
	.IF F NE ""		.GOTO 20
.10:
	.DISABLE LOWERCASE
	.ASKS F Which file
	.ENABLE LOWERCASE
	.IFT <EOF>		.GOTO 100
	.IF F = ""		.GOTO 100
.20:
	.TESTFILE 'F'
	.SETS FS <FILSPC>
	.IF <FILERR> EQ <SUCCES> .GOTO 30
	@LB:[1,2]INDSYS/LB:QIOERR '<FILERR>'
	.DISABLE QUIET
	;
	;  File 'FS' not available: '<EXSTRI>'!
	;
	.ENABLE QUIET
				.GOTO 10
.30:
	.SETN C 0
	.SETN I 0
	.SETN V 0
	.SETF NAM
	.SETF PAWS
	.SETF DEL
	.SETF B
	.SETN PN 1.
.40:
	.SETN PN PN+1.
	.IF PN > 9.		.GOTO 50
	.IF P'PN' = ""		.GOTO 50
	.IF P'PN' =  "H5" .SETN C 5
	.IF P'PN' =  "H6" .SETN C 6
	.IF P'PN' =  "H8" .SETN C 8
	.IF P'PN' = "H10" .SETN C 1
	.IF P'PN' = "H12" .SETN C 2
	.IF P'PN' = "H16" .SETN C 4
	.IF P'PN' =  "V2" .SETN V 4
	.IF P'PN' =  "V3" .SETN V 5
	.IF P'PN' =  "V4" .SETN V 6
	.IF P'PN' =  "V6" .SETN V 1
	.IF P'PN' =  "V8" .SETN V 2
	.IF P'PN' = "V12" .SETN V 3
	.IF P'PN' =   "N" .SETT NAM
	.IF P'PN' =   "P" .SETT PAWS
	.IF P'PN' =   "D" .SETT DEL
	.IF P'PN' =  "I1" .SETN I 1
	.IF P'PN' =  "I2" .SETN I 2
	.IF P'PN' =  "I3" .SETT B
				.GOTO 40
.50:
	.OPENR #2 'F'
	.IF <FILERR> NE <SUCCES> .GOTO 10

	.PARSE <FILATR> "," SRT SRA SRS A
	.SETN R 'SRS'.		! Get longest record size
	.SETN RA 'SRA'		! Get record attributes
	.IF C > 0		.GOTO 60
	.SETN C 1		! Default to 10 ch/in
	.IF R > 80. .SETN C 2	! Set 12 ch/in
	.IF R > 96. .SETN C 4	! Set 16.5 ch/in
.60:
	.SETN N 10.		! LF in decimal
	.SETS LF "'N%V'"	! Convert to ASCII

	.SETN N 12.		! FF in decimal
	.SETS FF "'N%V'"	! Convert to ASCII

	.SETN N 13.		! CR in decimal
	.SETS CR "'N%V'"	! Convert to ASCII

	.SETN N 27.		! ESC in decimal
	.SETS ESC "'N%V'"	! Convert to ASCII

	.SETS CC ""
	.IF RA = 1 .SETS CC " "

	SET /BUF=TI:132.	! Set wide buffer
	.SETN <FORATT> RA	! Set the correct carriage control
	.OPEN TI:
				! Turn on the printer
	.DATA 'CC''ESC'[5i
				! Select the proper characters/inch
	.DATA 'CC''ESC'['C'w
				! Select the proper lines/inch
	.IF V > 0 .DATA 'CC''ESC'['V'z
				! Select the proper printing density
	.IF I > 0 .DATA 'CC''ESC'['I'"z
	.IFT B .DATA 'CC''ESC'[1m
	.IFT NAM .DATA 'CC''LF''LF''CR''LF''FS':'CR''LF'
.70:
	.READ #2 L
	.IFT <EOF>		.GOTO 90
	.SETS A L[1:1]
	.IF A EQ "^"		.GOTO 70
	.IFF PAWS		.GOTO 80
	.IF A NE FF		.GOTO 80
				! Turn off the printer
	.DATA 'CC''ESC'[4i'CR'
	.DATA Hit RETURN to continue on next page.
	.READ Z
				! Erase message
	.DATA 'CC''ESC'[2K'CR'
				! Turn on the printer
	.DATA 'CC''ESC'[5i'CR'
	.SETS L L[2:*]
.80:
.ENABLE DATA
'L'
.DISABLE DATA
				.GOTO 70
.90:
	.CLOSE #2	
				! Restore 10 characters/inch
	.DATA 'CC''ESC'[0w
				! Restore 6 lines/inch
	.IF V > 0 .DATA 'CC''ESC'[0z
				! Restore to unenhanced density printing
	.IF I > 0 .DATA 'CC''ESC'[0"z
	.IFT B .DATA 'CC''ESC'[0m
				! Turn off the printer
	.DATA 'CC''ESC'[4i'CR'
	.CLOSE
	SET /BUF=TI:'TW'.	! Restore buffer width

	.IFT DEL PIP 'F';0/DE
	.GOTO 100
.110:
	.DISABLE QUIET
;  LA50.CMD - Prints a file on an LA50
;     Parameter P1 is an optional file name
;     Optional trailing parameters (P2, ..., P9):
;       N prints the complete file specification before the file
;       H5, H6, H8, H10, H12, H16 - sets the horizontal characters/inch
;       V2, V3, V4, V6, V8, V12 - sets the vertical lines/inch
;       I1 prints with normal density
;       I2 prints with enhanced density
;       I3 prints with bold density
;       P pauses instead of doing formfeeds to allow single sheet feeding
;       D deletes the file after printing
.100:
	.DISABLE DISPLAY
	.EXIT
