Trigger program lock.

170 pts.
Tags:
AS 400
DB2
RPG
When a trigger program is locked because the physical file is locked, how can we promote a program through MKS when it is locked. We have over 40 warehouses with a copy of the same file so getting everyone out of the individual files would be a chore. Can we use a CL for the trigger program or is there a setting or parameter we can use?

Software/Hardware used:
as/400 rpg rpgle db2

Answer Wiki

Thanks. We'll let you know when a new response is added.

We have a few CL trigger programs that we the trigger occurs checks a data area called “processing” if it’s no, the job can run if it’s yes then it submits the job to a single threaded JOBQ so there is no interference with other order process that can fire the same trigger.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    How is your current trigger program being fired off, on an insert, delete, update or read? When is it done before / after ? Is this a threaded job? More details are need as to how the job is currently set up and why there is a need for 40 copies of the file. How are these files kept in sync?
    94,885 pointsBadges:
    report
  • UARTJ
    Its being fired from Update, delete, and update and they are all interactive jobs. The warehouses are operate under individual modules or silos. Each has its own customer and product databases.
    170 pointsBadges:
    report
  • ToddN2000
    If the jobs are interactive, you could do the same thing in the RPGLE. Use a data area to set a flag "file locked" at the start of the trigger program and then "file unlocked" when trigger program is done. Then in the program you could add a delay of a few seconds and try the test to see if the file lock is removed and it's ok to process.
    94,885 pointsBadges:
    report
  • UARTJ
    We were also thinking about creating a CL to be trigger programs and pass the parms to the RPG program to process. Because there can be many people in theses files at each warehouse.
    170 pointsBadges:
    report
  • GregManzo
    I think your question is not so much about how to allow each trigger to fire without upsetting other databases, but how to MOVE the trigger program to replace it with a new version. (if not, stop reading now).
    We use a CL as a 'generic' trigger program that just passes the parameters to the 'real' RPG trigger. It's deliberately simple so it never needs changing. When users have files open the system locks the CL trigger, but we can happily replace the RPG program at any time. 
    Because users might be calling it at any time we move the new version into a dedicated lib (high in libl), then move the old version to QRPLOBJ, then move the new version from the dedicated lib to its proper home. If the QRPLOBJ trigger happened to be in use, it's still ok until next IPL.
    1,995 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: