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



Terri & Gord,

That works pretty good if you have a small number of records.
An alternative is to use a UDF that increments a data area.

You can see an example of one at:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/iseries-toolkit/CVSROOT/src/qrpglesrc/numseq.irp?rev=HEAD&content-type=text/plain

That code does not use a data area so you would need to add
something like this (note that there is no overflow checking):
 ***********************

 * Last used sequence *

 **********************

DLstSeqDS         DS                  DTAARA(LstSeq)

D LstSeq                        10U 0

 /TITLE GetSeq - Return a sequencial number.


**********************************************************************************************
 * *IntSeq        Return an integer numeric sequennce.
                      *

**********************************************************************************************
PGetSeq           B                   EXPORT

DGetSeq           PI            10U 0

C     *LOCK         IN        LstSeqDS

C                   EVAL      LstSeq      = LstSeq + 1

C                   OUT       LstSeqDS

C                   RETURN    LstSeq

PGetSeq           E



To get to the main page goto http://iseries-toolkit.sourceforge.net

David Morris

>>> THarteau@felkerbrothers.com 12/13/01 02:03PM >>>

Thanks Gord, it worked great!

<===================================================>

Terri Harteau
****************
"There's no point in being grown up if you can't be childish
sometimes."
- Dr. Who
****************




You should be able to:

Select (max(FieldNameForKey) + 1) from TableName into :HostVariable

Gord Royle



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.