..."Please provide your comments"...

Just for fun I threw together a test case of SQL current timestamp vs
QWCCVTDT (*YYMD, 20-byte receiver). Both were accessing microseconds and
the loop for each was 1,000,000 iterations. The API "won" every time
though not by a whole lot. The percentage longer using the SQL route was
13%, 7%, and 7% over the API approach.

Note all the typical disclaimers of the system not being dedicated, etc.
I'll also add that the *very first time* I ran the SQL part of the program
it took substantially longer and so I did not include that very first run
in the above timings. The percentages are based on subsequent runs of the
program.

On Sat, Dec 7, 2019 at 8:28 AM Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:

%Timestamp() will only return the first 3 numbers of the microsecond part,
the remaining positions are padded with *Zeros (even if you define your
timestamp field as Timestamp(12).
If you need a more exact timestamp you need to use the SQL specific
register
(as you already did)

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
„Train people well enough so they can leave, treat them well enough so they
don't want to.“ (Richard Branson)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Javier
Sánchez
Sent: Samstag, 7. Dezember 2019 02:15
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: %TIMESTAMP renders only milliseconds?

Hi there!

Sorry for asking if there is already something around on this. Is the
%TIMESTAMP built-in function already able to render microseconds
granularity?

Of course most of you know, %TIMESTAMP returns three trailing zeros after
the timestamp's last period.

I had solved this inconvenient with instructions calling DB2 like:

EXEC SQL SET :myTimeStamp = CURRENT_TIMESTAMP;

For what I have seen, it looks like calling DB2 could be more expensive to
call the QWCCVTDT API to get an expression of the system's clock timestamp
which includes microsecond granularity instead of milliseconds.

Please provide your comments.

Thank you.

JS.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.