MAGAZINE\DBASE.PRG  ·  PRG  ·  1.3 KB  ·  1991-07-01  ·  from PCPlus_Issue-61_October-1991_FluxEngine-360Kb
set alternate to maillist.txt				{mailmerge file}
set talk off						{stop other information printing}
set heading off						{stop field names printing}
set alternate on					{open maillist.txt}
use colist						{database file to export from}
goto 1							{ensure you're at first record}
do while .not. eof()					{loop while there are any records}
	if survey='Y'					{select record for export}
		if substr(c_name,1,1)=' '		{if first character in filed is blank}
			display '&NSir' off		{then use Sir instead of name}
		else					
			display '&N'+c_name off         {otherwise use their name}
		end if					{precede both with &N)
		display '&C' + company			{display &C pluys company name}
		display '&A' + address_1 off		{display &A plus address on several lines}
		display address_2 off			
		display adress_3 off
		if substr(address_4,1,1) <> ' '         {this displays only if more than three lines}
			display address_4 off
			if substr(adress_5,1,1)<>' '
				display address_5 off
			endif
		endif
		display post_code off			{add the post code}
		display ' ' off				{add a blank line to separate records}
	endif						
	skip						{move to next record}
enddo							{and loop around}
close alternate						{close the maillist.txt file}
return							{and finish}