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


  • Subject: RE: SQLRPG error MONMSG possible ?
  • From: "Silvio Santos" <Silvio.Santos@xxxxxxxxxxx>
  • Date: Thu, 6 Apr 2000 20:07:08 +0100



Thanks Dan but I forgot to mencion in the message body that I am using SQL
embedded in RPG.
to do the updates.

Silvio.




"Bale, Dan" <DBale@lear.com> on 04/06/2000 06:01:43 PM

To:   "'RPG400-L@midrange.com'" <RPG400-L@midrange.com>
cc:   Silvio Santos/VC/PT/BRAIN@BRAIN

Subject:  RE: SQLRPG error MONMSG possible ?




Silvio,

There are a few ways to avoid this problem.

The first and best, IMO, is to check to see if the record with the duplicate
key already exists _before_ updating the file.  Of course, you wouldn't want
to do this if the key that causes the duplicate was not modified in the
record you are updating because, obviously, the record with that key already
exists!  However, if any of the key fields have changed, then do a SETLL
with an EQual indicator on the file with the unique key; if the resulting
indicator is on, a record with that key already exists in the file; if the
resulting indicator is off, a record with that key does NOT exist in the
file.  Using SETLL in this way means that the record buffer is not changed
because no record I/O occurs, so your desired output is not corrupted.

Otherwise, both the UPDAT/UPDATE and WRITE op codes allow you to specify a
resulting error indicator; such an error as you described would be trapped
by that indicator being turned on.  By just specifying the error indicator,
you will avoid the message that's slowing you down.  However, this is
considered to be a bad programming practice.  If you do use this technique,
you should consider writing an audit record to a printer file to review
after the job completes.

HTH

- Dan Bale

> -----Original Message-----
> From:   Silvio Santos [SMTP:Silvio.Santos@brainag.com]
> Sent:   Thursday, April 06, 2000 11:09 AM
> To:     RPG400-L@midrange.com
> Subject:     SQLRPG error MONMSG possible ?
>
>
>
> I have a program that is doing updates to dozens of files and somewhere
> it's
> giving me
> an error saying that the PGM cant do an update in a duplicate record, and
> aborts
> the PGM.
> I want to ignore that (duplicate record) message and continue in the next
> record.
> How can I do that ?
> I need to solve that urgently..
>
> TIA,
> Silvio.




+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.