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



Alan,

V5R4. We just can't figure why the system is throwing a duplicate key
error, especially when it writes the record.

Jim

On Tue, Feb 2, 2010 at 2:13 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

What OS release are you on?

I have been noticing something like this occurring since we went to V6R1.
Haven't been able to track down.

On Tue, Feb 2, 2010 at 1:09 PM, Jim Essinger <dilbernator@xxxxxxxxx>
wrote:

What we are trying to do is make sure that a header record is being
created
in the CARTHEADER file. Attempts to trap for it not existing cause the
issue below. We have a program that is writing to that file, and
checking
for an error.

What we are seeing is records added to the file, but errors are returned
to
the program as if it was a duplicate write. We have checked the physical
file, and there are no duplicate key issues we can tell. There are 2
non-unique logical files built over the physical. The physical file is
unique keyed by a dealer number and a unique "Next Cart" number contained
in
a control file (VXACONT).

The code reads the control file, adds one to the "Next Cart" number and
updates the control file. It then uses the Next Cart number retrieved to
write a new record to the CARTHEADER file. The "IF %error() and
%status()
=
01021 " line is causing the code to execute the next DO loop. We see the
records added to the CARTHEADER file in sequential order like;

Dealer Cart Number
001 0001
001 0002
001 0003
001 0004
001 0005
001 0006
001 0007
001 0008
001 0009

The 10th time creates a header, then falls through and allows the program
to
use it in the rest of the process.

Our question is: Why is the program receiving or the system throwing a
duplicate key error, even when it writes the record?

Thanks for your thought and help.

Jim

= = = = = = = = = = = = = = = = = =
RPG Code giving us fits;


C Do
10


C 'WPSONLINE ' Chain(e)
XACONTR


C If %error() and %status() >
01000

C
Iter


C
EndIf


C If
%found()


C Clear
CARTHEADR


C Eval OSCART =
XANO01 Next Cart#


C Eval XANO01 = XANO01 +
1


C Update
XACONTR


C Eval CHDEALER =
OSDEALER


C Eval CHCUST = OSCUST


C Eval CHUSER =
OSUSER


C Eval CHCART = OSCART


C Eval CHDESC='Cart created - ' +
%EditC(*date:'Y')

C + ' -
CART2'


C Eval CHSLSMN =
OSSLSMN


C Eval CHCDATE =
*date


C Time
CHCTIME


C Eval CHCUSER =
OSUSER


C Eval CHLDATE =
*date


C Time
CHLTIME


C Eval CHLUSER =
OSUSER


C Write(e)
CARTHEADR


C If %error() and %status() =
01021 Duplicate Rcd Error

C
Iter


C
EndIf


C
EndIf


C EndDo

Unique key for the physical file:

A K CHCUST
A K CHCART

Non-unique key for the logical files:

A K CHCUST
A K CHCART DESCEND

and

A K CHORD (this value is Zero for new records written)


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.