How can I prevent a CA7 job with two schedule IDs from conflicting when they run on the same day? - websphere

I have a single job with two schedule ID’s. One runs the job the last day of the month and the other schid runs the last Sunday of the month. The problem I’m trying to correct arises when the last day of the month falls on a Sunday which causes a conflict between the two schedules.
My first thought was to split the two schids into two separate job names, while making one job a requirement for the other so they can’t run at the same time. The problem is this scenario would only apply on the rare days they both run and on all other days the requirement wouldn’t be met.
I’m not extremely familiar with ca7 so thought I’d look for some input. Can a schid be created with a conditional statement?

I think two schids will be needed. The options assume a calendar that specifies all days as processing days.
Option 1
Schid=1 schedules the job on the last Sunday of the month UNLESS that Sunday falls on the last day of the month.
Schid=2 schedules the job on the last day of the month.
ID=001 ROLL=N INDEX=+000
SCAL= DOTM=2000 LEADTM=0010 STARTM=1950
MONTHLY DAY=SUN WEEK=-00 MONTH=ALL
MONTHLY NRDAY=-00 MONTH=ALL
ID=002 ROLL=N INDEX=+000
SCAL= DOTM=2000 LEADTM=0010 STARTM=1950
MONTHLY RDAY=-00 MONTH=ALL
Option 2
Schid=1 runs the last day of the month unless that day falls on a Sunday.
Schid=2 runs on the last Sunday of the month.
ID=001 ROLL=D INDEX=+000
SCAL= DOTM=1300 LEADTM=0030 STARTM=1230
MONTHLY NDAY=SUN WEEK=-00 MONTH=ALL
MONTHLY RDAY=-00 MONTH=ALL
ID=002 ROLL=D INDEX=+000
SCAL= DOTM=1300 LEADTM=0030 STARTM=1230
MONTHLY DAY=SUN WEEK=-00 MONTH=ALL
Another approach is to define a separate calendar with precisely the days I want the job to run so the schedule definition is pretty simple.

Related

How to set Slack reminder for last day of every month?

I need to complete timesheet of work until midnight of every last day of month. Since it's easy to forget, I want to set reminder on say 1PM of the last day. What's the correct syntax to configure it?
All my attempts either don't work or are clumsy:
/remind me "Complete timesheet!!!" at 13:00 on the last day of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" at 13:00 on the 31st of every month - works for 31-day-long months, ignores for shorter months
/remind me "Complete timesheet!!!" at 13:00 on the 30st of every month - (I guess) works every month except February, for 30-day-long months one can manually snooze by day
/remind me "Complete timesheet!!!" at -11:00 on the 1st of every month - sets 1st instead and does not completely understand
/remind me "Complete timesheet!!!" 11 hours before 1st day of every month - sets 1st instead and does not completely understand
12x copy of /remind me "Complete timesheet!!!" at 13:00 every November 30th for literally mentioned last day of every month - works but too lengthy
I will also accept answer with link to any documentation with formalized syntax of /remind command (BNF, railroad diagram) from which the possibility of such command would be either provable or disprovable.

How can i set Scheduler of Ibm on the first Monday of the week?

How can i set Scheduler of Ibm on the first Monday of the week? If i set DayOfMonth 1-7 and DayOfTheWeek 2 together receive an error. Is not good simbol as 2#1
The error is consistent with the documentation
https://www.ibm.com/docs/en/was-zos/8.5.5?topic=SS7K4U_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/scheduler/UserCalendar.html
which states, "The day of week and day of month terms cannot be specified at the same time. One must be a '?' and the other a term."
Regarding your question, you asked about the "first Monday of the week". Did you mean first Monday of the month?
Here is an example of Monday of every week at 8am:
0 0 8 ? * MON
where the Scheduler cron terms are
second minute hourOfDay DayOfMonth Month DayOfWeek
If you want only the first Monday of the month, the Scheduler CRON doesn't have a way to do it.
An easy, but inefficient, solution would be to use the syntax for every Monday and have your task logic return immediately and skip itself if not a first Monday.
You also have the option of supplying your own UserCalendar implementation to implement customized scheduling:
https://www.ibm.com/docs/api/v1/content/SS7K4U_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/scheduler/TaskInfo.html#setUserCalendar(java.lang.String,%20java.lang.String)

Quick way to group timestamps by order of week

All:
I wonder if there is easy way to group timestamp by order of week, for example:
A month usually has 5 or 4 weeks, once given a timestamp( something like UTC time 1483465353929 which is 1/3/2017 that should be put into 1st week group, say we use the first Monday of a month as the starting of the first week of that month, and if the timestamp is early than the first Monday like 1/1/2017, it should be put into previous month's last week group which is 5th week) How can I quickly identify its week order? Any implementation will be appreciated
Thanks

Get Week Number of the year with custom day as starting day of the week

I want to use Date.WeekOfYear() Function to get Week Number for datetime values, but with a custom day as the start of the week (Let's say Saturday rather than Sunday). How is it possible in PowerQuery M?
You could use a conditional statement like this (adding 1 to the weeknumber if the day is saturday):
if Date.DayOfWeek([Date])=5 then Date.WeekOfYear([Date])+1 else Date.WeekOfYear([Date])

how to schedule to run a shell script on a particular day of a month

I want to schedule to run a shell script on a Thursday which comes after the second Tuesday of every month. How to schedule this in crontab?
The second Tuesday of the month will occur between the 8th and the 14th inclusive, so set the day-of-week field to 4 (Thursday), and the day-of-month field to 10-16 (that is, a range adjusted to be two days after the range of the month's second Tuesday).

Resources