Upgrading to DataFlex 3.2: Difference between revisions

m
→‎Use y2k.pkg: Should have been code not a section heading.
m (→‎Compiler Errors: formatting)
m (→‎Use y2k.pkg: Should have been code not a section heading.)
Line 593: Line 593:
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 601: 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 ==