View Full Version : Date related traumas.....
J.Wells
05-24-2002, 05:32 AM
Kate, Check this out: http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/BOOKS/QB3AGZ03/1.1.3.1?SHELF=&DT=19990323173815 "For an interactive job or batch program, the user date special words are set to the value of the job date when the program starts running in the system. The value of the user date special words are not updated during program processing, even if the program runs past midnight or if the job date is changed. Use the TIME operation code to obtain the time and date while the program is running. " HTH, Joe
Guest.Visitor
05-24-2002, 05:55 AM
Yes I read that myself earlier, but hoped I might get away with it.... any ideas on how I can get the current date? Thanks Kate
Guest.Visitor
05-24-2002, 06:06 AM
I'm trying the TIME operation now....
Guest.Visitor
05-24-2002, 06:17 AM
TIME hasn't worked and I've ended up with an empty field in my file again. Any ideas what else I could try? Cheers Kate
J.Wells
05-24-2002, 06:26 AM
Kate, Can you post the snippet of code that used the TIME operation? Joe
Guest.Visitor
05-24-2002, 06:29 AM
TIME hasn't worked and I've ended up with an empty field in my file again. Any ideas what else I could try? Cheers Kate
Guest.Visitor
05-24-2002, 06:36 AM
I was looking at the wrong field *blush*. I'm now re-checking..... Kate
Guest.Visitor
05-26-2002, 02:57 AM
Maybe get the system date and time in the CL program and pass them to the RPG as parms or in a data area in QTEMP? The CL commands would be RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATE) /* returns MM/DD/YY */ RTVSYSVAL SYSVAL(QTIME) RTNVAR(&TIME) /* returns HH:MM:SS */ CHGDTAARA DTAARA(QTEMP/DATETIME (1 16)) VALUE(&DATE *CAT &TIME) The exact format of QDATE depends on system value QDATFMT.
David Abramowitz
05-26-2002, 03:02 AM
Could you post a code snippet concerning how your RPG program is trying access the date? Dave
Guest.Visitor
05-26-2002, 06:07 AM
Every time I see a weird situation in a computer system, it's time to look back up stream and see how we got here. Could you briefly describe the situation, why do you need to check something every minute/hour whatever. What are you looking for and where does that something come from; what generates it, et c. What you are trying to do can be very expensive in terms of computer cycles! It's like trying to time a three minute egg with a one minute 'hour-glass': you have to watch the hour-glass constantly. bobh
B.Morris
05-27-2002, 09:59 AM
Although I suspect the real solution to your problem might be to stop using polling altogether (see Bob Hamilton's subthread), using the TIME opcode should be returning the system date. I assume you need the system date in a numeric form. Try this little program. This assumes you would like the date in numeric yyyymmdd format. You can get other formats by changing the MOVEL operation. D systemDate s d datfmt(*iso) C time systemDate C *iso movel systemDate yyyymmdd 8 0 C yyyymmdd dsply C return Using TIME with a numeric result is awkward. It returns the date in the job format. Unless you have absolute control over the job date format, your program might not always work. It's possible to fix up the numeric result to get it in a predictable format, but it requires a couple of extra moves: d ds d numericRes 12s 0 d numericDate 6s 0 overlay(numericRes:7) D dateTemp s d datfmt(*iso) C time numericRes C *jobrun movel numericDate dateTemp C *iso movel dateTemp yyyymmdd 8 0
bibarnes@yahoo.com
05-30-2002, 10:37 AM
Wouldn't the following work; D Datefld S D inz(*sys) -or- D datetimefld s z inz(*sys) Bill
Guest.Visitor
05-30-2002, 12:37 PM
I once had an application similar to what you are describing. The autostart program performed a Delay Job command to wait 15 minutes. After the delay, it would then submit another job to do the actual process and loop back to the delay again.
Guest.Visitor
05-30-2002, 10:25 PM
I have a CL program that is in its own susbsytem, checking every minute to see if it is time to run again. If it is, a further CL is called, which calls an RPGLE program. This RPGLE needs to use the system date, but it seems that the program status data structure doesn't populate the system date unless I've called the program manually. Is there any way I can get the current date? I'm basically competent in ILE, but haven't done any training in it, I've just picked up things as I've gone along... so any solutions need to be clearly explained, please! Cheers Kate
Guest.Visitor
05-30-2002, 10:25 PM
Initialization in D-Specs works like an initialization in *INZSR. The initialization is made only for the first time your module is called. If you end your module with RETURN, your Datefield wouldn't be updated. Birgitta
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.