Upgrading to DataFlex 3.2: Difference between revisions

m
Added note about the DataFlex debugger
m (Added note about the DataFlex debugger)
 
(8 intermediate revisions by the same user not shown)
Line 4: Line 4:


The content of this page is based on a whitepaper originally written in May 1998 by Dennis Piccioni from Data Access Worldwide. Updates were made to the content up until 2002, but nothing after that, so some references will be dated.
The content of this page is based on a whitepaper originally written in May 1998 by Dennis Piccioni from Data Access Worldwide. Updates were made to the content up until 2002, but nothing after that, so some references will be dated.
'''Note:''' One very good reason to upgrade is that if you are using DataFlex 3.2, you can use the '''[https://docs.google.com/document/d/1a7DOX7bULiEqAkNXmKA-T91n0RfLFzh8V-CjXwMW0x0/edit#heading=h.mxjauxfaio71 DataFlex Debugger]''' to run your programs in debug mode with features such as single stepping, variable inspection, call stack and record buffer inspection. Read the help and get the DataFlex Debugger download, from the [https://www.dataaccess.eu/resources/downloads/download-category/download-subcategory-842?dagapsg=64 DataFlex Debugger download page].


== Why Upgrade? ==
== Why Upgrade? ==
Line 294: Line 297:
2. The Menu Program (menu.flx)
2. The Menu Program (menu.flx)


DataFlex 3.2 comes with a brand new, object-oriented,  [[#CUA]] compliant menu program. This is the default menu that will run with DataFlex 3.2.
DataFlex 3.2 comes with an object-oriented,  [[#CUA]] compliant menu program. This is the default menu that will run with DataFlex 3.2.
If you wish to use a menu program that more closely resembles the 2.3b style menu program, you can compile menuold.src (\df32\src\source\menuold.src) and then either execute "dfrun menuold" to access this menu or rename menuold.flx to menu.flx to have this menu be used as the default.
If you wish to use a menu program that more closely resembles the 2.3b style menu program, you can compile menuold.src (\df32\src\source\menuold.src) and then either execute "dfrun menuold" to access this menu or rename menuold.flx to menu.flx to have this menu be used as the default.
Note: Do not compile and/or run the 2.3b menu.src in DataFlex 3.2. This will not work, which is why menuold.src was provided with DataFlex 3.2.
Note: Do not compile and/or run the 2.3b menu.src in DataFlex 3.2. This will not work, which is why menuold.src was provided with DataFlex 3.2.
Line 411: Line 414:
'''The -x23 Compiler Flag'''
'''The -x23 Compiler Flag'''


For backward compatibility purposes, DAC provided the compiler flag -x23 (i.e. "dfcomp source.src -x23") for compiling programs as if they had been compiled in 2.3b. This flag was provided until revision 3.04 to allow time for developers to bring their existing programs up to date. Most of the changes in DataFlex that are outlined in this paper and affect existing 2.3 DataFlex code were made to DataFlex with revision 3.0, in about 1990. At some point, a choice must be made between backward compatibility and progress, and as of revision 3.05, the -x23 flag is no longer supported, so you must make the appropriate source code changes to existing DataFlex 2.3 programs.
For backward compatibility purposes, the compiler flag -x23 is provided (i.e. "dfcomp source.src -x23") for compiling programs as if they had been compiled in 2.3b. This flag was provided until revision 3.04 to allow time for developers to bring their existing programs up to date. Most of the changes in DataFlex that are outlined in this article and affect existing 2.3 DataFlex code were made to DataFlex with revision 3.0, in about 1990. At some point, a choice must be made between backward compatibility and progress, and as of revision 3.05, the -x23 flag is no longer supported, so you must make the appropriate source code changes to existing DataFlex 2.3 programs.


== Runtime Errors ==
== Runtime Errors ==
Line 470: Line 473:


===Error 4098 "Bad Relationship"===
===Error 4098 "Bad Relationship"===
We have received some reports of encountering this error from developers upgrading to DataFlex 3.2 or Visual DataFlex. This error will occur at runtime whenever a relationship is found between 2 database fields that are not of exactly the same type and length. Overlap fields are the only exception to this rule; they may relate to either other overlap fields or ASCII fields of the same length.
Error encountered by developers upgrading to DataFlex 3.2 or Visual DataFlex. This error will occur at runtime whenever a relationship is found between 2 database fields that are not of exactly the same type and length. Overlap fields are the only exception to this rule; they may relate to either other overlap fields or ASCII fields of the same length.


Note: Many developers using 2.3b used record number relationships, where a field in one database file is related to the RECNUM field in another file. When upgrading to 3.2, suddenly this message appears. This is usually because the "relating from" field was defined as Numeric 6.0, instead of Numeric 8.0, which is the type and length of the RECNUM field.
Note: Many developers using 2.3b used record number relationships, where a field in one database file is related to the RECNUM field in another file. When upgrading to 3.2, suddenly this message appears. This is usually because the "relating from" field was defined as Numeric 6.0, instead of Numeric 8.0, which is the type and length of the RECNUM field.
Line 548: Line 551:
DataFlex has always been Y2K (Year 2000) capable, meaning that developers have always been able to write Y2K-compliant applications. In prior revisions, such as 2.3b, it was usually up to the developer to ensure data was displayed and saved with 4-digit years, but DataFlex already had the capability to store dates with 4-digit years. This meant creating on-screen and report date images with enough room for 4-digit years, and adding 693975 (the integer equivalent of 01/01/1900) to a 2-digit year, wherever dates were used.
DataFlex has always been Y2K (Year 2000) capable, meaning that developers have always been able to write Y2K-compliant applications. In prior revisions, such as 2.3b, it was usually up to the developer to ensure data was displayed and saved with 4-digit years, but DataFlex already had the capability to store dates with 4-digit years. This meant creating on-screen and report date images with enough room for 4-digit years, and adding 693975 (the integer equivalent of 01/01/1900) to a 2-digit year, wherever dates were used.


In newer revisions of DataFlex (Visual DataFlex, DataFlex 3.2), we have provided an easier method, both for creating new applications that are Y2K compliant and for updating existing, noncompliant applications to full Y2K compliance.
In newer revisions of DataFlex (Visual DataFlex, DataFlex 3.2), there is an easier method, both for creating new applications that are Y2K compliant and for updating existing, noncompliant applications to full Y2K compliance.


DataFlex has always had the capability to store dates with 4-digit years, so a properly written DataFlex application in any version of DataFlex will be Year-2000 (Y2K) compliant. However, in DataFlex 3.2 (caution: revisions of DataFlex prior to 3.1c do not have the Y2K-Enhancements), we have implemented additional support for easily making your applications Y2K compliant.
DataFlex has always had the capability to store dates with 4-digit years, so a properly written DataFlex application in any version of DataFlex will be Year-2000 (Y2K) compliant. However, in DataFlex 3.2 (caution: revisions of DataFlex prior to 3.1c do not have the Y2K-Enhancements), additional support has been implemented for easily making your applications Y2K compliant.


There are numerous additional enhancements and bug fixes to DataFlex 3.2. Please consult the DataFlex 3.2 Readme file for more details on these enhancements and fixes.
There are numerous additional enhancements and bug fixes to DataFlex 3.2. Please consult the DataFlex 3.2 Readme file for more details on these enhancements and fixes.
Line 586: Line 589:
'''DataFlex 3.2'''
'''DataFlex 3.2'''


In DataFlex 3.2, DAC has provided a file called y2k.pkg, which contains the set_Date_Attribute command and default settings for Date4_State (dfTrue), SysDate4_State (dfTrue) and Epoch_Value (30).
In DataFlex 3.2, there is a file called y2k.pkg, which contains the set_Date_Attribute command and default settings for Date4_State (dfTrue), SysDate4_State (dfTrue) and Epoch_Value (30).


To make an existing DataFlex 2.3b program Y2K enhanced, simply add this line to the beginning of your program and recompile the program under DataFlex 3.2:
To make an existing DataFlex 2.3b program Y2K enhanced, simply add this line to the beginning of your program and recompile the program under DataFlex 3.2:
Line 624: Line 627:
DataFlex 2.3 was designed in simpler days of computing. Hard disks were smaller, less memory was available and applications were generally smaller and did fewer things. Developers usually had relatively few development tools (and revisions thereof) installed on their PCs. Those times have changed. Today, it seems one can never have enough hard disk space or RAM and most applications do a gazillion things, whether they are needed or not.
DataFlex 2.3 was designed in simpler days of computing. Hard disks were smaller, less memory was available and applications were generally smaller and did fewer things. Developers usually had relatively few development tools (and revisions thereof) installed on their PCs. Those times have changed. Today, it seems one can never have enough hard disk space or RAM and most applications do a gazillion things, whether they are needed or not.


For programmers things have changed as well. It is common for application designers to develop with many different tools, even for a single application. We often have multiple versions of the same tools installed, if not for development, then to support customers who use these different tools and versions.
For programmers things have changed as well. It is common for application designers to develop with many different tools, even for a single application.  


In DataFlex 2.3b, many developers kept the runtime files in the same directory as the application files (i.e. data and .flx files). In order to successfully upgrade to DataFlex 3.2, or to run the two (or more) versions of DataFlex simultaneously, these files need to be separated. Runtime files from the two versions will interfere with each other.
In DataFlex 2.3b, many developers kept the runtime files in the same directory as the application files (i.e. data and .flx files). In order to successfully upgrade to DataFlex 3.2, or to run the two (or more) versions of DataFlex simultaneously, these files need to be separated. Runtime files from the two versions will interfere with each other.
Line 712: Line 715:
#Make sure c:\df23 is in your PATH environment variable
#Make sure c:\df23 is in your PATH environment variable
#Run DataFlex (dfrun ProgramName, dfcomp, dfquery, etc.)
#Run DataFlex (dfrun ProgramName, dfcomp, dfquery, etc.)
== Moving on to Visual DataFlex ==
Now that Windows is the world's most prevalent operating system, the next step for many DataFlex programmers is moving on to Windows programming. When DataFlex 2.3 was released in 1987, the auto-design facility was so easy to use to create database applications that it was years ahead of the competition. With Visual DataFlex you can experience that feeling again in Windows. Visual DataFlex is a great environment for designing Windows applications and allows you to utilize your existing DataFlex knowledge.
Data files can be shared among DataFlex 2.3b, 3.2 and Visual DataFlex, so your customers can continue to run their existing character-mode applications while you incrementally upgrade them to Visual DataFlex. User interface components, such as data entry screens (views) must be redesigned in VDF using Windows GUI object classes. The Visual DataFlex tools, such as the Integrated Development Environment (IDE) and Database Builder, make writing Windows applications quite enjoyable.
Some parts of your character-mode DataFlex (2.3b or 3.2) source code can be reused (i.e. non-interfaced batch processes such as reports). You will be able to simply cut and paste many parts of your existing programming logic into your VDF applications.
Visual DataFlex, as well as the DataFlex 3.2 console-mode runtime, has the ability to load Windows drivers, such as the Pervasive.SQL Connectivity Kit (which provides an easy yet powerful client-server solution), ODBC drivers and native drivers for other databases such as DB2 and Oracle. You'll never again have to turn down a project because a prospective client is using DB2 and you do not have time to learn a new programming environment.
For more information on upgrading to Visual DataFlex, see John Tuohy's white paper Migrating to Windows with Visual DataFlex.


== Appendix A: Directory Listing of a DataFlex 2.3b Development License ==
== Appendix A: Directory Listing of a DataFlex 2.3b Development License ==