Question
· Sep 19

Schedule Setting on Business File Service

Hi,

Is there a way to set the SettingSchedule  on a EnsLib.File.PassthroughService at 9:00 am to 9:30 am but only end of the month? 

Product version: IRIS 2022.1
$ZV: IRIS for UNIX (IBM AIX for System Power System-64) 2022.1.3 (Build 670_1U) Tue Jul 18 2023 14:26:46 EDT [HealthConnect:3.5.0-1.m1] [HealthConnect:3.5.0-1.m1]
Discussion (4)1
Log in or sign up to continue

Hello Warren,

You can use "Schedule Specifications" in production to schedule running your business host. First select your business host(service) and go to additional setting and check "Schedule" option click the magnifier. It opens the "Schedule Spec Editor" and create your schedule ex: "monthend_9to930" and click add action. Then select START and STOP action this action is basically "action:YYYY-MM-DDThh:mm:ss" . Refer the below sample and documentation

START *-*-31T09:00:00
STOP *-*-31T09:30:00

Note: this is suitable only for 31 days of month

The easiest way would be to run on the first day of a month and send results for a previous month.

Another way you can do it is to create a schedule which runs 9:00 am to 9:30 am every day (or 28-31) and checks if this is a last day of a month before doing anything.

Schedule is limited to Max String length, so you can also generate a very long schedule once. For example this code would produce a schedule for the next 10 years:

/// date - start date. Must be the last day of the month.
/// months - how many months to generate
ClassMethod Test(date = "2024-09-30", months = 120)
{
	while $i(months,-1)>=0 {
		set year = $system.SQL.DATEPART("year", date)
		set month = $tr($j($system.SQL.DATEPART("month", date), 2), " ", 0)
		set day = $system.SQL.DATEPART("day", date)
		write $$$FormatText("START:%1-%2-%3T09:00:00,STOP:%1-%2-%3T09:30:00,", year, month, day)
		set date = $system.SQL.DATEADD("day", -1, $system.SQL.DATEADD("month", 1, $system.SQL.DATEADD("day", 1, date)))
	}
}
 
Schedule

If you're okay with February 28th for leap years a schedule can be simplified to 12 entries with * in the year.

If all of the above is not an option create a separate Business Service which runs on a first day of a month, calculates last day of a month and sets a correct schedule for BO.