ca.portal.admin

Arithmetic on FORMAT=(DTS) date from #GETIME

Discussion created by ca.portal.admin on Jul 8, 2010
#GETIME FORMAT=(DTS) returns a 64 bit date/time stamp (same as the SQL date/time stamp) in registers 0 and 1. Does anybody know if you can perform arithmetic on, for example, successive values of a FORMAT=(DTS) date/time stamp.

In this instance all I am after is differences, often measured in nanoseconds and rarely across minutes, between two times.

If I can get the time difference by simply getting successive values of FORMAT=(DTS) and subtracting - then all is beautiful - I could use IDMSIN01 to give me DISPLAY values of the resultant time difference.

The main reason for asking is that this solves all of the problems with first time in one day (or year) and the second time being in another day (or year). It also means I don't have to write my own formatting in assembler - but that's been done before 8-)

TIA - cheers - Gary

Gary Cherlet
Justice Technology Services
Department of Justice, SA Government

"""""""" Telephone +61 (0)8 8226 5199
@@ Facsimile +61 (0)8 8226 5311
> Mobile +61 (0)41 333 1613
~~ MailTo:gary.cherlet@sa.gov.au


Gary says: Grab them by their data - and their hearts and minds will follow!

This e-mail message and any attachments are qualified as follows: Addressing: If you have received this e-mail in error, please advise by reply e-mail to the sender. Please also destroy the original transmission and its contents. Confidentiality: This e-mail may contain confidential information which also may be legally privileged. Only the intended recipient(s) may access, use, distribute or copy this e-mail. Individual Views: Unless otherwise indicated, the views expressed are those of the sender, not Justice Technology Services. Computer Viruses: It is the recipient's responsibility to check the e-mail and any attached files for viruses.
***************************************************************************************
The information contained in this message, including attachments, may contain
privileged or confidential information that is intended to be delivered only to the
person identified above. If you are not the intended recipient, or the person
responsible for delivering this message to the intended recipient, Windstream requests
that you immediately notify the sender and asks that you do not read the message or its
attachments, and that you delete them without copying or sending them to anyone else.
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP








Normal

Normal
Re: Arithmetic on FORMAT=(DTS) date from #GETIME
"if you look in your SYSDIRL dictionary or in distsrc? you will find some
sreports - within those SREPORTS are at least 2 SQL Date conversion
routines that might get you closer to what you want - and ... they are
already written for you



Chris Hoelscher
IDMS/DB2 System & Database Architect
Humana Inc
502-476-2538
choelscher@humana.com

you only need to test the programs that you want to work correctly





The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information.
"
IDMS 3rd-party providers forum
IDMSVENDOR-L@LISTSERV.IUASSN.COM
SMTP
IDMSVENDOR-L@LISTSERV.IUASSN.COM
IDMSVENDOR-L@LISTSERV.IUASSN.COM
SMTP








Normal

Normal
Re: [IDMSVENDOR-L] Arithmetic on FORMAT=(DTS) date from #GETIME
"if you look in your SYSDIRL dictionary or in distsrc? you will find some
sreports - within those SREPORTS are at least 2 SQL Date conversion
routines that might get you closer to what you want - and ... they are
already written for you



Chris Hoelscher
IDMS/DB2 System & Database Architect
Humana Inc
502-476-2538
choelscher@humana.com

you only need to test the programs that you want to work correctly





The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information.
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP








Normal

Normal
Re: Arithmetic on FORMAT=(DTS) date from #GETIME
"Gary,

Do you have the luxury of being allowed to use assembler? If so, consider
writing a routine that simply does a Store Clock instruction into a 64 bit
area supplied by the caller:

GETSTCK CSECT
L 15,0(,1) Get Parm 1
STCK 0(15) Store System Time
NI 0(15),X'7F' Avoid Sign Issues
BR 14 Return To Caller

01 CLOCK-TIMES.
05 CLOCK1.
10 CLOCK1N PIC S9(18) COMP.
05 CLOCK2.
10 CLOCK2N PIC S9(18) COMP.
05 CLOCKDELTA PIC S9(18) COMP.
05 ELAPSEDMICS PIC S9(08) COMP.

CALL ""GETSTCK"" USING CLOCK1.
...Do What Ever...
CALL ""GETSTCK"" USING CLOCK2.
CLOCKDELTA = CLOCK2 - CLOCK1.
ELAPSEDMICS = CLOCKDELTA / 4096.

The routine stores the system's clock comparator value in the 64 bit field
passed by the caller and then eliminates the high order bit. The reason the
high order bit is eliminated is to avoid sign issues in the math. The
removal of the bit makes the result of the STCK unusable as a time of day
value, but the significance remains so that it can be used to determine the
amount of elapsed time, in machine timer units, that has transpired between
2 STCK values. Since the duration of the clock comparator is 140+ years, I
suspect that removing the high order bit will not be an issue.

Once you have 2 STCK values, you can take the difference between the 2 and
you will have the elapsed time.

Converting the time is now a matter of accuracy. If microseconds is
sufficient, then divide the difference by 4096 and you will have the number
of microseconds that has elapsed between the 2 STCK values.

Refer to the Principle of Operations for more information on the STCK
instruction.

Chuck

Outcomes