Skip to main content

Problem:

The time returned from an ACCEPT statment is only accurate to the hundredth of a second, is there a way to retrieve the time to milliseconds.

Resolution:

There  is a demo out on the supportline website that uses the win api GetSystemTime which returns time to milliseconds. The sample is called gst.zip and can be downloaded from

http://supportline.microfocus.com/examplesandutilities/nesamp.asp#Win32API

There is another win api function that can be used called GetSystemTimeAsFileTime which returns the time in 100 nanosecond increments.  This function returns the time in a FILETIME structure which can be declared in COBOL as:

01  FILETIME.

      05  lowOrderDateTime   pic x(4)  comp-5.

      05  highOrderDateTime  pic x(4)  comp-5.

01  redefines FILETIME.

      05  NanoSeconds          pic x(8)  comp-5.

So the returned value can be accessed as two 32-bit values or as one 64-bit value.

Documentation for these win api's can be found here

http://msdn2.microsoft.com/en-us/library/ms713418.aspx

Old KB# 1432