×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Noooooooooo... here comes that "midnight" thread again! (Rick runs
screaming and flailing his hands to seek refuge in his favorite bathroom
stall!)
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Adam Glauser
Sent: Friday, December 14, 2007 10:28 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: getting system date and system time
JDHorn@xxxxxxxxxxxxxx wrote:
Is there a better way to retrieve the system date and time than
this, or
is this as good as any?
System date, not the job date.
D SYSYMD S 6 0
D SYSTIME S 6 0
/FREE
SYSYMD = %DEC(%SUBST(%CHAR(%TIMESTAMP:*ISO0):3:6):6:0);
SYSTIME = %DEC(%SUBST(%CHAR(%TIMESTAMP:*ISO0):9:6):6:0);
/END-FREE
C SETON LR
Others have show less complicated syntax to get the date and time in
individual operations.
If there's any chance the job in question can run near midnight, it
might be wise to do this instead:
sysDateTime = %timestamp();
sysDate = %date(sysDateTime);
sysTime = %time(sysDateTime);
Suppose that your given code runs at 12:59:59.999999, lets say on
2007-12-14. You have the chance that SYSYMD = d'2007-12-14' and SYSTIME
= '00:00:01'. Of course, this is so unlikely that you may decide to
ignore this possibility, but in some situations it is critical to
consider this.
HTH,
Adam
As an Amazon Associate we earn from qualifying purchases.