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



Correct.

You want to use a BEFORE UPDATE trigger, then you just change the AFTER
value in the buffer.

Charles


On Thu, Feb 11, 2021 at 7:00 AM Alan Shore via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

Hi Rob
Thanks for the info
This shows that I didn’t know how triggers work
You said that the trigger can modify the buffer BEFORE it hits the disk
Does that mean, all I need to do is change the after value to be the same
as the before value?
There is no need to do another update of that record?

Do you know of an example of what I need to do?

Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image001.png@01D70054.4B79B800]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx

‘If you're going through hell, keep going.’
Winston Churchill

From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Rob Berendt
Sent: Thursday, February 11, 2021 8:54 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] RE: Stopping a field on a file from being changed

<snip>
This should trigger a secondary update
</snip>
WRONG! It will NOT trigger a secondary update. You are changing the
trigger buffer being passed to the row. See the ALWREPCHG on ADDPFTRG.
You are updating the buffer being passed before it gets to disk. It only
knows of the one update. "I think" the audit journal entry will only
display the final results of the buffer. Which brings up some interesting
questions on an audit.

ProgramA does a WRITE or UPDATE to FILEA. FILEA has a trigger on it with
ALWREPCHG set to yes. The name of the trigger is TRIGGERA. TRIGGERA can
modify the buffer passed from PROGRAMA before it hits the disk. Or it could
abort the write by issuing an exception message. If PROGRAMA does not have
the appropriate error checking it will abort. Really hosed those programs
which always assumed that any error on a WRITE was due to a duplicate key
and automatically switched to an UPDATE instead (or generated a new key).
Big reason why I'm not a fan of the MONMSG CPF0000 attitude

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com<http://www.dekko.com>


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:
midrange-l-bounces@xxxxxxxxxxxxxxxxxx>> On Behalf Of Alan Shore via
MIDRANGE-L
Sent: Thursday, February 11, 2021 8:20 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx<mailto:ashore@xxxxxxxx>>
Subject: Stopping a field on a file from being changed

CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.


Hi everyone
We are on V7r3
I have been asked if there is a way to stop a field from being changed
(updated) - except on certain conditions
I asked this question a while ago - and someone (forgive me - but I cannot
remember who that was) suggested using a trigger
I am wondering if this makes sense - any and all comments gratefully
accepted

Within the trigger program - on the file in question, on an update,
compare the before and after values of that field
If they are the same - let it go
If they are different AND the conditions don't meet the exception
conditions, update that record for that field ONLY within the trigger
program back to the old value
This should trigger a secondary update trigger - but because the program
updating the record is the name of the trigger program - let it go

If the conditions of the update meet the exception conditions - let it go

I hope this makes sense
As previously stated, any and all comments gratefully accepted




Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image001.png@01D7004E.A31BDBC0]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>

'If you're going through hell, keep going.'
Winston Churchill



The Nature’s Bounty Co. is now The Bountiful Company! Our email address
will be changing from @nbty.com to @bountifulcompany.com. Please update
your email address book so that important communications are not
interrupted.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:
MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l<
https://lists.midrange.com/mailman/listinfo/midrange-l>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:
MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l<
https://archive.midrange.com/midrange-l>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:
support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

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

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:
support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

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



The Nature’s Bounty Co. is now The Bountiful Company! Our email address
will be changing from @nbty.com to @bountifulcompany.com. Please update
your email address book so that important communications are not
interrupted.
--
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.