Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Job Date

Status
Not open for further replies.

Fooch

Programmer
Dec 19, 2005
63
0
0
US
Is there a BIF or something that will allow me to pull the Job Date? The reason I ask is because I am working on a program that is in a job scheduler and when it is run it is supposed to run a report for the current date, but sometimes the program runs over midnight because it queries the date. So I need to use the Job Date and not the System Date. Is there any simple way to do this in an RPG program, a CL is not possible.
 
Fooch,

Try:

Code:
NewDate = %DATE( *DATE );

HTH,
MdnghtPgmr
 
Wouldn't that be the system date? I need the date associated with the start of the Job.
 
D JobDate s d inz( *job )

But if the job starts over midnight you won't get the date as expected. So your best bet is to pass the required date as a parameter to the edit program.
 
There is a job called Daily that runs a job scheduler...so you are saying the only way for a program in the job scheduler to get the job date of "daily" would be to INZ a date field as *JOB and pass that parm into the job scheduler?
 
No.
FYI I've just shown how to get the job date in a variable in a RPG IV program because that was your primary question.

Then I mean to say not use this job date and pass the required date as a parameter to the edit program instead. F.E. the date could be put in a data area and the edit program would pull this date from the data area when needed.
Note. The job date isn't the scheduled date but the date the job starts running.
 
If I recall correctly you want to use UDATE, or UMONTH, UDAY, UYEAR. Those fields contain the date the job was submitted. Check the RPG manual to verify, but I'm pretty sure that is correct.



T. Bishop
 
That is correct. UDATE will retrieve the job date. If you need a date field NewDate = %date(UDATE) should do it for you.
 
What's the value of UDATE if the job starts running over midnight ?
This is what I read in the ILE RPG Reference RedBook :
The user date special words (UDATE, *DATE, UMONTH, *MONTH, UDAY, *DAY,
UYEAR, *YEAR) allow the programmer to supply a date for the program at run
time.

and further
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.
 
UDATE does not change at midnight when the system date changes and the job is still running. That's why anything we do that requires the date in RPG uses %DATE() or the equivalent to get the current system date. Otherwise, dates in history created after midnight in a job that started at 11:30 PM would have the wrong date. All of this depends on your business rules, of course. But since we always have the user supply a transaction date we never, ever have used UDATE for anything since this application was written in 1994.

Tibi gratias agimus quod nihil fumas.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top