For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2007 > mili/micro seconds in Cobol z/os









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mili/micro seconds in Cobol z/os
Janek

2007-07-20, 6:55 pm

Hi

I'm looking for a function (not CICS function, not DB2 function) which
returns time in miliseconds or microseconds.

thanks a lot

Jan


Charles Hottel

2007-07-20, 6:55 pm


"Janek" <neuros@poczta.onet.pl> wrote in message
news:f7qfbe$l69$1@atlantis.news.tpi.pl...
> Hi
>
> I'm looking for a function (not CICS function, not DB2 function) which
> returns time in miliseconds or microseconds.
>
> thanks a lot
>
> Jan
>


You could search comp.lang.cobol for "hottel mainframe timer". Sometime
back there wasa difference of opinion abou the relative performance of
Quicksort and Combsort and I timed a version of each with an assemble
program that I wrote:



> //JOBNAME JOB (ACCT,ROOM),'HOTTEL TASKTIME',MSGCLASS=S,CLASS=K //PROCLIB
> JCLLIB ORDER=USERID.DVL.PROC // SET TITLE1='PFX.TASKTIME' //OUTPUT
> INCLUDE MEMBER=DESTCH
> //*-------------------------------------------------------------------*
> //* ASSEMBLY *
> //*-------------------------------------------------------------------*
> //STEP02 EXEC HLASMCL //ASM.SYSUT2 DD DSN=&&SYSUT2,UNIT=SYSDA, //
> SPACE=(1700,(600,100)) //ASM.SYSPUNCH DD DUMMY //ASM.SYSIN DD * TASKTIME
> TITLE 'GET CPU TIME IN MICROSECONDS SINCE TASK STARTED' TASKTIME AMODE 31
> TASKTIME RMODE ANY TASKTIME START
> *---------------------------------------------------------------------* *
> 01 STARTED PIC S9(18) COMP. * * 01
> ENDED PIC S9(18) COMP. * * 01
> ELAPSED PIC S9(18) COMP. * * 01
> RUNNING-TOTAL PIC S9(18) COMP VALUE ZERO. * *
> * * PERFORM X TIMES *
> * CALL 'TASKTIME' USING STARTED * *
> . . . CODE BEING TIMED * *
> CALL 'TASKTIME' USING ENDED * *
> COMPUTE ELAPSED = ENDED - STARTED * *
> DISPLAY ELAPSED ' CPU MICROSECONDS THIS ITERATION' * *
> ADD ELAPSED TO RUNNING-TOTAL * *
> END-PERFORM * *
> DISPLAY RUNNING-TOTAL ' IS TOTAL CPU FOR ALL ITERATIONS' * *
> * *---------------------------------------------------------------------*
> YREGS TASKTIME CSECT , SAVE (14,12),,TASKTIME.&SYSDATE..&SYSTIME LR
> R12,R15 BASE REG USING TASKTIME,R12 L R5,0(R1)
> POINT TO CALLER'S DBLWORD XR R15,R15 TIMEUSED
> STORADR=(5),LINKAGE=SYSTEM,CPU=MIC RETURN (14,12),RC=(15) END TASKTIME
> //LKED.SYSLMOD DD DSN=USERID.TOOLS.LOAD(TASKTIME),DISP=SHR //LKED.SYSIN
> DD * NAME TASKTIME(R)



The comments at the from show an example of how to call it from a COBOL
program.


Kellie Fitton

2007-07-20, 6:55 pm

On Jul 20, 7:00 am, "Janek" <neu...@poczta.onet.pl> wrote:
> Hi
>
> I'm looking for a function (not CICS function, not DB2 function) which
> returns time in miliseconds or microseconds.
>
> thanks a lot
>
> Jan



Hi,

You can use the following Windows functions to get the system
time with milliseconds precision:

GetTickCount()

GetTickCount64()

timeGetTime()

GetSystemTime()

QueryPerformanceCounter()

QueryPerformanceFrequency()

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

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

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

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

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

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

Kellie.


SkippyPB

2007-07-20, 6:55 pm

On Fri, 20 Jul 2007 16:00:36 +0200, "Janek" <neuros@poczta.onet.pl>
wrote:

>Hi
>
>I'm looking for a function (not CICS function, not DB2 function) which
>returns time in miliseconds or microseconds.
>
>thanks a lot
>
>Jan
>


Can't you use the existing function current-date and calculate mili or
micro seconds from the time yourself?

Regards,
////
(o o)
-oOO--(_)--OOo-


"I wanted to do something nice so I bought my mother-in-law a chair.
Now they won't let me plug it in."
--Henry Youngman
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove nospam to email me.

Steve
Doug Miller

2007-07-20, 6:55 pm

In article <18l1a35p4mgkb1j0clh66clv3c0fpaflgh@4ax.com>, SkippyPB <swiegand@nospam.neo.rr.com> wrote:
>On Fri, 20 Jul 2007 16:00:36 +0200, "Janek" <neuros@poczta.onet.pl>
>wrote:
>Can't you use the existing function current-date and calculate mili or
>micro seconds from the time yourself?


Nope. CURRENT-DATE resolves to hundredths of a second, and no finer.

--
Regards,
Doug Miller (alphag at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Gerry Palmer

2007-07-20, 6:55 pm

On Fri, 20 Jul 2007 16:00:36 +0200, "Janek" <neuros@poczta.onet.pl>
wrote:

>Hi
>
>I'm looking for a function (not CICS function, not DB2 function) which
>returns time in miliseconds or microseconds.
>
>thanks a lot
>
>Jan
>


The LANGUAGE ENVIRONMENT CEELOCT Callable Service returns
the current local date or time in three formats:

-> LILIAN DATE (the number of days since 14 October 1582)
-> LILIAN SECONDS (the number of seconds since 00:00:00
14 October 1582)
-> GREGORIAN character string (format YYYYMMDDHHMISS999)

----------
CALL "CEELOCT" USING WS-CEELOCT-LILIAN,
WS-CEELOCT-SECONDS,
WS-CEELOCT-GREGORIAN,
WS-CEE-FEEDBACK-CODE.
----------

Gregorian string sample:

* GREGORIAN STRING: 20070720185206713


William M. Klein

2007-07-21, 3:55 am

The OP has "COBOL z/os" in the subject so a Windows solution probably will not
work. However, the other answer with an LE callable service will work.

--
Bill Klein
wmklein <at> ix.netcom.com
"Kellie Fitton" <KELLIEFITTON@YAHOO.COM> wrote in message
news:1184946004.321188.6990@k79g2000hse.googlegroups.com...
> On Jul 20, 7:00 am, "Janek" <neu...@poczta.onet.pl> wrote:
>
>
> Hi,
>
> You can use the following Windows functions to get the system
> time with milliseconds precision:
>
> GetTickCount()
>
> GetTickCount64()
>
> timeGetTime()
>
> GetSystemTime()
>
> QueryPerformanceCounter()
>
> QueryPerformanceFrequency()
>
> http://msdn2.microsoft.com/en-us/library/ms724408.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms724411.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms713418.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms724390.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms644904.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms644905.aspx
>
> Kellie.
>
>



HeyBub

2007-07-21, 6:55 pm

Janek wrote:
> Hi
>
> I'm looking for a function (not CICS function, not DB2 function) which
> returns time in miliseconds or microseconds.


Whatever you use, be sure to check the hardware specifications. The CPU
clock may not resolve to microseconds so you'd get two events happening with
a zero time interval.

I don't know your application, but it is often prudent to find the average
time for many operations.


Charles Hottel

2007-07-21, 6:55 pm


"Charles Hottel" <chottel@earthlink.net> wrote in message
news:Un4oi.9048$tj6.2990@newsread4.news.pas.earthlink.net...
>
> "Janek" <neuros@poczta.onet.pl> wrote in message
> news:f7qfbe$l69$1@atlantis.news.tpi.pl...
>
> You could search comp.lang.cobol for "hottel mainframe timer". Sometime
> back there wasa difference of opinion abou the relative performance of
> Quicksort and Combsort and I timed a version of each with an assemble
> program that I wrote:
>
>
>
>
>
> The comments at the from show an example of how to call it from a COBOL
> program.
>


Sorry I think I misunderstood what you are looking for.


Janek

2007-07-23, 7:55 am

Uzytkownik "Gerry Palmer" <gpalmer@pobox.com> napisal w wiadomosci
news:q5g2a3tfpvrrjo98ljtlt3t5iq36rofqff@
4ax.com...
> On Fri, 20 Jul 2007 16:00:36 +0200, "Janek" <neuros@poczta.onet.pl>
> wrote:
>
>
> The LANGUAGE ENVIRONMENT CEELOCT Callable Service returns
> the current local date or time in three formats:
>
> -> LILIAN DATE (the number of days since 14 October 1582)
> -> LILIAN SECONDS (the number of seconds since 00:00:00
> 14 October 1582)
> -> GREGORIAN character string (format YYYYMMDDHHMISS999)
>
> ----------
> CALL "CEELOCT" USING WS-CEELOCT-LILIAN,
> WS-CEELOCT-SECONDS,
> WS-CEELOCT-GREGORIAN,
> WS-CEE-FEEDBACK-CODE.
> ----------
>
> Gregorian string sample:
>
> * GREGORIAN STRING: 20070720185206713
>
>

BIG THANKS!!!
It is what I'm looking for.

Jan



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com