A number of new ADS BIFs were added in r17.0 to convert various date and time values between internal and external formats.
These new BIFs are DATEEXT, DATEINT, DISPDT, DATETIMX, DTINT, TIMEEXT, TIMEINT.
The 8-byte internal date-time stamps should be defined in the ADS dialog as a PIC 9(18) USAGE COMP field.
The 64 bits in one of these fields represent a date-time stamp as follows:-
Bits 0 - 26 Number of Days since January 1, 0001
Bits 27 - 43 Number of seconds in this day since midnight
Bits 44 - 63 Number of microseconds since the last second
Note that this means that the entire 8-byte numeric field is not an absolute number of microseconds and therefore it is not possible to perform natural arithmetic on these fields and expect to get a meaningful result. If such arithmetic is performed, and the resulting 8-byte field is treated as an internal date-time stamp, then either a DC175036 abend will occur or the result will be incorrect, depending on the values involved.
Release: All supported releases.
Component: ADS.
Sample ADS code to convert an 8-byte date-time stamp (WS-INTERNAL-DTS) to numbers of days (WS-DAYS), seconds WS-SECS, and microseconds (WS-MS), and then the total number of microseconds (WS-MICROSECONDS) is as follows:-
DIVIDE 1048576 INTO WS-INTERNAL-DTS GIVING WS-MICROSECONDS
REMAINDER WS-MS.
DIVIDE 131072 INTO WS-MICROSECONDS GIVING WS-DAYS
REMAINDER WS-SECS.
COMPUTE WS-MICROSECONDS = ( ( ( WS-DAYS * 86400 ) + WS-SECS )
* 1000000 ) + WS-MS.
For more information about the internal representation of date-time fields, see Representation of Date/Time Values.