The file formats arrive in an RPG trigger program as a data structure. You could use a compile time array to populate an array keyed on the file name, and containing the start positions of the fields to be updated. Or if you don't want to have to recompile every time a new file is added, you could move that array out into a database file, and chain to it with the file name. if the fields are always in the same position relative to each other, you could put them in a based data structure, and use a pointer to overlay it onto the appropriate record format. Or, if necessary you could make each field you need to update a based variable, and calculate a pointer for each one.

There might be a way using SQL to do this without pointers, but since you want to use it for multiple tables, that might not work so well. When defining an SQL trigger program, it is defined for a specific table and trigger time.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----"gio.cot" <gio.cot@xxxxxxxxxxx> wrote: -----
To: <rpg400-l@xxxxxxxxxxxx>
From: "gio.cot" <gio.cot@xxxxxxxxxxx>
Date: 11/28/2016 09:42AM
Subject: Generic trigger - Dinamically field position find


I would need write a generic trigger program that update date and time
change fields ;

This is my scenario:

Trigger program receive the two standard parameter
(https://publib.boulder.ibm.com/html/as400/v4r5/ic2979/info/db2/rbafomst288.
htm#HDRRZAHFTRC )

As the date and time change fields , are always the same, (example
DATA_LOG - TIME_LOG), I would need find the initial field position in input
record update the values in the input record string with substring and then
return back so that in record I will find my date and time updated.

Can some help me with some example or how to find the initial fields
position ??



Keep in mind I have about 25 files that have the same date and time fiels
and I would like to write only one trigger program to update this two field

Thanks in advance








This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].