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



David,

Do you really want to hardcode run-schedule rules (calculation logic) into your application? What happens when a new job requires your job to use a different schedule? Perhaps a service program is warranted...

I can't quite understand how this is supposed to work. Just guessing here, but I suppose there is a BATCH job that runs on a schedule, and the interactive job is simply supposed to display the date and time of the next run. Perhaps users need to know how long they have to post all of their transactions, before the next batch runs...

If this is the case, I agree with the other suggestions to use the job scheduler to manage the batch job, and use the QWCLSCDE API to retrieve the next submission date and time from the schedule entry. I'm sure there is example code for this API out there, so you should be able to put it together quickly.

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/qwclscde.htm

hth,
-Eric DeLong

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Thursday, September 30, 2010 4:34 AM
To: Midrange Systems Technical Discussion
Subject: RE: Get next Tuesday. Or the one after

Thanks all, when I said "I want to know what will be the next planned date of the
job.", I wasn't clear. I meant my program needed to know it. The user currently displays this date on the screen for a client, but the date shown is calculated. It is supposed to represent the next planned date for a particular transaction. Of course, it is only theoretical and the real date is only known by the scheduler. The manager has already gone ahead and entered these dates into a file for access by the program.


-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de
Lennon_s_j@xxxxxxxxxxx
Envoyé : jeudi 30 septembre 2010 02:49
À : midrange-l@xxxxxxxxxxxx
Objet : Re: Get next Tuesday. Or the one after

Don't know if I totally understand your requirements, but you
can easily get the week of the year with SQL:

select week(current date) from sysibm/sysdummy1

"The WEEK function returns an integer between 1 and 54 that
represents the week of the year. The week starts with Sunday,
and January 1 is always in the first week."

But I suspect that this definition of week number may not
suit your requirements.

You can get back a 0 or 1 from an SQL expression like this:

select mod(
(days(date(current date)) -
days(date('2010-01-05'))
)/7
,2)
from sysibm/sysdummy1

and if you combine something like the above with
dayofweek(current date) that might be what you want.

It's not very clear what is going on, so the algorithm might
be better in RPG.

Sam

On 9/29/2010 9:04 AM, David FOXWELL wrote:
Hi all,

I have a 3 jobs J1, J2 and J3 that will run every two weeks
on Tuesday, Wednesday and Thursday respectively.

I want to know what will be the next planned date of the
job. Eg, today is the 29th, J3 will run either tomorrow or
the 6th October.

If I set a reference date as the first Tuesday of this
year, ie, the 5th of January, can I get my job date from any
given date?

I was thinking of setting the 5th of January as week 1, so
to find my date for the next J1, I would calculate the number
of weeks between the 5th of January and today, divide by 2
to see if it's this week or next week and get the next Tuesday.

Am I making any sense? Would SQL or RPG be the best tool?

--
This is the Midrange Systems Technical Discussion
(MIDRANGE-L) mailing list To post a message email:
MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting,
please take a moment to review the archives at
http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.