× 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.



The issue that I don't understand is how the CL program in my OP can be
causing a lock causing other jobs to fail.

But I may have found the answer if someone that knows more can confirm.

From the manual,

An exclusive-no-read lock is held on the physical file when adding a
trigger to that file. All logical files which are built over the physical
file are also held with the exclusive-no-read lock.

So let's say I have FILEA with logicals FILEAL1, FILEAL2 and FILEAL3.

I attempt to ADDPFTRG to FILEA. It tries and gets a exclusive-no-read lock
on FILEA, FILEAL1 and FILEAL3. But it is unable to get the lock on
FILEAL2. If the WAITFILE on FILEAL2 is 30 then for 30 seconds it will hold
exclusive-no-read locks on FILEA, FILEAL1 and FILEAL3.
So if another program were to try to OPEN FILEAL3 the open would fail.

Is this close to what's happening?

Thanks,

Rob

On Tue, Jun 8, 2021 at 5:32 PM Robert Rogerson <rogersonra@xxxxxxxxx> wrote:

Thanks Alan. I have looked at your Trigger Mediator but I think in my
case it's overkill. I also understand that a trigger on a table should be
very small and in my case it does nothing other than insert the after image
to a staging table.

But even if I were to use your Trigger Mediator I still have to add TG_MED
to the file which ends right back where I am.

Rob

On Tue, Jun 8, 2021 at 5:20 PM Alan Campin <alan0307d@xxxxxxxxx> wrote:

First and foremostly never put a trigger program directly on a table.
Always have a Mediator.

A Mediator is a very small program that does nothing except call another
program or service program and does as little as possible.

I use a Trigger Mediator. You will find an older version of it at
www.think400.dk/downloads.htm.

I have been trying to get the new version out but just haven't had the
time.

In any case, the program that you physically wire to the database should
do
as little as possible.

If you want further information, please let me know.




On Tue, Jun 8, 2021 at 1:48 PM Steinmetz, Paul via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

We use triggers on a few of our files.
A 3rd party app upgrade removed the triggers, we were not aware.
To add them back in, due to the object locks, I had to bring the LPAR to
restricted state to add the triggers with no issues.
Not the answer you wanted to hear.

Paul

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Robert Rogerson
Sent: Tuesday, June 8, 2021 4:43 PM
To: Midrange Systems Technical Discussion <
midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: ADDPFTRG and record lock...

________________________________
CAUTION: This email originated from outside of the PENCOR network. Do
not
click on any links or open attachments unless the sender is known, and
the
content is verified as safe.
________________________________

Hi all,

I need some help figuring this out. I am attempting to add an after
insert trigger to a file that is almost always in use. So I wrote a
small
CL program to try and do this in a loop. There were actually 3 files
but
each file was handled the same way.

pgm ()

dcl &t2added *lgl 1 VALUE('0')

DclPrcOpt dftactgrp(*no) actgrp(*new)

DoUntil (&t2added)

Dlyjob (60)

If (*not &t2added) Then(Do)
/* Add trigger to ITEMP */
ADDPFTRG FILE(&library/UPCITMP) TRGTIME(*AFTER) +
TRGEVENT(*INSERT) PGM(VPE172) TRG(TRG_VPE172_INS)
RPLTRG(*YES)
Monmsg CPF32C6 Exec(goto ENDTRG)
Chgvar &t2added '1'

Enddo

ENDTRG:
Enddo
endpgm

I submitted this program at 14:45 yesterday afternoon. It ran for over
9
hours with no errors nor did it cause any errors. Then just after
midnight
we began getting programs (not this trigger adding program) failing due
to
not being OPEN (RPG opcode) a logical over the physical I was trying to
add
the trigger to. As this happened after midnight a number of jobs
failed
when not able to open the logical. As soon as I cancelled the add
trigger
program the OPEN in the other jobs stopped failing.

In my dev environment I ran the program to add the triggers and was
unable
to create a lock by the add trigger program when trying the ADDPFTRG
command.

Is there any way that the ADDPRFTRG command can lock a logical but not
add
the trigger (CPF32C6)?

Thanks,

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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

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

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.