I’ve made another batch-job that - while running on batch server - should fix the run times of other batch-jobs. It works while running it manually, though it doesn’t run correctly on batch server (somehow - I have no idea why - it doesn’t execute itself, the batch server just ignores this job, doesn’t change it’s batch.starttime value as it normally should and there’s no sign of influence on other batch jobs). Any idea why? Here’s the source for the run() method, ran by main(), no other modifications attached.
public void run()
{
Batch batch;
int tempTime;
int interval;
Transdate tempDate;
container recurrenceDataChanged;
;
super();
ttsbegin;
while select forupdate batch
where batch.ClassNum != classNum(MPBatchDateTimeCorrection) &&
batch.Status == BatchStatus::Waiting
{
tempTime = batch.OrigStartTime;
tempDate = batch.OrigStartDate;
recurrenceDataChanged = [conpeek(batch.recurrenceData, 1),
batch.OrigStartTime,
batch.OrigStartDate,
conpeek(batch.recurrenceData, 4),
conpeek(batch.recurrenceData, 5),
conpeek(batch.recurrenceData, 6),
conpeek(batch.recurrenceData, 7),
conpeek(batch.recurrenceData, 8)];
while (tempDate < SystemDateGet())
{
[tempDate, tempTime] = SysRecurrence::next(recurrenceDataChanged, tempDate, tempTime);
}
if (tempTime < timeNow())
{
while (tempTime <= timeNow() && tempDate == SystemDateGet())
{
[tempDate, tempTime] = SysRecurrence::next(recurrenceDataChanged, tempDate, tempTime);
}
}
recurrenceDataChanged = [conpeek(batch.recurrenceData, 1),
tempTime,
tempDate,
conpeek(batch.recurrenceData, 4),
conpeek(batch.recurrenceData, 5),
conpeek(batch.recurrenceData, 6),
conpeek(batch.recurrenceData, 7),
conpeek(batch.recurrenceData, 8)];
batch.recurrenceData = recurrenceDataChanged;
batch.StartTime = tempTime;
batch.StartDate = tempDate;
batch.update();
}
ttscommit;
}