Contro-M z/OS: Save "Why screen" for each job waiting execution in Control-M - mainframe

In Control-M, is there a way to get the job names(s) waiting to execute and the reasons for waiting (Time, conditions, resources)? This info is in the "Why screen".
I've only managed to get the AJF job status but I'd like to go further.

Putting a question mark beside the job will show the list of conditions it is waiting on. If you want to bypass any of the conditions, put an "A" beside the condition you want to bypass and confirm.

Quote from your own comment below the previous answer (slightly edited):
... use the KSL REPJOBMO. It gives a dataset with all the jobs in 'wait schedule' status and the reason why.

Related

Activity Diagram Timed Event

I'm trying to model the following: When filling out a submission form, the system automatically saves the users progress every 5 minutes.
This is what I tried, but I don't think it's correct.
In my case the condition is asked only after the "fill submission" activity is finished. Also I don't want to indicate, that the user is starting the "fill submission" activity again.
You would use an interruptible region represented by a dashed line box:
The timer interrupt appears independently and intrerrupts the current action. Auto save is executed and comes back with Fill form. Resuming Fill form need a bit of thought since usually you have some entry code which must not be executed in case of a continuation. That might be a bit more tricky as you would likely need a mutex for that.
UML 2.5 has a detailed description in chap. 15.6.3.2 Interruptible Activity Regions on pp. 405.
Just a word about your approach. The save is only executed when the form is closed. So if it takes longer than 5 minutes you end up in your form again which is likely not desired :-)

whether to use job scheduler or sleep() function

I am confused whether to use cron job scheduler or use sleep function in the program itself. There are questions on this previously but I seem to have some different requirements form them.
I need some information from the previous run of the program so if I use cron to schedule
job I would have to store that information at some place and re-read it next time(this can make the program less scale-able if the size of this information grows).
I can also use sleep() but that will be using resources.
I will need to re-run the program every 10 mins or so. Which one is better to use.
Is there any other nice way of doing it which I may be missing.
In general you should use cron whenever you can for something like this.
The only problem I could foresee is if your program somehow took longer than 10 minutes to run, cron is going to call the next execution 10 minutes later anyway. This creates a really long race condition basically, where if you did sleep it would only start sleeping after the previous execution ended.
But assuming your program will take less time to run, I say go with cron.

How to complete SharePoint 2010 state machine workflow when all tasks completed?

I am new to SharePoint. Sorry if answer to my questions is obvious.
First question: I have state machine workflow which creates about 30 tasks (some of them creates after previous completed using OnTaskChnage activity). I have to log tasks changes and complete workflow when all tasks completed. I see 2 ways to do it:
1) I can create eventDrivenActivity for every of 30 tasks.
OnTaskChanged
--Code (log changes)
--If (allTaskCompleted()) //not code, but activity, what use
----then SetState(Completed); //condition allTaskComplete() from code
But I think it is not good way because of I can't reuse code and do 30 same steps.
2) I can do loging in code and then if need, complete workflow from code, but I don't know how can I do it. I can cancel workflow from the code
SPWorkflowManager.CancelWorkflow(itemWorkflow);
but I can't find any information, how to complete it (or setState to "Completed"). May be I am doing something wrong and workflow have to complete itself then all tasks completed, but it does not happen (It stays in "In progress").
Second question: Is there any possibility to run some code after every change in workflow tasks (as far as I understood, OnWorkflowChanged and OnWorkflowModified not suitable for my needs), or to add programmatically handler to my 30 tasks (not to Tasks list at all, but only for my tasks)?
Thank you in advance.
Best regards
Mikhail.
PS: sorry for my writing. English is not my native language.

How to define frequency of a job in application by users?

I have an application that has to launch jobs repeatingly. But (yes, that would have been to easy without a but...) I would like users to define their backup frequency in application.
In worst case, they would have to choose between :
weekly,
daily,
every 12 hours,
every 6 hours,
hourly
In best case, they should be able to use crontab expressions (see documentation for example)
How to do this? Do I launch a job every minutes that check for last execution time, frequency and then launches another job if needed? Do I create a sort of queue that will be executed by a masterjob?
Any clues, ideas, opinions, best pratices, experiences are welcome!
EDIT : Solved this problem using Akka scheduler. Ok, this is a technical solution not a design answer but still everything works great.
Each user defined repetition is an actor that send messages every period to a new actor to execute the actual job.
There may be two ways to do this depending on your requirements/architecture:
If you can only use Play:
The user creates the job and the frequency it will run (crontab, whatever).
On saving the job, you calculate the first time it will have to be run. You then add an entry to a table JOBS with the execution time, job id, and any other information required. This is required as Play is stateless and information must be stored in the DB for later retrieval.
You have a job that queries the table for entries whose execution date is less than now. Retrieves the first, runs it, removes it from the table and adds a new entry for next execution. You should keep some execution counter so if a task fails (which means the entry is not removed from DB) it won't block execution of the other tasks by the job trying again and again.
The frequency of this job is set to run every second. That way while there is information in the table, you should execute the request around as often as they are required. As Play won't spawn a new job while the current one is working if you have enough tasks this one job will serve all. If not, it will be killed at some point and restored when required.
Of course, the crons of the users will not be too precise, as you have to account for you own cron delays plus execution delays on all the tasks in queue, which will be run sequentially. Not the best approach, unless you somehow disallow crons which run every second or more often than every minute (to be safe). Doing a check on execution time of the crons to kill them if they are over a certain amount of time would be a good idea.
If you can use more than Play:
The better alternative I believe is to use Quartz (see this) to create a future execution when the user creates the job, and reproram it once the execution is over.
There was a discussion on google-groups about it. As far as I remember you must define a job which start every 6 hours and check which backups must be done. So you must remember when the last backup job was finished and make the control yourself. I'm unsure if Quartz can handle such a requirement.
I looked in the source-code (always a good source ;-)) and found a method every, where I think this should be do what you want. How ever I'm unsure if this is a clever design, because if you have 1000 user you will have then 1000 Jobs. I'm unsure if Play was build to handle such a large number of jobs.
[Update] For cron-expressions you should have a look into JobPlugin.scheduleForCRON()
There are several ways to solve this.
If you don't have a really huge load of jobs, I'd just persist them to a table using the required flexibility. Then check all of them every hour (or the lowest interval you support) and run those eligible. Simple.
Or, if you prefer to use cron syntax anyway, just write (export) jobs to a user crontab using a wrapper which calls back to your running app, or starts the job in a standalone process if that's possible.

Show progress while a method is runing in windows application

i have an application in c# windows forms (fw4.0) and i have a method that creates a json string and send via post to an action method in a web page. I don't know how much it takes, but i want to show a progress bar while the method is executing. How can i do it?
One idea i have is to perform a counter while the method is running and show it to the user, but i don't know how.. it must be in another thread? how?
I dont have any more helpful information to provide.. i hope you can help me!
Thanks!
Use the background worker to prevent blocking the UI and to report progress.
You can report progress based on two values:
prob_time -- the most probable amount of time the action will take to complete;
max_time -- the maximum amount of time you are willing to wait before considering that the action failed;
You can make the progress bar get to a certain point(e.g. 80%) in prob_time, then to 100% in (max_time-prob_time).
If the action completes faster that max_time, you make the progress jump to 100% and report "Success", otherwise report "Failure"
Finally i did!
I have to use 2 background workers.. this is what i did..
backgroundWorker1: performs the post method.
backgroundWorker2: performs a TimeSpan counter.
when backgroundWorker2 starts, sets a TimeSpan in 0 and in the DoWork, if the backgroundWorker1 CancellationPending is false, then i report progress in backgroundWorker2.
When the post method finish, i set backgroundWorker1 to CancelAsync, so the backgroundWorker2 will terminate to.
I think that was my best solution.

Resources