home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
WORD
/
FP2WP5.ZIP
/
FP2WP5.PRG
next >
Wrap
Text File
|
1992-03-28
|
2KB
|
135 lines
*
* Procedure:
* FP2WP5
* Purpose:
* Create WordPerfect v5.1 secondary merge file from Foxpro database
* Input:
* - Current database area has the database
* - File header.wp contains the header from an empty wp document
* (since I don't know the format of a WP header)
* To create header.wp, start wp and save the blank screen.
* Output:
* Name of the output file is same as database, with extension ".2"
*
procedure FP2WP5
do StartUp with alltrim(alias())+".2"
do OutFieldNames
scan
do chat
for m.i = 1 to fcount()
do OutField with m.i
endfor
do EndRecord
endscan
do ShutDown
return
*******************************************
*
* Output field names
*
procedure OutFieldNames
do FieldList
for m.i = 1 to fcount()
?? field(m.i)+"~"
endfor
?? "~"
do EndRecord
return
*******************************************
*
* Output one field
*
procedure OutField
parameter m.i
private m.var, m.out
m.var = eval(FIELD(m.i))
do case
case type('m.var')='C'
m.out = m.var
case type('m.var')='N'
m.out = str(m.var)
case type('m.var')='D'
m.out = dtoc(m.var)
case type('m.var')='L'
m.out = iif(m.var,'True','False')
endcase
?? alltrim(m.out)
do EndField
return
*******************************************
*
* Output wp's {FIELD LIST} code
*
procedure FieldList
?? chr(222)
?? 'b'
?? chr(04)+chr(0)
?? chr(04)+chr(0)
?? 'b'
?? chr(222)
return
*******************************************
*
* Output wp's {END FIELD} code
*
procedure EndField
?? chr(222)
?? 1
?? chr(04)+chr(0)
?? chr(04)+chr(0)
?? 1
?? chr(222)
?? chr(10)
return
*******************************************
*
* Output wp's {END RECORD} code
*
procedure EndRecord
?? chr(222)
?? chr(52)
?? chr(6)+chr(0)
?? chr(0)+chr(0)
?? chr(6)+chr(0)
?? chr(52)
?? chr(222)
?? chr(10)
return
*******************************************
*
* Say what we're doing
*
procedure chat
if recno() % 10 = 0
wait window nowait ltrim(str(recno())) + " of " + ;
ltrim(str(reccount())) + " records copied."
endif
return
*******************************************
*
* Initialize
*
procedure StartUp
parameter outname
set console off
set talk off
copy file header.wp to (outname)
set print to (outname) additive
set print on
return
*******************************************
*
* Get ready to quit
*
procedure ShutDown
set print off
set print to
return