How do I modify the value returned from current(time)
10 pts.
0
Q:
How do I modify the value returned from current(time)
I have an AS/400 query that requires me to search records with a timestamp from 20 mins prior to the current system time. If I use the current(time) value in the query, how do I modify it to return a time 20 minutes earlier?
ASKED: Jan 21 2009  10:41 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
840 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
I think you can substring the minute part of the timestamp ie MM in HHMMSS and minus 20 from it then build the timestamp again.You may have to change the MM part to *dec from *char.
Last Answered: Jan 21 2009  1:17 PM GMT by Anderson123   840 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Yorkshireman   3200 pts.  |   Jan 22 2009  9:09AM GMT

Qry now understands data types for date, time and timestamps, so you can extract the parts of the timestamp, create a result which is ‘MINUTES(field) -20′ and then recreate the timestamp data type to enable a ‘Less than’ compare.
If you use the F1=help key in the select records panel all is made (almost) clear. You will have to be aware that a simple arithmetic subtract of 20 from, say a field value of 15 minutes will give -5. Reconstituting a timesatmp with invalid data isn’t allowed.

Alternatively, convert the query to query manager, then use SQL.
STRQM, and follow the command keys will soon get you there if you’re not familiar with it.

 
0