613-518-1166 info@zimdatabases.com

Zim 9 Connectivity

Configuring the Date Mapping for SAMs

< All Topics

The date mapping when using two heterogeneous database management systems (for instance Zim and Oracle or Zim and DB2) is a feature that enables date values referenced in Zim to be mapped into date values referenced by the server and vice-versa. This date mapping enables non-standard Zim date values to be represented on the server, so that the Zim application system does not change in functionality (that is changing the Zim code). For example, Zim can accept date values like “0” and “1” or even negative values (instead of the standard 20010101  for example) whereas the Server accepts only valid or null dates.

This date mapping is provided by the mapdate.cfg file, which converts Zim date values to valid Server date values and back again. Any time a Zim date value is sent to the Server, its corresponding value is checked in the table; if matching, this Zim date value assumes the corresponding server date value. Any time a date is requested from the Server, the opposite process is accomplished.

The mapdate.cfg configuration file is an ASCII file and should be located in the directory where the SAM has been installed. The mapdate.cfg file can contain any number of lines, each containing a pair of date values, comments, or both.

The pair of date values consists of a Zim date value and a server value, separated by a semi-colon (;). The format of a Zim date value follows Zim rules for dates (for instance 20010101, 0, 2) while the server date values must follow the format YYYY-MM-DD (i.e. 2005-12-31). If one of the date values is omitted, its corresponding value is assumed to be null.

The comments begin with a “%” and follow the same rules of Zim comments.

Use only 8 digits to represent the mapping date for the client. In the example below, a “0” in Zim is mapped onto 1001-01-01 on the database server.

An example of a mapdate.cfg file follows:

%This is date mapping for the accounting system.

%This is datmapping for the accounting system.
0;1001-01-1 % converts Zim dates containing zeros to this date on the server
-1;1001-02-03 % any Zim date value can be used
; 3005-05-05 % null date values in Zim are converted to this date on the server
20031231;    % all Zim dates containing 2003/12/31 are converted to nulls

Use caution when implementing date mapping as shown in the last example, since all null dates on the server are converted back to 20031231.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents