× 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.



Ah - that makes much more sense to me. I'm sorry if I was being dense.

Well, to be honest, the way you are doing it isn't bad. But you could easily do 
that in SQL. Assuming you want to start with the current month, whatever it may 
be, here is a rough outline of how you can go about it. (Note that I am writing 
this on the fly and not testing it, so please excuse any typos or other obvious 
errors. Also, I am not sure what is and what is not available on your version 
of i5OS, so take this with a grain of salt...)

* get the current date, time, or timestamp. You can embed these into your own 
selects.
SELECT current date FROM sysibm.sysdummy1
SELECT current time FROM sysibm.sysdummy1
SELECT current timestamp FROM sysibm.sysdummy1

*then get the parts you are interested in - in your case the month I think.
YEAR (current timestamp) ... You will need the sysibm.sysdummy1 to select from, 
or there is a way to
 use the VALUES statement to get at the DB2 special registers as well.
        Just assume that all the rest of these examples require the correct
        select or VALUES syntax as well.
MONTH (current timestamp)
DAY (current timestmap)
HOUR (current timestmap)
MINUTE (current timestamp)
SECOND (current timestamp)
MICROSECOND (current timestamp)


*you can also get the date and time out of a timestamp if you want to
DATE (current timestamp)
TIME (current timestamp)

*now you can manipulate those dates around a bit
MONTH(current date - 24 MONTHS)

*okay, a real example of that:
 select monthname(current date - 1 month) from sysibm.sysdummy1 returns 
'November'.


What I would suggest is to go ahead and use these kinds of functions to write 
yourself
a soptred procedure that returns the table of values you want to you, writing 
the table out.
(Be sure to DROP the existing table first... : )

Hope that helps a little bit. I'll be glad to help more when I have a little 
free time.

-Paul








As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.