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



Gene is correct.

I just created a DDL file with an identity column and I had to use
"Generated Always As Identity" to force it to assign the next number in
the sequence when a record was written to the file. When I didn't specify
that, the record was always written with the identity column as 0.

Thanks,
Robert J. Mullis
Wellington-Royce Corporation
rmullis@xxxxxxxxxxxxxxxxxxx





Gene Burns <burns.gene@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
02/17/2009 05:00 PM
Please respond to RPG programming on the IBM i / System i

To: "RPG programming on the IBM i / System i"
<rpg400-l@xxxxxxxxxxxx>
cc:
Subject: Re: Using "As Identify" clause generates duplicate
key error


I believe this will work if you change your ddl file to "Generated Always
As
Identity" instead of "As Identity"



On Tue, Feb 17, 2009 at 3:53 PM, Doug Palme <DPalme@xxxxxxxxxxx> wrote:

We have created a new ddl file which has the following as the first
field
listed in the ddl:

0001.01 VndKey Numeric(20) As Identity(Increment by 1)
0001.02 Primary Key,

Now, before anyone starts yelling about using imbedded SQL in the
program;
it is not going to happen....beyond my control, but the following code
is
what writes the new records.......

0007.70 DaysSubm = nDySubmit;
0007.71 DaysNCrd = nDysCrd;
0007.72 MinAmtRq = nMinAmt;
0007.73 MaxAmtRq = nReqApp;
0007.74 AutFaxNo = nFaxNo;
0007.75 AutFaxDy = nDysRsnd;
0007.76 AutFaxRs = nResend;
0007.77 Write Policy;

Now, at one point this file had a usr open and close attached to it,
and
maybe that was part of the problem, but it would never write a new
record.....always tried to write the same old key (16)......

We finally yanked the IDENTITY clause out of the file and moved on,
but I
thought I would run it past the group and see if anyone had any
ideas.......

Douglas
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.