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



I have a file (err um "table") where I'm inserting a row. I need to increment a sequence number based on the values of 3 other fields.


1. If there aren't any rows for a given order number, the sequence would be 1

2. If there are rows for a given order number, I need the "next" sequence number

Currently I run Exec SQL to get the max(seq#), add one to that in RPG, and then Exec SQL and insert the row.

Just wondering if a different (more clever) method exists?

Side Note: There can be multiple users inserting rows simultaneously - this has me concerned for my method.

Greg

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.