hello world
My batch runs everyday at 00:00 and prints a report, put some of the data into a table.
Now I am requested to change it to run monthly, not everyday.
How can I change the following to do the same but not every midnight, but one midnight monthly. If possible I'd like it to run on a certain date for each and every month for consistency reasons. e.g. batch runs on the 28th of every month at 00:00 and print the report.
public void PurchTabletoBatchTable()
{
PurchReqTable PurchReq;
Axn_PurchCommitmentAccTable purchCommitmentAccTable;
date Tday;
utcDateTime utcTday, utcFromDate, utcToDate;
int timeOfday;
createdDateTime PurchReqcreatedDateTime;
;
Tday = today(); //get today
timeOfday = str2Time("00:00"); //prepare time
utcFromDate = datetimeutil::newDateTime(Tday,timeOfday); //convert to utcDateTym
ttsbegin;
while select PurchReq where PurchReq.status == PurchReqStatus::PendingApproval && PurchReq.createdDateTime >= utcFromDate &&
PurchReq.createdDateTime < utcToDate
{
purchCommitmentAccTable.PurchReqId = PurchReq.PurchReqId;
purchCommitmentAccTable.Status = PurchReq.Status;
purchCommitmentAccTable.Requisitioner = PurchReq.Requisitioner;
purchCommitmentAccTable.PurchReqcreatedDateTime = PurchReq.createdDateTime;
purchCommitmentAccTable.insert();
}
ttscommit;
}
Please help a girl out.
Thanks
Sinoyolo