From:	C5VF::WHITE        "Celtics Fan" 14-JUL-1988 11:50
To:	ARISIA::EVERHART
Subj:	

$! Command file to reformat files
$!    This DCL will read a file with fixed block sizes and create a file
$!    of the same name with variable length records. The variable length
$!    records are assumed to be delimited by <LF> characters in the input
$!    file.
$!
$!    The output can be echoed to the screen by specifying '-e' on the 
$!    command line before the file name.
$!
$!
$!    $@conv [-e] fname 
$!
$!
$! Assume no echo to screen
$	echo = 0
$! Check for command line parameters
$ 	if p1 .nes. "" then goto gotp1
$! Get file name if not specified on command line
$ getfname:
$ 	inquire p1 " File name"        
$ 	goto start
$! Check p1 for usage ('?')
$ gotp1:
$ 	if p1 .nes. "?" then goto notusage
$ 	write sys$output "usage: @conv [-e] fname"
$	goto byebye
$! Check p1 for echo flag ('-e')
$ notusage:
$	p1 = F$edit(p1,"UPCASE")       
$	if p1 .nes. "-E" then goto start
$	echo = 1
$! Check p2 for file name
$	if p2 .eqs. "" then goto getfname
$	p1 = p2          
$! Start conversion
$ start:
$	open/read ifile 'p1'
$! Uses temporary file XXXTMP.TXT
$	if f$search("xxxtmp.txt") .nes. "" then delete xxxtmp.txt;*
$	open/write ofile xxxtmp.txt
$	leftover = ""
$ read_ifile:
$ 	read/end=closeall ifile inrec               
$	prev = 0
$	leftover = leftover + inrec
$ break_record:                    
$ 	next = f$locate("
",leftover)       
$ 	len = f$length(leftover)
$ 	if next .eq. len then goto read_ifile
$ 	outrec = f$extract(prev,next,leftover)      
$ 	leftover = f$extract(next+1,len-1,leftover)
$ 	write ofile outrec                    
$ 	if echo .eq. 1 then write sys$output outrec     
$ 	goto break_record
$ closeall:
$ 	close ifile
$ 	close ofile
$ 	ren xxxtmp.txt 'p1'
$ byebye:
