ID: Q113523
The information in this article applies to:
The sample program below will convert a FoxPro 2.5 report file (.FRX) to FoxPro 2.0 format without destroying the original FoxPro 2.5 report file.
The following sample program converts a FoxPro 2.5 report (RPT25.FRX) to a valid FoxPro 2.0 report (RPT20.FRX).
PROCEDURE cnvt2025
PARAMETER output, input
* Add .FRX extension to report filename if not present
IF .NOT. LIKE("*FRX",UPPER(output))
output = output+".FRX"
ENDIF
IF .NOT. LIKE("*FRX",UPPER(input))
input = input+".FRX"
ENDIF
* Store alias of input report database
USE (input)
m.alias = ALIAS()
* Selects only records pertaining to the MS-DOS platform
SELECT * FROM (input) INTO TABLE tempfrx WHERE platform = "DOS"
* Creates database with 2.0 structure
CREATE TABLE (output) ;
(objtype N(2,0), objcode N(2,0), name M, expr M, ;
vpos N(4,0), hpos N(4,0), height N(3,0), width N(3,0), ;
style M, picture M, order M, unique L, comment M, ;
environ L, boxchar C(1), fillchar C(1), tag M, ;
tag2 M, float L, stretch L, norepeat L, resetrpt N(2,0), ;
pagebreak L, resetpage L, ;
swapheader L, swapfooter L, ejectbefor L, ejectafter L, ;
plain L, summary L, addalias L, offset N(3,0), ;
topmargin N(3,0), botmargin N(3,0), totaltype N(2,0), ;
resettotal N(2,0) )
* Copies data to new .FRX file
APPEND FROM tempfrx
* Changes version to 2.0 version number
REPLACE objcode WITH 0 FOR objtype = 1
USE
* Turn off SAFETY setting to prepare to delete temporary database
oldsaf = SET("SAFETY")
SET SAFETY OFF
* Delete temporary database
SELECT tempfrx
USE
ERASE tempfrx.DBF
* Close original report database
SELECT (m.alias)
USE
* Restore SAFETY setting
SET SAFETY &oldsaf
The program is called as follows, assuming RPT25.FRX is the 2.5 report and
RPT20.FRX is the 2.0 report:
=cnvt2025("rpt20.frx","rpt25.frx")
"Update Manual," version 2.5, pages 4-14 to 4-17 "Developer's Guide," version 2.0, pages B-14 to B-15
Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b KBCategory: kbprg kbcode KBSubcategory:
Last Reviewed: April 18, 1995