top:
call get'file'name
lookup input'file'name,x
if x <= 0 &
then &
call no'such'file :&
goto quit
call threeup'or'4up
call open'files
format:
the'matrix = matrix'zapper
call load'matrix
if file'empty # "Y"
then &
call shift'lines :&
call write'to'file :&
goto format
tidy'up:
call close'files
? tab(23,1); "that's all folks!"
quit:
end
get'file'name:
? tab (-1,0)
? tab (10,10);
input "enter file name (default = .LST) ",input'file'name
input'file'name=ucs(input'file'name)
x=instr(1, input'file'name,".")
if x=0 &
then &
input'file'name=input'file'name+".LST"
return
no'such'file:
? "there isn't anything like "input'file'name" in this account"
return
open'files:
z=threeup4up
extension ="."+z+"UP"
x=instr(1,input'file'name,".")
output'file'name=input'file'name[1;x-1]+extension
open #1, input'file'name, input
open #2, output'file'name, output
return
threeup'or'4up:
? "how many lables across do you desire to print?"
input "(3 or 4) ",threeup4up
if threeup4up < 3 or threeup4up > 4 &
then &
goto threeup'or'4up
return
load'matrix:
for n = 1 to threeup4up
input'file = file'zapper
input line #1, lname
if eof(1) = 1 &
then &
n = threeup4up : &
goto out'of'names
input line #1, fname
input line #1, company
input line #1, add1
input line #1, add2
input line #1, city
input line #1, state
input line #1, zip
call file'to'matrix
call matrix'to'output'line
out'of'names:
next n
return
shift'lines:
for n = 1 to threeup4up
if len(line'one(n)) = 0 &
then &
line'one(n) = line'two(n) :&
line'two(n) = ""
if len(line'two(n)) = 0 &
then &
line'two(n) = line'three(n) :&
line'three(n) = ""
if len(line'three(n)) = 0 &
then &
line'three(n) = line'four(n) :&
line'four(n) = ""
if len(line'four(n)) = 0
then &
line'four(n) = line'five(n) :&
line'five(n) = ""
next n
return
write'to'file:
close'files:
close #1
close #2
return
file'to'matrix:
line'one(n) = fname + " " + lname
line'two(n) = company
line'three(n) = add1
line'four(n) = add2
line'five(n) = city + ", " + state + " " + zip
return
matrix'to'output'line:
for n = 1 to threeup4up
? #2 tab(35 * (n-1));line'one(n);
next n
? #2
for n = 1 to threeup4up
? #2 tab(35 * (n-1); line'two(n);
next n
? #2
for n = 1 to threeup4up
? #2 tab(35 * (n-1); line'three(n);
next n
? #2
for n = 1 to threeup4up
? #2 tab(35 * (n-1); line'four(n);
next n
? #2
for n = 1 to threeup4up
? #2 tab(35 * (n-1); line'five(n);
next n
? #2
return