rem  LIST PRINTING PROGRAM--BY JACK BURKIG
rem WRITTEN IN HISOFT BASIC 11/89

defint a-z
library "gemaes"
dim data$(10)
dim e$(100),s$(100)
introduction:
cls
print "LIST PRINTING PROGRAM by JACK BURKIG. PRESS CONTROL C"
print "TO QUIT, ANY OTHER KEY TO CONTINUE. THEN CLICK ON SUBJECT"
print " AND THEN ON LIST TO PRINT"
pause

get_cat_data:
cls
fsel_input "A:\*.DAT",p$,ok 'call file selector subj.data
if ok=1 then 'conditional required for fsel to work
open "A:\"+ p$ for input as #2
input #2,k
j=1
while j<k+1
input #2, data$(j)
incr j
wend
close #2
end if
if ok=0 then goto introduction

main:
gosub getfile
if ok=0 then goto introduction

review1:
cls
print "WHICH CATEGORY IN FIRST COLUMN?"
print "TYPE 1 TO SELECT "; data$(1); " OR"
print "TYPE 2 TO SELECT "; data$(2)
input " ",order
if order=1 then
name1$=data$(1)
name2$=data$(2)
elseif order=2 then
name1$=data$(2)
name2$=data$(1)
else goto review1
end if
review2:
count = 1
for j=1 to n
if order=1 then
first$=e$(j)
second$=s$(j)
elseif order=2 then
first$=s$(j)
second$=e$(j)
end if
lprint first$; tab (40); second$
incr count
if count = 55 then
lprint chr$(12)
count=0
end if
next j
if j>=n then
cls
print "PRINT MORE LISTS, y,n?"
yesorno
cls
if a$="y" then goto getfile
end if
end


getfile:
cls
fsel_input "A:\*." + data$(7), n$, ok
if ok=1 then 'conditional reqd. for fsel to work
open "A:\"+ n$ for input as #1
input #1,n : rem compiler will not accept i-1 or (i-1)
redim e$(n),s$(n)
j=1
while j<n+1
input #1, e$(j)
incr j
wend
j=1
while j<n+1
input #1, s$(j)
incr j
wend
close #1:i=n
end if
return

sub pause
shared a$
rem the shared command required so a$ can be used outside subroutine
repeat wait
a$=inkey$
if a$<>"" then
exit wait
end if
end repeat wait
end sub

sub yesorno rem wait for y or n keystroke
shared a$
a$=""
do until a$="y" or a$="Y" or a$="n" or a$="N"
pause
loop
end sub

