Hi Han,
We have had similar situations to deal with and have looked at different solutions. I describe simply, two of these below for you....
1. Set a rule in the first UBE that it will wait until 10.00pm and then will launch the next jobs at that time. The potential problem here is the queue will have an open job on it all of the day and this may be no good in your environment. We used this for a job that must launch UBEs regularly through out the day but based on other actions going on around the system.
2. The second option, which I think will work for you, is to use the OW Scheduler and create a scheduled job for the second (third, fourth etc) UBE. Set this up as inactive and to run at 10.01pm once only on the appropriate server, queue etc. In the first UBE, when it is happy to launch the second UBE you issue an update to the scheduler master file setting the active status to 01 and setting the date and for the next run to the current date for your job. You must then call the scheuling routine to force the job to become scheduled to run. At 10.01pm the scheduler will launch your job. In your second UBE, when it first launches, update the scheduled job table again setting the status back to inactive and again running the scheduler routine to stop the job being scheduled anymore.
I think this option will work well for you as you then have the control in your scheduler but the user can run their job at any time. We have used this before and it works well for us.
A sample of the bit of code is shown below:
...
0011 VA rpt_VA_StartTime = "220000"
...
0016 //
0017 // Convert Start Time to Scheduler format
0018 //
0019 Get UTC Time
VA rpt_VA_SchedulerStartTime <- mnUTCTime
SL DateToday -> jdDate
VA rpt_VA_StartTime -> mnTime
"L" -> cUTC_Local
UNDEFINED -> szTimeZone
UNDEFINED -> cDaylightSavings
UNDEFINED -> szDaylightSavingsRuleName
...
0021 Get Audit Information
VA rpt_UserId <- szUserName
VA rpt_UpdatedDate <- jdDate
VA rpt_TimeOfDay <- mnTime
VA rpt_Machine <- szWorkstation_UserId
0022 VA rpt_ProgramId = "************"
0023 If BC Scheduled End ANSI C UTC Time (F91300) is not equal to <Zero>
0024 F91300.Update
BC Scheduled Job Name = TK Scheduled Job Name
VA rpt_VA_SchedulerStartTime -> TK Scheduled Start ANSI C UTC Time
VA rpt_VA_SchedulerEndTime -> TK Scheduled End ANSI C UTC Time
VA rpt_UserId -> TK User ID
VA rpt_ProgramId -> TK Program ID
VA rpt_Machine -> TK Work Station ID
VA rpt_UpdatedDate -> TK Date Updated
VA rpt_TimeOfDay -> TK Time - Last Updated
...
0029 //
0030 // Add schedule entries to scheduler for changes made
0031 //
0032 Determine and add F91320 Records for Job
BC Scheduled Job Name -> szScheduledJobName
VA rpt_VA_SchedulerStartTime -> mnSchedulerStartTime
BC Recurrenc Type -> szRecurrenceType
BC Time Zone List -> szTimeZones
BC Adjust local time for daylight savings -> cDaylightSavings
BC Scheduled Minutes -> mnScheduledMinutes
BC Scheduled Hours -> mnScheduledHours
BC Scheduled Days -> mnScheduleDays
BC Scheduled Weeks -> mnScheduledWeeks
BC Scheduled Month -> mnScheduledMonth
BC Day -> cScheduledDay
BC Weekday -> cWeekday
BC Weekend -> cWeekend
BC Monday -> cMonday
BC Tuesday -> cTuesday
BC Wednesday -> cWednesday
BC Thursday -> cThursday
BC Friday -> cFriday
BC Saturday -> cSaturday
BC Sunday -> cSunday
BC Company -> szCompany
BC Number Of Job Occurences -> mnMaxScheduledRecords
VA rpt_VA_SchedulerEndTime -> mnSchedulerEndTime
BC Daylight Savings Rule Name -> szDaylightSavingsRuleName
0039 End If
...
Andrew