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



Let me get this straight.
You create a table with an autoincrementing column.
You create another table like that one via CRTDUPOBJ, CPYF, or a like
CREATE TABLE.
You perform activity on the original file like:
insert 1, 2, 3, 4, 5
delete 2, 5
update 1
Now you use CPYF to copy the entries from the original (1, 3, 4) to the
copy.
You insert a new row into the copy and you'd like it to use the next entry
from the source (6) and not whatever the increment counter is set to
(possibly 1 or 4, I've not tested this, which may be a duplicate key
issue).
Right?

CREATE TABLE ... LIKE ...
is supposed to include the identity column properties.
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/db2/rbafzhctabl.htm?lang=en
LIKE
table-name or view-name
Specifies that the columns of the table have exactly the same name and
description as the columns of the identified table (table-name) or view
(view-name). The name must identify a table or view that exists at the
current server.
...
If the LIKE clause is specified immediately following the table-name
and not enclosed in parenthesis, the following column attributes are also
included, otherwise they are not included (the default value, identity,
row change timestamp, and hidden attributes can also be controlled by
using the copy-options):

Default value, if a table-name is specified (view-name is not
specified)
Nullability
Hidden attributes
Identity attributes
...

IDK if this will do it:
Help for CRTDUPOBJ
Duplicate file identifiers . . . *NO
aka FILEID(*YES|*NO)



Rob Berendt

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.