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



A trigger can set the next value for RecID and put it in the buffer before it gets written, so your table will have the proper value, but this RecID will not be returned to your program.
If you have some other key, you can read the file and get the RecID number.

If you can re-create the file you can define RecID as auto increment.

Leif Guldbrand wrote:

Does someone have a brilliant suggestion to this scenario ???

Have a file (DB2/400) which receives records from programs in an ERP system, but also from other servers in the neighborhood using ODBC.

The file has a keyfield (RecID - 9,0). This keyfield should ofcause be unique, but when I receive records into the file via ODBC I have no control and right now I only receive *zeros in the field (RecID).

Then I thought... create a trigger program (RPG or SQL) and fire it *BEFORE an ADD to the file. Get the next number (last used RecID + 1) and return this value and initialize RecID with the new number !!!!

But I'm not sure this can be done.... seem to remember a trigger program cannot
return any parameters ??? !!!

Any comments or ideas ????
Btw: I haven't worked with triggers before ;-)

Regards,
Leif





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.