Attached to this document is a Microsoft Excel spreadsheet called TimestampCalculationTest.xlsx. There is a procedure outlined to use this spreadsheet to validate the duration difference produced in the CA Datacom SQL query. There are several steps involved in using this:
- After running the DBSQLPR query to produce a report of the two timestamp fields and the two Elapsed Time fields (if desired), save the output to a file and remove everything except the data records. Alternatively, you might want to enter or cut/paste your entries into this or another spreadsheet. If manually entering into this sheet, adjust the format of the cells if needed and copy the formula from columns H through M to your rows to see the results, otherwise, continue with step 2.
- Transfer the file to the PC as a .txt file, and then open the file using Microsoft Excel. You may need to specify the date fields in their proper format (YMD, for example) and you may need to drop unneeded fields. When complete, your file should be open in Excel with 6 columns like these below.
- Once your data is formatted like this example, you can copy the cells H7:M7 to the same columns on your opened spreadsheet. Paste these copied cells to cover the whole range of rows.
- Copy cells J6:K6 to the top row of your spreadsheet, in the columns where the SQL Match Excel? results are found. These cells will count the number of times the SQL calculation did not match the Microsoft Excel calculation, so you can review them further. To find the mismatched cell(s), find "False" in the values for that column.
This spreadsheet uses formulas to calculate the duration between two dates in the format of number of days, hours, minutes and seconds and also years, months, days, hours, minutes and seconds. These formulas are based on the calculation algorithm concepts found in CA Datacom SQL, and take advantage of Microsoft Excel functions where possible. Two of the functions used - EOMONTH and EDATE - are part of the Analysis ToolPak add-in, which must be installed and loaded into Microsoft Excel 2003 and 2007, and are part of the base package for 2010 and above.