× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Dieter, Tim and Rob
Informative, amusing and insightful - I'll carefully read and see how I can apply to my project.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of D*B
Sent: Thursday, November 20, 2014 2:03 AM
To: Midrange Systems Technical Discussion
Subject: RE: Is job x running

... for a data warehouse load process, we've needed multiple conditions, what could run together. We wrote a SRVPGM (not too complcated) with following procedures

getMutex(name, wait){
if syncobj with name not exists create
try to lock the syncobj with specified wait if not possible in time throw exception (send escape message via QMHSNDPM store locks in some array }

releaseAll(){
free all locks
}

If you need more than one lock (we needed this for some sophisticated
schedules) be carefull with deadlocks. It's easier to avoid deadlocks, than handling. simply define an order to get more than one: they have to be sorted by alphabet. e.g. if someone has a lock to 'HUGO', he could get 'MARTHA'. If he tries to get 'ADAM' throw an exception.
We used a special lockfile and inserted a record with name as one keyfield and held the lock using commitment controll to release all we specified commit (so this must run in a named ACTGRP only used for this SRVPGM.
Advantage of this is, that you could see the sequence of aquired locks in journal (if you use a FlipFlop mechanism := an int column created with contents 1 multiplied by -1 for eych update).
If you need more flexibility, to release only a single lock, still holding others (releaseMutex(name)) , some lightweight syncobjects are better.

The QUSLOBJ and the write some info to a DTAARA/FILE I wouldn't recommend.
The first is not correct, if more than one is trying to run at the same time, maybe none of them will win, worst case blocking each other. The second is incorrect too, if a job dies you would have to do some manual repair before it could run next time.

Dieter





--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.