Upgrading to DataFlex 3.2: Difference between revisions

m
Added note about the DataFlex debugger
(Splitting lines)
m (Added note about the DataFlex debugger)
 
(26 intermediate revisions by 2 users 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 78: Line 81:
: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:


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


*;Install Location
*;Install Location
:The default install location for DataFlex 3.2 on DOS/Windows is c:\df32.
:The default install location for DataFlex 3.2 on DOS/Windows is '''c:\df32'''.
:The default install location for DataFlex 3.2 on Linux/Unix is /usr/local/df32.
:The default install location for DataFlex 3.2 on Linux/Unix is '''/usr/local/df32'''.


*;Batch files versus Shell Scripts
*;Batch files versus Shell Scripts
Line 93: Line 98:
:On the new DataFlex 3.2 for Linux CD (part # 555260cd), we have provided 2 shell scripts to aid you in converting your existing files to lowercase names: lcase and lcaser. The lcase script lowercases all files in a single directory and the lcaser script lowercases all files in a directory and all subdirectories of that directory. To execute either script, simply type the script name, with no arguments, in a terminal changed to the directory you wish to affect:
:On the new DataFlex 3.2 for Linux CD (part # 555260cd), we have provided 2 shell scripts to aid you in converting your existing files to lowercase names: lcase and lcaser. The lcase script lowercases all files in a single directory and the lcaser script lowercases all files in a directory and all subdirectories of that directory. To execute either script, simply type the script name, with no arguments, in a terminal changed to the directory you wish to affect:


::cd /usr/local/df32/mysourcecode
<source lang="vdf">
::lcase
cd /usr/local/df32/mysourcecode
lcase
</source>


*;Binary Compatibility
*;Binary Compatibility
Line 146: Line 153:
# Run DFMaint.exe.
# Run DFMaint.exe.
# Select "Filelist" from the "Maintenance" menu.
# Select "Filelist" from the "Maintenance" menu.
# Highlight the file to convert.
# Highlight the file to convert - To select all files, choose "Select All" from the "Filelist" menu.
:: To select all files, choose "Select All" from the "Filelist" menu.
# Choose "Convert" from the "Database" menu.
# Choose "Convert" from the "Database" menu.
# You will be prompted whether to use a temporary file or convert in place. We recommend the default, "Use temp file".
# You will be prompted whether to use a temporary file or convert in place. We recommend the default, "Use temp file".
Line 166: Line 172:
'''Filelist Entries'''
'''Filelist Entries'''


In order to remove the invalid characters from filelist entries, you can run the DataFlex File Maintenance Utility (dfmaint).
In order to remove the invalid characters from filelist entries, you can run the DataFlex File Maintenance Utility (''dfmaint'').


1. From the Maintenance pulldown menu, select Filelist to display the current filelist entries.
1. From the '''Maintenance''' pulldown menu, select '''Filelist''' to display the current filelist entries.


2. Select the filelist entry you wish to edit and press <Enter>.
2. Select the filelist entry you wish to edit and press <Enter>.


Common symptoms experienced are the inability to open the menu.dat file in the menu program. In this case, you want to select filelist entry number 49, the DataFlex Menu File.
:Common symptoms experienced are the inability to open the menu.dat file in the menu program. In this case, you want to select filelist entry number 49, the '''DataFlex Menu File'''.


3. Make sure that the rootname does not contain any illegal characters such as "@" or ":", such as a commonly used rootname entry in DataFlex 2.3b: "@:menu".
3. Make sure that the rootname does not contain any illegal characters such as "@" or ":", such as a commonly used rootname entry in DataFlex 2.3b: "@:menu".
Line 178: Line 184:
'''Data File Field Names'''
'''Data File Field Names'''


In order to remove invalid characters from File.Field definitions, you need to open the file using DFFile, the DataFlex File Definition Utility. Some commands, make_file for example, will not work properly with invalid characters in front of file.field names.
In order to remove invalid characters from ''File.Field'' definitions, you need to open the file using DFFile, the ''DataFlex File Definition Utility''. Some commands, ''make_file'' for example, will not work properly with invalid characters in front of file.field names.


Note: You can still use the "@" character in front of a data file's User Display Name to hide that data file from the user in DFQuery.
Note: You can still use the "@" character in front of a data file's User Display Name to hide that data file from the user in DFQuery.
Line 184: Line 190:
== Upgrading Source Code to DataFlex 3.2 ==
== Upgrading Source Code to DataFlex 3.2 ==


Properly written source code from prior revisions of DataFlex is fully compatible with revision 3.2 and should compile and operate without problem. The DataFlex 2.3 compiler and runtime were not as strict as the newer versions. In some cases, improper code was allowed to compile and/or run under DataFlex 2.3b, but will generate compiler or runtime errors when used with a newer revision of DataFlex. Data Access Corporation cannot warrant the validity of source code written by someone outside of DAC in every case.
Properly written source code from prior revisions of DataFlex is fully compatible with revision 3.2 and should compile and operate without problem. The DataFlex 2.3 compiler and runtime were not as strict as the newer versions. In some cases, improper code was allowed to compile and/or run under DataFlex 2.3b, but will generate compiler or runtime errors when used with a newer revision of DataFlex.


== Troubleshooting DataFlex 3.2 ==
== Troubleshooting DataFlex 3.2 ==
Line 220: Line 226:
Here are some batch file examples for easy switching between versions of DataFlex. These batch files will run only on DOS-based operating systems or in DOS sessions under Windows.
Here are some batch file examples for easy switching between versions of DataFlex. These batch files will run only on DOS-based operating systems or in DOS sessions under Windows.


Many programmers, as well as end users, run multiple versions of DataFlex and use batch files to switch from version to version. Here at DAC we are always switching among versions: 3.1d, 3.2, Visual DataFlex 8.1, Visual DataFlex 8.2, etc..
Many programmers, as well as end users, run multiple versions of DataFlex and use batch files to switch from version to version.  


Following are some batch file examples for switching among versions. You’ll want to place these batch files in a directory that is included in your  PATH environment variable (e.g. use a directory c:\batch to be included in your  PATH, to contain all batch files).
Following are some batch file examples for switching among versions. You’ll want to place these batch files in a directory that is included in your  PATH environment variable (e.g. use a directory c:\batch to be included in your  PATH, to contain all batch files).
Line 251: Line 257:


Note: The DFPROG environment variable is used by DataFlex revisions 2.3 and 3.01 to find the location of its executable files (i.e. dfrun.exe).
Note: The DFPROG environment variable is used by DataFlex revisions 2.3 and 3.01 to find the location of its executable files (i.e. dfrun.exe).
Note: Writing batch files and using environment variables are advanced operating system topics. If you want to learn more about these topics, you can consult your operating system manuals or the maker of your operating system. You can also go to your local bookstore and find hundreds of books on using operating systems like DOS, Unix and Windows and creating batch processes for these systems. These topics are NOT supported by Data Access Corporation.


== Creating Shortcuts for Running DataFlex on Windows ==
== Creating Shortcuts for Running DataFlex on Windows ==
Line 293: 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 301: Line 305:
== Accelerator Keys (FlexKeys) ==
== Accelerator Keys (FlexKeys) ==


DataFlex 3.2 uses CUA compliant accelerator keys, such as F2 to Save, F8 for "find gt", Shift+F2 to delete, etc.. These keys are quite different from their 2.x predecessors, but it is useful for your end users to learn these keys, because many other applications share the same accelerator keys, making it easier to remember them in the long run. Nevertheless, in the short term, your end user may want to continue using the accelerator keys that they are used to.
DataFlex 3.2 uses [[#CUA]] compliant accelerator keys, such as F2 to Save, F8 for "find gt", Shift+F2 to delete, etc.. These keys are quite different from their 2.x predecessors, but it is useful for your end users to learn these keys, because many other applications share the same accelerator keys, making it easier to remember them in the long run. Nevertheless, in the short term, your end user may want to continue using the accelerator keys that they are used to.


For this purpose, we have provided a file that contains the accelerator key definitions as they were in DataFlex 2.3b (\df32\usr\df23ini.cfg) and a second file with the DataFlex 3.2 accelerator key definitions (\df32\usr\df32ini.cfg). You can add a line of code to any DataFlex 3.2 program to read either of these files:
For this purpose, we have provided a file that contains the accelerator key definitions as they were in DataFlex 2.3b (\df32\usr\df23ini.cfg) and a second file with the DataFlex 3.2 accelerator key definitions (\df32\usr\df32ini.cfg). You can add a line of code to any DataFlex 3.2 program to read either of these files:
Line 308: Line 312:
  read_dfini "df32ini.cfg" - program starts using definitions from DataFlex 3.2
  read_dfini "df32ini.cfg" - program starts using definitions from DataFlex 3.2


Note: If a program uses a dfini.cfg file and chains to another program, the second program will also use the settings defined in that dfini.cfg file.
'''Note:''' If a program uses a dfini.cfg file and chains to another program, the second program will also use the settings defined in that ''dfini.cfg'' file.


By default, the DataFlex 3.2 runtime does not use a dfini.cfg file, all the defaults are hardcoded into the runtime. However, if the runtime encounters a file called dfini.cfg along dfpath, or if a read_dfini statement is in a DataFlex program, it will use the definitions in that file.
By default, the DataFlex 3.2 runtime does not use a dfini.cfg file, all the defaults are hardcoded into the runtime. However, if the runtime encounters a file called ''dfini.cfg'' along dfpath, or if a read_dfini statement is in a DataFlex program, it will use the definitions in that file.


== Do's and Don'ts of Running DataFlex 3.2 and Prior Revisions Concurrently ==
== Do's and Don'ts of Running DataFlex 3.2 and Prior Revisions Concurrently ==
Line 340: Line 344:
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">
<source lang="vdf">
Line 350: Line 354:
</source>
</source>


In DataFlex 2.3b, this line would evaluate to show "5".
:In DataFlex 2.3b, this line would evaluate to show "5".


In DataFlex 3.2, this line will evaluate to show "0" (meaning "False", since 4 is not greater than 5).
:In DataFlex 3.2, this line will evaluate to show "0" (meaning "False", since 4 is not greater than 5).


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">
<source lang="vdf">
Line 360: Line 364:
</source>
</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:


<source lang="vdf">
<source lang="vdf">
Line 371: Line 375:
</source>
</source>


Result:
 
Expression     DataFlex 2.3b DataFlex 3.2
:{| class="wikitable"
showln (A + B)     5           "32"
!colspan="1"|
showln (A * B)     6           "3 2"
!colspan="2"|'''Results'''
showln (A - B)     1           "32"
|-
|'''Expression'''
|'''DataFlex 2.3b'''
|'''DataFlex 3.2'''
|-
|showln (A + B)
|style="text-align:center;" | 5
|style="text-align:center;" | "32"
|-
|showln (A * B)
|style="text-align:center;" | 6
|style="text-align:center;" | "3 2"
|-
|showln (A - B)
|style="text-align:center;" | 1  
|style="text-align:center;" | "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 381: Line 402:
== Compiler Errors ==
== Compiler Errors ==


In DataFlex 3.2, a compiled DataFlex program (a .flx file) will only be created if your source code compilation does not generate any errors.
* In DataFlex 3.2, a compiled DataFlex program (a .flx file) will only be created if your source code compilation does not generate any errors.
The DataFlex 2.3 compiler was very forgiving; it allowed numerous types of incorrect syntax without generating error messages. The newer compiler version has been improved and will often catch errors the 2.3b compiler did not.
* The DataFlex 2.3 compiler was very forgiving; it allowed numerous types of incorrect syntax without generating error messages. The newer compiler version has been improved and will often catch errors the 2.3b compiler did not.
For example, the "Check=" entry option allowed checking for ascii characters without enclosing them in quotes. The DataFlex 3.2 compiler creates an error in this case.
: For example, the "Check=" entry option allowed checking for ascii characters without enclosing them in quotes. The DataFlex 3.2 compiler creates an error in this case.


Incorrect syntax (but not caught by 2.3 compiler):
: Incorrect syntax (but not caught by 2.3 compiler):
     Accept FILE.FIELD {Check=1|2|3}
     Accept FILE.FIELD {Check=1|2|3}


Correct syntax:
: Correct syntax:
     Accept FILE.FIELD {Check="1|2|3"}
     Accept FILE.FIELD {Check="1|2|3"}


'''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 451: Line 472:
You can find additional information on multiuser coding in the white paper Transactions in DataFlex 3.1.
You can find additional information on multiuser coding in the white paper Transactions in DataFlex 3.1.


====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.


====Error 4141 "Data set files must support transaction"====
===Error 4141 "Data set files must support transaction"===
If you are using Data_Sets or DataDictionaries in your programs, you must set the affected data files' transaction type to either Client Atomic or Server Atomic, you cannot leave it as None.
If you are using Data_Sets or DataDictionaries in your programs, you must set the affected data files' transaction type to either Client Atomic or Server Atomic, you cannot leave it as None.


====Zerofile command====
===Zerofile command===
Older revisions of DataFlex allowed execution of the zerofile command while other users had access to the data file. This is no longer the case. For data integrity reasons, starting with DataFlex 3.2, a data file must be opened exclusively to zerofile it. Otherwise, the error message status 4177 "File access violation, file may be in use filename"  will be triggered.
Older revisions of DataFlex allowed execution of the zerofile command while other users had access to the data file. This is no longer the case. For data integrity reasons, starting with DataFlex 3.2, a data file must be opened exclusively to zerofile it. Otherwise, the error message status 4177 "File access violation, file may be in use filename"  will be triggered.


====Modified Runtimes====
===Modified Runtimes===
If you are using a modified DataFlex runtime, check with the provider of that runtime in regards to any of the issues discussed in this paper.
If you are using a modified DataFlex runtime, check with the provider of that runtime in regards to any of the issues discussed in this paper.


====Graphics Commands====
===Graphics Commands===


Graphics commands for character-mode DataFlex are no longer supported in any revision newer than 3.01b, so any such commands will have to be removed from the source code of your program(s).
Graphics commands for character-mode DataFlex are no longer supported in any revision newer than 3.01b, so any such commands will have to be removed from the source code of your program(s).
Line 530: 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 568: 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:


===Use y2k.pkg===
<source lang="vdf">
Use y2k.pkg
</source>


TIP: In DataFlex 2.3b, all images had to be at the very top of the program. In DataFlex 3.2, this is no longer necessary, so you can place code in between images and even before any images at the top of the program. If you have a lot of programs (source files) to which you need to add the "Use y2k.pkg" statement, you could write a small DataFlex program to do this for you. See the DAW Technical Knowledge Base for more information.
'''TIP:''' In DataFlex 2.3b, all images had to be at the very top of the program. In DataFlex 3.2, this is no longer necessary, so you can place code in between images and even before any images at the top of the program. If you have a lot of programs (source files) to which you need to add the "Use y2k.pkg" statement, you could write a small DataFlex program to do this for you. See the DAW Technical Knowledge Base for more information.


'''A Brief Overview of Y2K.pkg'''
'''A Brief Overview of Y2K.pkg'''
Line 580: Line 603:
There are only 3 lines of code in y2k.pkg, which turn on all the automatic Year-2000 enhancements in DataFlex. Here is a brief look at each of the 3 lines of code in y2k.pkg:
There are only 3 lines of code in y2k.pkg, which turn on all the automatic Year-2000 enhancements in DataFlex. Here is a brief look at each of the 3 lines of code in y2k.pkg:


<source lang="vdf">
Set_Date_Attribute Sysdate4_State to DFTrue
Set_Date_Attribute Sysdate4_State to DFTrue
</source>


This line of code toggles the runtime to execute sysdate4 instead of sysdate wherever sysdate is used in a program. This returns the computer's system date with a 4-digit year.
:This line of code toggles the runtime to execute sysdate4 instead of sysdate wherever sysdate is used in a program. This returns the computer's system date with a 4-digit year.


<source lang="vdf">
Set_Date_Attribute Date4_State to DFTrue
Set_Date_Attribute Date4_State to DFTrue
</source>


This line toggles the runtime to automatically convert dates to 4-digit years whenever a date is moved to a data variable or a date field.
:This line toggles the runtime to automatically convert dates to 4-digit years whenever a date is moved to a data variable or a date field.


<source lang="vdf">
Set_Date_Attribute Epoch_Value to 30
Set_Date_Attribute Epoch_Value to 30
</source>


This line of code tells the runtime the cutoff year that determines whether a date is converted to a 19XX year or a 20XX year during automatic conversion.
:This line of code tells the runtime the cutoff year that determines whether a date is converted to a 19XX year or a 20XX year during automatic conversion.


If you want to use a different cutoff year (Epoch value) from the default of 30, you can change the value here, then recompile all programs that contain "Use y2k.pkg". If you want a specific project to have a different cutoff year, you can copy y2k.pkg to the source code area for that project, then edit the Epoch_Value in that copy of y2k.pkg and recompile all programs containing "Use Y2K.pkg" for that project.
:If you want to use a different cutoff year (Epoch value) from the default of 30, you can change the value here, then recompile all programs that contain "Use y2k.pkg". If you want a specific project to have a different cutoff year, you can copy y2k.pkg to the source code area for that project, then edit the Epoch_Value in that copy of y2k.pkg and recompile all programs containing "Use Y2K.pkg" for that project.


== Separating Applications and Runtimes ==
== Separating Applications and Runtimes ==
Line 598: 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 613: Line 642:
You can keep existing programs running in an older revision of DataFlex until you have all components working in DataFlex 3.2.
You can keep existing programs running in an older revision of DataFlex until you have all components working in DataFlex 3.2.


1. Create separate directories for the runtime files and application files, and separate data and source code in the process.
'''1. Create separate directories for the runtime files and application files, and separate data and source code in the process.'''
 
For the remainder of this paper we will assume that the directory where your 2.3b license resides is c:\df23 – you can substitute your actual installed directory name and drive letter for c:\df23.
 
c:\df23 - original 2.3b directory
              - 2.3 runtime files will remain here
              - a copy of the source code files will remain here to be used with 2.3
 
c:\app - directory for your application files
                \data - data files to be shared between revisions 2.3 and 3.2 (subdirectory of \app)
                \src - source code files to be used with 3.2 (subdirectory of \app)
 
Separating your existing 2.3b directory this way will give you numerous operating options:
 
Concurrently run DataFlex 2.3b and 3.2 (or just 3.2)
Have an existing directory structure to easily upgrade to Visual DataFlex


A. Files to be moved into c:\app\data directory:
:For the remainder of this paper we will assume that the directory where your 2.3b license resides is c:\df23 – you can substitute your actual installed directory name and drive letter for c:\df23.


:all data files for your application (*.dat, *.k*, *.tag, *.fd, *.def)
: c:\df23 - original 2.3b directory
filelist.cfg
::- 2.3 runtime files will remain here
::- a copy of the source code files will remain here to be used with 2.3


B. Files to be copied into c:\app\src directory:
: c:\app - directory for your application files
::\data - data files to be shared between revisions 2.3 and 3.2 (subdirectory of \app)
::\src - source code files to be used with 3.2 (subdirectory of \app)


One copy of the source code can remain in \df23 for use with (and to keep up) currently running 2.3b applications, and one copy will go into this directory for use with the new 3.2 version.
:Separating your existing 2.3b directory this way will give you numerous operating options:


:all source code files (*.frm, *.src, *.inc, *.rpt, …)
::1. Concurrently run DataFlex 2.3b and 3.2 (or just 3.2)
::2. Have an existing directory structure to easily upgrade to Visual DataFlex


C. Files to remain in c:\df23 (runtime) directory:
:::A. Files to be moved into c:\app\data directory:


the most important are the executable files (*.exe) and termlist.cfg
:::*all data files for your application (*.dat, *.k*, *.tag, *.fd, *.def)
see Appendix A for a complete list of files that are installed by a DataFlex 2.3b Development License – these are the files that should remain in the c:\df23 directory
:::*filelist.cfg


2. Install 3.2 into a separate directory and install your DataFlex 3.2 registration code
:::B. Files to be copied into c:\app\src directory:


For the remainder of this paper we will assume that the directory where your 3.2 license resides is c:\df32 – you can substitute your actual installed directory name and drive letter for c:\df32.
::::One copy of the source code can remain in \df23 for use with (and to keep up) currently running 2.3b applications, and one copy will go into this directory for use with the new 3.2 version.


Note:
:::*all source code files (*.frm, *.src, *.inc, *.rpt, …)


DOS/Windows: Remember to execute the c:\df32\usr\setpath.bat batch file before running DFSetup.exe to install your registration code.
:::C. Files to remain in c:\df23 (runtime) directory:
Linux/Unix: Remember to execute the /usr/local/df32/usr/setpath script before running dfsetup to install your registration code.


3. Concurrently Running DataFlex 2.3b and 3.2
:::*the most important are the executable files (*.exe) and termlist.cfg
:::*see Appendix A for a complete list of files that are installed by a DataFlex 2.3b Development License – these are the files that should remain in the c:\df23 directory


A. Running DataFlex 3.2
'''2. Install 3.2 into a separate directory and install your DataFlex 3.2 registration code'''


1. Edit the c:\df32\usr\dfenv.cfg file:
:For the remainder of this article we will assume that the directory where your 3.2 license resides is c:\df32 – you can substitute your actual installed directory name and drive letter for c:\df32.


Change the DFPATH= statement to include the c:\app\data directory
:'''Note:'''


Before:
*DOS/Windows: Remember to execute the c:\df32\usr\setpath.bat batch file before running DFSetup.exe to install your registration code.
*Linux/Unix: Remember to execute the /usr/local/df32/usr/setpath script before running dfsetup to install your registration code.


dfpath=.;c:\df32\usr;c:\df32\usr\help;c:\df32\lib;c:\df32\bin;c:\df32\src\pkg;c:\df32\usr\examples\expense;c:\df32\usr\examples\dar;c:\df32\usr\examples\ordentry;c:\df32\usr\examples\big;c:\df32\usr\examples\report;c:\df32\usr\examples\data;
'''3. Concurrently Running DataFlex 2.3b and 3.2'''


After:
:A. Running DataFlex 3.2


dfpath=.;c:\app\data;c:\df32\usr;c:\df32\usr\help;c:\df32\lib;c:\df32\bin;c:\df32\src\pkg;c:\df32\usr\examples\expense;c:\df32\usr\examples\dar;c:\df32\usr\examples\ordentry;c:\df32\usr\examples\big;c:\df32\usr\examples\report;c:\df32\usr\examples\data;
::1. Edit the c:\df32\usr\dfenv.cfg file:


Note: the DFPath statements above may appear different depending on the software you use to view or print this document, but each DFPath statement is a single continuous statement.
::Change the DFPATH= statement to include the c:\app\data directory


2. Switch to c:\app\src directory
::Before:
3. Execute c:\df32\usr\setpath.bat
4. Run DataFlex (dfrun programname, dfcomp, dfquery, etc.)


Note: You may want to use different dfenv.cfg files for different applications so that you can place numerous application specific environment variables into each file.
:::dfpath=.;c:\df32\usr;c:\df32\usr\help;c:\df32\lib;c:\df32\bin;</br>c:\df32\src\pkg;c:\df32\usr\examples\expense;</br>c:\df32\usr\examples\dar;c:\df32\usr\examples\ordentry;</br>c:\df32\usr\examples\big;c:\df32\usr\examples\report;</br>c:\df32\usr\examples\data;


B. Running DataFlex 2.3b


*Switch to c:\df23 directory
::After:
*Set the DFPATH environment variable:
*set DFPATH=.;c:\app\data
*Make sure c:\df23 is in your PATH environment variable
*Run DataFlex (dfrun ProgramName, dfcomp, dfquery, etc.)


== Moving on to Visual DataFlex ==
:::dfpath='''.;c:\app\data;'''c:\df32\usr;c:\df32\usr\help;c:\df32\lib;</br>c:\df32\bin;c:\df32\src\pkg;c:\df32\usr\examples\expense;</br>c:\df32\usr\examples\dar;c:\df32\usr\examples\ordentry;</br>c:\df32\usr\examples\big;c:\df32\usr\examples\report;</br>c:\df32\usr\examples\data;


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.
::'''Note:''' the DFPath statements above may appear different depending on the software you use to view or print this document, but each DFPath statement is a single continuous statement.


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.
::2. Switch to c:\app\src directory
::3. Execute c:\df32\usr\setpath.bat
::4. Run DataFlex (dfrun programname, dfcomp, dfquery, etc.)


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.
::'''Note:''' You may want to use different dfenv.cfg files for different applications so that you can place numerous application specific environment variables into each file.


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.
:B. Running DataFlex 2.3b


For more information on upgrading to Visual DataFlex, see John Tuohy's white paper Migrating to Windows with Visual DataFlex.
#Switch to c:\df23 directory
#Set the DFPATH environment variable - '''set DFPATH=.;c:\app\data'''
#Make sure c:\df23 is in your PATH environment variable
#Run DataFlex (dfrun ProgramName, dfcomp, dfquery, etc.)


== Appendix A: Directory Listing of a DataFlex 2.3b Development License ==
== Appendix A: Directory Listing of a DataFlex 2.3b Development License ==
Line 740: Line 757:
== Glossary ==
== Glossary ==


CUA - Common User Access, part of IBM's  SAA
===CUA===
- Common User Access - Part of IBM's  SAA.


SAA - Systems Application Architecture - a series of interfaces, conventions and protocols which provide a framework for consistent application development and execution
===SAA ===
(Source: DataFlex 3.1 User's Guide, page 241.; DataFlex 3.1 UIMS Handbook)
- Systems Application Architecture - A series of interfaces, conventions and protocols which provide a framework for consistent application development and execution
(Source: DataFlex 3.1 User's Guide, page 241.; DataFlex 3.1 UIMS Handbook)====


== Additional Reading ==
== Additional Reading ==
Line 761: Line 780:
'''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.
'''Transactions in DataFlex 3.1''', White Paper, Application Engineering Group, Data Access Corporation, April 25, 1996, Location: 3.2 Installation & Environment Guide, DataFlex 3.2 CD, Data Access Corporation.
 
''' 3.2 Installation & Environment Guide''', DataFlex 3.2 CD, Data Access Corporation.


'''Online Documentation for DataFlex''': https://docs.dataaccess.com/
'''Online Documentation for DataFlex''': https://docs.dataaccess.com/
Line 776: Line 793:


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.
[[Category:DataFlex (Character Mode)]]