$ZVERSION contains a string showing the version of the currently running Caché system.
The following example returns the $ZVERSION string:
This returns a version string such as the following:
Cache for Windows (x86-32) 2010.2.3 (Build 702U) Tue Feb 15 2011 14:14:23 EST
This string includes the type of Caché installation (product and platform, including CPU type), the version number (2010.2.3), the build number within that version (the “U” in the build number indicates a Unicode version), and the date and time that this version of Caché was created. “EST” is Eastern Standard Time (the time zone for the Eastern United States), “EDT” is Eastern Daylight Saving Time (see Daylight Saving Time for details).
The same information can be viewed by going to the Caché Cube and selecting “About...” or by invoking the GetVersion() class method, as follows:
You can get the component parts of this version string by invoking other %SYSTEM.Version methods, which you can list by invoking:
The $ZVERSION special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
The following example extracts the create date from the version string to calculate how old the current version of Caché is, in days. Note that this example is specific to Windows platforms:
SET createdate=$PIECE($ZVERSION," ",9,11) WRITE !,"Creation date: ",createdate WRITE !,"Current date: ",$ZDATE($HOROLOG,6) SET nowcount=$PIECE($HOROLOG,",") SET thencount=$ZDATEH(createdate,6) WRITE !,"This version is ",(nowcount-thencount)," days old"
The following example performs the same operation by calling a class method:
SET createdate=$SYSTEM.Version.GetBuildDate() WRITE !,"Creation date: ",$ZDATE(createdate,6) WRITE !,"Current date: ",$ZDATE($HOROLOG,6) SET nowcount=$PIECE($HOROLOG,",") WRITE !,"This version is ",(nowcount-createdate)," days old"