Thanks for the link.
However, it looks like I already came up with basically the same code that Susannah describes - she uses an amper-variable to set the timesone offset, which of course needs to be adjusted (manually!) every time DST changes.
There is a link to another article in there (http://www.informationbuilders.com/support/developers/timezone) that describes how to obtain the time zone information in Windows by reading the registry. But really, do I have to read the registry and convert the resulting hexadecimal value just to determine which time zone offset our server has?!? That seems a bit complicated (and inefficient)...
It seems to me that the easiest solution would be to obtain the timezone offset from the database that contains the report caster tables. In our case, that's an MS SQL 2005 database, so we should be able to create a master file around something like this:
SELECT GETDATE() - GETUTCDATE() AS EPOCH_AT_TZ
That gives the difference between UTC and our current time zone expressed as a datetime value, which for our zone (CET) gives 1900-01-01 01:00:00.0. Note that that's based in 1900 and not 1970! We'll have to add 70 years back to get our NEXTRUNTIME dates. I'm fairly certain that offset won't impact our calculations.
That value we could then use to determine EPOCH instead of the earlier used calculation, which would give us the correct datetime value to base our NEXTRUNTIME calculations on.
First attemptI found this topic:
http://forums.informationbuild...197093906#5197093906And as a result tried:
TABLE FILE BOTSCHED
PRINT NEXTRUNTIME
COMPUTE DIFF_UTC/HYYMDS = SQL.GETDATE() - SQL.GETUTCDATE();
WHERE READLIMIT EQ 1;
END
Unfortunately, it gives an error:
quote:
0 ERROR AT OR NEAR LINE 3 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC36343) SQL.FUNCTION CANNOT BE USED IN CONSTANT DEFINE DIFF_UTC
(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND
Not sure what's wrong there...
Second attemptOf course, we can just execute the SQL function in SQL:
SQL SQLMSS PREPARE SQLOUT FOR
SELECT GETDATE() - GETUTCDATE() AS DIFF_UTC, ' ' AS DUMMY;
END
DEFINE FILE SQLOUT
EPOCH_AT_TZ/HYYMDs = HADD(DIFF_UTC, 'yy', 70, 8, EPOCH_AT_TZ);
END
TABLE FILE SQLOUT
PRINT
EPOCH_AT_TZ
BY DUMMY
ON TABLE HOLD AS TZINFO FORMAT FOCUS INDEX DUMMY
END
JOIN DUMMY WITH NEXTRUNTIME IN BOTSCHED TO UNIQUE DUMMY IN TZINFO AS J0
DEFINE FILE BOTSCHED
DUMMY/A1V WITH NEXTRUNTIME = ' ';
END
TABLE FILE BOTSCHED
PRINT
EPOCH_AT_TZ
NEXTRUNTIME
COMPUTE NEXTRUNTS/HYYMDs = HADD(EPOCH_AT_TZ, 'ms', NEXTRUNTIME, 8, NEXTRUNTS);
BY SCHEDULEID
BY JOBDESC
WHERE READLIMIT EQ 10;
END
That seems to have done the trick!
I think for most other databases a pretty similar technique could be used.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :