record count


Hi ,

Is there any BSFN to retrieve the total number of records in a given table ? I want to use this record number so as to insert some additional records with the same sequence.(Eg. If count is 100, I want to start the insertion with 101)



Legendary Poster
Hi Fan,

First, you are posting to the wrong forum, this kind of post technically belongs in the OW Developers forum.

Second, you always stand a better chance of getting helpful answers that are pertinent to your problem if you include information regarding your system configuration, versions, etc. It's best to put that kind of stuff in your signature so you don't have to type it every time.

Here's a suggestion for you anyway.
Instead of trying to find the total number of records and and assign a sequence number based on that (dangerous approach - duplicates possible if deletes occur), try one of the below suggestions:

1. Use the OneWorld Next Numbers system and BSFNs to control your sequencing. Use application P0002 to setup a next number sequence for system code 55. Then use BSFN X0010GetNextNumber in your program to get the next sequence number each time you need one.

2. Create an index on the table containing the sequence number. Use the sequence number as the key field but specify that the sort sequence is in descending order. In your program do a select and fetch next on the table using the specified key. The first record retrieved will contain the last sequence number used.

Of these 2 approaches the first one is the safest if more than one instance of your program/code is running.


Larry Jones
[email protected]
OneWorld XE, SP 15.1
HPUX 11, Oracle SE 8.1.6
Mfg, Distribution, Financials