Upgrading to DataFlex 3.2: Difference between revisions

m
Reverted edits by Mikepeat (talk) to last revision by Hsymington
m (Tabs away!)
m (Reverted edits by Mikepeat (talk) to last revision by Hsymington)
Tag: Rollback
Line 78: Line 78:
:If you are writing applications for DOS/Windows and Linux/Unix platforms, you should use the Sysconf function with the Sysconf_Dir_Separator to obtain the path separator in your program code:
:If you are writing applications for DOS/Windows and Linux/Unix platforms, you should use the Sysconf function with the Sysconf_Dir_Separator to obtain the path separator in your program code:


<source lang="vdf">
::String sDirSeparator
String sDirSeparator
::move (Sysconf (SYSCONF_DIR_SEPARATOR)) to sDirSeparator
move (Sysconf (SYSCONF_DIR_SEPARATOR)) to sDirSeparator
</source>


*;Install Location
*;Install Location
Line 155: Line 153:


* In order to upgrade to a newer revision of DataFlex, you must recompile your source code file(s) to create new DataFlex programs.
* In order to upgrade to a newer revision of DataFlex, you must recompile your source code file(s) to create new DataFlex programs.
** FOR EXAMPLE: A program compiled under DataFlex revision 2.3b will not run under revision 3.2.
FOR EXAMPLE: A program compiled under DataFlex revision 2.3b will not run under revision 3.2.
** EXCEPTION: You <u>can</u> run programs compiled under DataFlex revision 2.3 with a 3.0 or 3.01 runtime.
* EXCEPTION: You can run programs compiled under DataFlex revision 2.3 with a 3.0 or 3.01 runtime.
* You can run programs compiled with the same major revision but a different letter revision, but we recommend always recompiling and running using the identical revision.
* You can run programs compiled with the same major revision but a different letter revision, but we recommend always recompiling and running using the identical revision.


Line 193: Line 191:
This is the most important environment variable from a DataFlex viewpoint. DataFlex uses this variable to find everything it needs:
This is the most important environment variable from a DataFlex viewpoint. DataFlex uses this variable to find everything it needs:


*termlist.cfg & *.dfr for registration information
termlist.cfg & *.dfr for registration information
*filelist.cfg
filelist.cfg
*data files: *.dat, *.fd, *.k*, *.tag, *.hdr, *.vld
data files: *.dat, *.fd, *.k*, *.tag, *.hdr, *.vld
*compiled DataFlex programs: *.flx
compiled DataFlex programs: *.flx
*source code for DataFlex programs: *.src, *.frm, *.inc, *.pkg, ...
source code for DataFlex programs: *.src, *.frm, *.inc, *.pkg, ...
 
If there are multiple copies of any of the above files along the directories listed in DFPATH, DataFlex will use the first copy that it finds.
If there are multiple copies of any of the above files along the directories listed in DFPATH, DataFlex will use the first copy that it finds.


Line 261: Line 258:
The trick here is to make the shortcut not to the setpath batch file or dfrun.exe, but to command.com. Command.com is the executable program that executes a DOS session under Windows.
The trick here is to make the shortcut not to the setpath batch file or dfrun.exe, but to command.com. Command.com is the executable program that executes a DOS session under Windows.


'''An Example Shortcut on Windows 95/98/ME'''
An Example Shortcut on Windows 95/98/ME
 
Target or Command Line: c:\windows\command.com


Target or Command Line: c:\windows\command.com
This launches a DOS session under Windows.
This launches a DOS session under Windows.


Working: c:\app\data
Working: c:\app\data
 
Starts the session in the specified directory.
Starts the session in the specified directory.


'''Batch File: c:\df32\usr\setpath.bat'''
Batch File: c:\df32\usr\setpath.bat
 
This executes the batch file immediately after starting the DOS session and sets up the session's environment to run DataFlex.
This executes the batch file immediately after starting the DOS session and sets up the session's environment to run DataFlex.


'''An Example Shortcut on Windows NT/2000/XP'''
An Example Shortcut on Windows NT/2000/XP
 
Target or Command Line: c:\winnt\system32\cmd.exe


Target or Command Line: c:\winnt\system32\cmd.exe
All other parameters are the same as the Windows 95/98/ME example above.
All other parameters are the same as the Windows 95/98/ME example above.
Starting a DataFlex Application From a Windows Shortcut
Starting a DataFlex Application From a Windows Shortcut
Line 330: Line 323:
EXAMPLE:
EXAMPLE:


<source lang="vdf">
integer iRev
Integer iRev
Open CUSTOMER
Open CUSTOMER
Get_Attribute DF_File_Revision of CUSTOMER.File_Number to iRev
get_Attribute DF_File_Revision of CUSTOMER.File_Number ;
Showln "File Revision of Customer File: " (String(iRev)) "."
    to iRev
</source>
showln "File Revision of Customer File: " iRev "."


Expression Evaluation
Expression Evaluation
Line 341: Line 333:
There have been some changes in the way logical expressions are evaluated in DataFlex revisions 3.2:
There have been some changes in the way logical expressions are evaluated in DataFlex revisions 3.2:


The standard mathematical logical operators (<, >, >=, <>, etc.) can be used in addition to the DataFlex logical operators used in DataFlex 2.3b (LT, GT, GE, etc.), provided the expression is used in parentheses.
The standard mathematical logical operators (<,>,>=,<>,etc.) can be used in addition to the DataFlex logical operators used in DataFlex 2.3b (LT,GT,GE,etc.), provided the expression is used in parentheses.
 
The Boolean logic operators AND and OR have been added.
The Boolean logic operators AND and OR have been added.
The MIN and MAX operators have been added to replace the use of < and > for this purpose, since < and > are now used as logical operators. It is important to realize how this affects evaluation of program code:
The MIN and MAX operators have been added to replace the use of < and > for this purpose, since < and > are now used as logical operators. It is important to realize how this affects evaluation of program code:
Let's use an example to illustrate this. Look at the following line of DataFlex code:
Let's use an example to illustrate this. Look at the following line of DataFlex code:


<source lang="vdf">
showln (4 > 5)
Showln (4 > 5)
</source>


In DataFlex 2.3b, this line would evaluate to show "5".
In DataFlex 2.3b, this line would evaluate to show "5".
Line 357: Line 345:
The corrected line of code for DataFlex 3.2 to evaluate as it did in DataFlex 2.3 would be:
The corrected line of code for DataFlex 3.2 to evaluate as it did in DataFlex 2.3 would be:


<source lang="vdf">
showln (4 MAX 5)
Showln (4 MAX 5)
</source>


The mathematical operators can now be used on strings, making their function more intuitive and compatible with other programming environments. However, this will result in some expressions evaluating differently in DataFlex 3.x than they did in 2.3.
The mathematical operators can now be used on strings, making their function more intuitive and compatible with other programming environments. However, this will result in some expressions evaluating differently in DataFlex 3.x than they did in 2.3.
Once again, let's look at an example to illustrate the differences. Consider the following lines of DataFlex code, and look at the results they will produce in DataFlex 2.3 and DataFlex 3.2:


Once again, let's look at an example to illustrate the differences. Consider the following lines of DataFlex code, and look at the results they will produce in DataFlex 2.3 and DataFlex 3.2:
string A
string B
move "3" to A
move "2" to B


<source lang="vdf">
String A
String B
Move "3" to A
Move "2" to B
</source>
 
 
Result:
Result
 
Expression DataFlex 2.3b DataFlex 3.2
showln (A + B)     5           "32"
showln (A * B)     6           "3 2"
showln (A - B)     1           "32"


Expression DataFlex 2.3b DataFlex 3.2
showln (A + B) 5 "32"
showln (A * B) 6 "3 2"
showln (A - B) 1 "32"
In DataFlex 2.3, addition of 2 string variables would result in the mathematical addition of the values in the 2 variables; in DataFlex 3.2, the 2 strings are concatenated instead.
In DataFlex 2.3, addition of 2 string variables would result in the mathematical addition of the values in the 2 variables; in DataFlex 3.2, the 2 strings are concatenated instead.


Line 415: Line 398:


Creating a new record:
Creating a new record:
<source lang="vdf">
clear NEWFILE
clear NEWFILE
lock
lock
Line 421: Line 403:
     saverecord NEWFILE
     saverecord NEWFILE
unlock
unlock
</source>


Note: In many instances a reread command instead of a lock command will work with a new record. In this case, you MUST use the reread command without any files listed as parameters. If you try to reread a specific file (e.g. reread CUSTOMER) which does not have an active record, you will get an error "status <<25>> record not found". There is a slight penalty (time) for using the reread command without any parameters, which is that all open files with an active record that are not flagged read-only will be reread.
Note: In many instances a reread command instead of a lock command will work with a new record. In this case, you MUST use the reread command without any files listed as parameters. If you try to reread a specific file (e.g. reread CUSTOMER) which does not have an active record, you will get an error "status <<25>> record not found". There is a slight penalty (time) for using the reread command without any parameters, which is that all open files with an active record that are not flagged read-only will be reread.


Editing an existing record:
Editing an existing record:
<source lang="vdf">
reread FILE
reread FILE
     move VAR to FILE.FIELD
     move VAR to FILE.FIELD
     saverecord FILE
     saverecord FILE
unlock
unlock
</source>


Copying data from an existing record in FILE to a new record in NEWFILE:
Copying data from an existing record in FILE to a new record in NEWFILE:
<source lang="vdf">
reread FILE
reread FILE
     move FILE.FIELD to NEWFILE.FIELD
     move FILE.FIELD to NEWFILE.FIELD
     saverecord NEWFILE
     saverecord NEWFILE
unlock
unlock
</source>
Explanation of terms:


*NEWFILE is a data file where a new record is being created
* Explanation of terms:
*FILE is a data file with an existing record
*VAR is a variable in the program code


NEWFILE is a data file where a new record is being created
FILE is a data file with an existing record
VAR is a variable in the program code
Note: There are important differences between the saverecord and save commands. The difference is that the save command attaches related ancestral file (parent, grandparent, etc) information, so that information from the related parent record will overwrite information moved manually into the child record buffer when saving. Saverecord does not do anything at all with related files, it only affects the file(s) listed as parameter(s).
Note: There are important differences between the saverecord and save commands. The difference is that the save command attaches related ancestral file (parent, grandparent, etc) information, so that information from the related parent record will overwrite information moved manually into the child record buffer when saving. Saverecord does not do anything at all with related files, it only affects the file(s) listed as parameter(s).


Line 472: Line 449:
All of the following utilities are documented in the DataFlex 3.2 User's Guide.
All of the following utilities are documented in the DataFlex 3.2 User's Guide.


'''DFAdmin'''
DFAdmin


DFAdmin is a superset of various other utilities, including, most notably, DFMaint and DFSort. Here are some of its features:
DFAdmin is a superset of various other utilities, including, most notably, DFMaint and DFSort. Here are some of its features:


*Editing of filelist entries, even for multiple filelists, not just the current one (like DFMaint allows).
Editing of filelist entries, even for multiple filelists, not just the current one (like DFMaint allows).
*It allows for mass-manipulation of data files unlike other utilities, like DFFile, which can only manipulate one file at a time.
 
*Accepts command line parameters for all filelist and index manipulation.
It allows for mass-manipulation of data files unlike other utilities, like DFFile, which can only manipulate one file at a time.
*Can convert datafiles to and from other database formats (i.e. Btrieve, DB2, ODBC) using DataFlex loadable drivers.
 
Accepts command line parameters for all filelist and index manipulation.
 
Can convert datafiles to and from other database formats (i.e. Btrieve, DB2, ODBC) using DataFlex loadable drivers.


'''DFConfig'''
DFConfig


The DFConfig utility now provides much of the functionality provided by DFSetup in DataFlex 2.X, and some new features as well.
The DFConfig utility now provides much of the functionality provided by DFSetup in DataFlex 2.X, and some new features as well.
Line 487: Line 467:
Some of the features of DFConfig are:
Some of the features of DFConfig are:


*Accelerator key definition
Accelerator key definition
*Color settings
 
*Appearance settings for things like currency
Color settings
*Date and number format settings
 
*Other miscellaneous settings
Appearance settings for things like currency


'''DFMaint'''
Date and number format settings
 
Other miscellaneous settings
 
DFMaint


One of the best new features for developers in DataFlex 3.2 is in the DFMaint utility: The ability to edit the filelist entries! Here you can add, remove, and edit individual entries in your current filelist.cfg.
One of the best new features for developers in DataFlex 3.2 is in the DFMaint utility: The ability to edit the filelist entries! Here you can add, remove, and edit individual entries in your current filelist.cfg.
Line 501: Line 485:
The DataFlex maintenance utility provides access to the following:
The DataFlex maintenance utility provides access to the following:


*Indexing utility
Indexing utility
*Cleanup utility
 
*Editing of filelist entries
Cleanup utility
 
Editing of filelist entries


'''DFQuery'''
DFQuery


In DataFlex 3.2, the DFQuery utility has been replaced with DFQ, a DataFlex program with the same functionality as DFQuery. Since DFQ is a DataFlex program, it can load database drivers using any available Connectivity Kit for DataFlex.
In DataFlex 3.2, the DFQuery utility has been replaced with DFQ, a DataFlex program with the same functionality as DFQuery. Since DFQ is a DataFlex program, it can load database drivers using any available Connectivity Kit for DataFlex.


'''DFSetup'''
DFSetup


As of DataFlex revision 3.0, the DFSetup utility only validates and registers serial number, registration name and registration code into the binary file termlist.cfg. All other functionality DFSetup had in DataFlex 2.X has been moved to the DFConfig utility.
As of DataFlex revision 3.0, the DFSetup utility only validates and registers serial number, registration name and registration code into the binary file termlist.cfg. All other functionality DFSetup had in DataFlex 2.X has been moved to the DFConfig utility.


'''DFSort''' - Index Utility
DFSort - Index Utility


In DataFlex 3.2, dfsort.exe was introduced as a new utility for reindexing. Dfindex was dropped from the product entirely starting with revision 3.1.
In DataFlex 3.2, dfsort.exe was introduced as a new utility for reindexing. Dfindex was dropped from the product entirely starting with revision 3.1.
Line 698: Line 684:
Keep in mind that your application may use files with the same name, so having them listed here does not guarantee that they are not part of the application. The sample files, as you see below, contain data files such as customer.dat and vendor.dat. If your application has data files with the same name, those files need to be moved to the data directory (c:\app\data). Your developer is the person who should provide you with that information.
Keep in mind that your application may use files with the same name, so having them listed here does not guarantee that they are not part of the application. The sample files, as you see below, contain data files such as customer.dat and vendor.dat. If your application has data files with the same name, those files need to be moved to the data directory (c:\app\data). Your developer is the person who should provide you with that information.


cleanup.flx   cleanup.src     customer.dat   customer.fd
cleanup.flx cleanup.src customer.dat customer.fd
customer.flx   customer.frm   customer.k1     customer.tag
customer.flx customer.frm customer.k1 customer.tag
custrpt.flx   custrpt.rpt     date.flx       date.frm
custrpt.flx custrpt.rpt date.flx date.frm
dbread.flx     dbread.src     delqry.flx     delqry.src
dbread.flx dbread.src delqry.flx delqry.src
dfask.com     dfauto.exe     dfcomp.exe     dfconver.exe
dfask.com dfauto.exe dfcomp.exe dfconver.exe
dfedit.exe     dffile.exe     dfindex.exe     dfpack.exe
dfedit.exe dffile.exe dfindex.exe dfpack.exe
dfquery.exe   dfrun.exe       dfsetup.exe     filelist.cfg
dfquery.exe dfrun.exe dfsetup.exe filelist.cfg
flex.exe       flex.cfl       flexerrs.flx   flexerrs.dat
flex.exe flex.cfl flexerrs.flx flexerrs.dat
flexerrs.fd   flexerrs.frm   flexerrs.tag   fmac
flexerrs.fd flexerrs.frm flexerrs.tag fmac
halo3270.dev   haloact2.prn   haloamde.dev   halocljt.prn
halo3270.dev haloact2.prn haloamde.dev halocljt.prn
haloclsr.prn   halocm25.dev   halocolm.prn   halocono.dev
haloclsr.prn halocm25.dev halocolm.prn halocono.dev
halocrna.prn   halodblo.prn   halodeba.dev   haloepjx.prn
halocrna.prn halodblo.prn halodeba.dev haloepjx.prn
haloepsn.prn   halogeni.dev   halogncm.prn   haloherc.dev
haloepsn.prn halogeni.dev halogncm.prn haloherc.dev
haloibm.dev   haloibme.dev   haloibmg.dev   haloicba.dev
haloibm.dev haloibme.dev haloibmg.dev haloicba.dev
haloimgt.dev   haloimwr.prn   haloinda.dev   halojlsr.prn
haloimgt.dev haloimwr.prn haloinda.dev halojlsr.prn
halolasr.prn   haloljtp.prn   halomits.prn   halomult.dev
halolasr.prn haloljtp.prn halomits.prn halomult.dev
halonine.dev   halopal.prn     halopalm.dev   halopcjr.dev
halonine.dev halopal.prn halopalm.dev halopcjr.dev
haloprsm.prn   haloqdcl.dev   haloquad.dev   haloquad.prn
haloprsm.prn haloqdcl.dev haloquad.dev haloquad.prn
haloscio.dev   halosigm.dev   halostb.dev     halotecm.dev
haloscio.dev halosigm.dev halostb.dev halotecm.dev
halotex.dev   halotjet.prn   halotosh.prn   halovdaa.dev
halotex.dev halotjet.prn halotosh.prn halovdaa.dev
halowyse.dev   invoice.flx     invoice.frm     invt.dat
halowyse.dev invoice.flx invoice.frm invt.dat
invt.fd       invt.flx       invt.frm       invt.k1
invt.fd invt.flx invt.frm invt.k1
invt.k2       invt.k3         invt.tag       items.dat
invt.k2 invt.k3 invt.tag items.dat
items.fd       items.k1       items.k2       items.tag
items.fd items.k1 items.k2 items.tag
menu.flx       menu.dat       menu.tag       menu.fd
menu.flx menu.dat menu.tag menu.fd
menu.src       menudef.flx     menudef.src     modmenu.flx
menu.src menudef.flx menudef.src modmenu.flx
movement.flx   movement.rpt   pn90230.23b     pn90250.23b
movement.flx movement.rpt pn90230.23b pn90250.23b
query.dat     query.tag       query.fd       query.k1
query.dat query.tag query.fd query.k1
query.hlp     read.flx       read.src       sysfile.dat
query.hlp read.flx read.src sysfile.dat
sysfile.fd     sysfile.tag     termlist.cfg   vendor.dat
sysfile.fd sysfile.tag termlist.cfg vendor.dat
vendor.fd     vendor.flx     vendor.frm     vendor.k1
vendor.fd vendor.flx vendor.frm vendor.k1
vendor.tag     venrpt.flx     venrpt.rpt     version
vendor.tag venrpt.flx venrpt.rpt version


== Glossary ==
== Glossary ==
Line 741: Line 727:


You may want to check for an updated version of this white paper on our Web site from time to time. Many of our White Papers are updated as information changes. For those papers, the Last Edited date is always at the top of the paper.
You may want to check for an updated version of this white paper on our Web site from time to time. Many of our White Papers are updated as information changes. For those papers, the Last Edited date is always at the top of the paper.
 
Visit the Data Access Worldwide Support Home page for information about all of our support offerings, including free support offerings, such as the Technical Knowledge Base, White Papers and Peer Support Newsgroups: http://www.dataaccess.com/support.
Visit the Data Access Worldwide Support Home page for information about all of our support offerings, including free support offerings, such as the Technical Knowledge Base, White Papers and Peer Support Newsgroups: https://support.dataaccess.com/.
 
Transformation - Converting DataFlex 2.3b Applications to Revision 3.0, Doug Goldner, Data Access Corporation, 1992, 168 pages. Available from Data Access Corporation or your local distributor.
Transformation - Converting DataFlex 2.3b Applications to Revision 3.0, Doug Goldner, Data Access Corporation, 1992, 168 pages. Available from Data Access Corporation or your local distributor.
Migrating to Windows with Visual DataFlex, White Paper, John J. Tuohy, Data Access Corporation, June 6, 1997, Location: http://www.dataaccess.com/WhitePapers.
Migrating to Windows with Visual DataFlex, White Paper, John J. Tuohy, Data Access Corporation, June 6, 1997, Location: http://www.dataaccess.com/WhitePapers.
DataFlex and the Year 2000, White Paper, N. Joe Potts, Data Access Corporation, December 2, 1997, Location: http://www.dataaccess.com/WhitePapers.
DataFlex and the Year 2000, White Paper, N. Joe Potts, Data Access Corporation, December 2, 1997, Location: http://www.dataaccess.com/WhitePapers.
DataFlex and DLLs, White Paper, Application Engineering Group, Data Access Corporation, April 25, 1996, Location: http://www.dataaccess.com/WhitePapers.
DataFlex and DLLs, White Paper, Application Engineering Group, Data Access Corporation, April 25, 1996, Location: http://www.dataaccess.com/WhitePapers.
Data Definition in Visual DataFlex, White Paper, Data Access Nederland, December 17, 1998, Location: http://www.dataaccess.com/WhitePapers.
Data Definition in Visual DataFlex, White Paper, Data Access Nederland, December 17, 1998, Location: http://www.dataaccess.com/WhitePapers.
Transactions in DataFlex 3.1, White Paper, Application Engineering Group, Data Access Corporation, April 25, 1996, Location:
Transactions in DataFlex 3.1, White Paper, Application Engineering Group, Data Access Corporation, April 25, 1996, Location:
DataFlex 3.2 Installation & Environment Guide, DataFlex 3.2 CD, Data Access Corporation.
DataFlex 3.2 Installation & Environment Guide, DataFlex 3.2 CD, Data Access Corporation.
Online Documentation for Visual DataFlex (all revisions of VDF).
Online Documentation for Visual DataFlex (all revisions of VDF).
Windows User's Guide to DOS : Using the Command Line in Windows 95/98, Carolyn Z. Gillay & Bette A. Peat, September 1998, Franklin Beedle & Assoc; ISBN: 1887902422.
Windows User's Guide to DOS : Using the Command Line in Windows 95/98, Carolyn Z. Gillay & Bette A. Peat, September 1998, Franklin Beedle & Assoc; ISBN: 1887902422.
DFConver utility, Location: ftp://ftp.dataaccess.com/pub/products/dataflex/tools.
DFConver utility, Location: ftp://ftp.dataaccess.com/pub/products/dataflex/tools.
Note: There is a lot of useful information in all of the DataFlex documentation. Some of the most useful files for the topic of this paper are in the electronic documentation files that can be read with the Adobe Acrobat reader.


Note: There is a lot of useful information in all of the DataFlex documentation. Some of the most useful files for the topic of this paper are in the electronic documentation files that can be read with the Adobe Acrobat reader.


Data Access Technical Knowledge Base http://www.dataaccess.com/kbase.asp


Data Access Technical Knowledge Base    http://www.dataaccess.com/kbase.asp
Many answers to technical problems can be found online in the Data Access Technical Knowledge Base. Here, you can access the same live data that Data Access Worldwide technical support and development staff use to enter and track technical articles.
Many answers to technical problems can be found online in the Data Access Technical Knowledge Base. Here, you can access the same live data that Data Access Worldwide technical support and development staff use to enter and track technical articles.