You need a before insert trigger. The number must be determined first,
before the row is finally written.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve
Jones
Sent: Donnerstag, 4. Mai 2017 15:13
To: rpg400-l@xxxxxxxxxxxx
Subject: Trigger pgm to increment seq# in file
We have a file that contains a sequence number for each unique key in the
file, file is defined like this:
Filea:
Field1 (key1)
Field2 (key2)
sequence number (starts at 1)
We want to have a trigger program fire when a record is added to set the
sequence number of the new record to be the next #.
So I tried adding a trigger with trigger time of *after & event *insert,
that fails because the record is still in use.
Seems like a simple idea, but we are missing something.
Thanks
--
Steve Jones
H-P Products, Inc
330-871-2054
--
NOTE: The information in this email is confidential and may be legally
privileged. If you are not the intended recipient, you must not read, use or
disseminate the information; please advise the sender immediately by reply
email and delete this message and any attachments without retaining a copy.
Although this email and any attachments are believed to be free of any virus
or other defect that may affect any computer system into which it is
received and opened, it is the responsibility of the recipient to ensure
that it is virus free and no responsibility is accepted by H-P Products,
Inc. for any loss or damage arising in any way from its use.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.