× 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 am having trouble with an ILE program reading a quotation file, selecting by date and then writing to a history file that is almost identical. It just has two extra fields: A time stamp and an identity column called QTID defined in DDL.(actually defined using Ops Nav). I am not using SQL, just the RPG write op code.

I found in the Midrange.com archives that I should change the default of the identity column to "generated always as identity", which I did in OPS NAV. I then generated the SQL to prove I did it right.
QTID INTEGER GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 )

When I run the program, I get an error CPF5009, duplicate key. Joblog says:" If the record number is zero, the duplicate record key occurred on an output operation. " which is correct. An rpg dump confirms QTID is 0.

We are trying to utilize the new DDL features like record identity and time stamp, but we still have to work with our old programs.

I don't know if it has any bearing, but both files are defined with the same field names and same record ID (QTREC). The quote file is defined as UP. The history file is defined as O and renamed on the F spec: rename(qtrec:qthrec). The input file does NOT have record id column or time stamp column, but all other fields have identical names.


I know using embedded SQL could solve the problem, but that is not an option.

---Dale







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.