× 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: "Peter Dow" <pcdow@xxxxxxxxx>
  • Date: Thu, 6 Apr 2000 22:47:02 -0700

Hi István,

I don't see a reply from Dan, so I'll jump in. A better practice than just
using the error indicator on the write stmt is to check for an existing
record with setll and an equal indicator. The reason? The last time I ran
across a program that used the method you describe of adding 1 to a sequence
nbr that was part of the key created a 5,000 page job log. If an error
occurs during the write, the program goes into error handling mode which
uses up time and job log. Better to use setll plus the write indicator. The
reason for using both? As someone pointed out in another message, there is a
remote possibility that after having checked for an existing record and
before doing the actual write, another job could actually add that record,
causing the duplicate error.

Regards,
Peter Dow
Dow Software Services, Inc.
909 425-0194 voice
909 425-0196 fax

----- Original Message -----
From: István Rudas <Istvan@Rudas.net>
To: <RPG400-L@midrange.com>
Sent: Thursday, April 06, 2000 3:55 PM
Subject: RE: SQLRPG error MONMSG possible ?


> At 13:01 06.4.2000 -0400, DAN BALE wrote:
>
> >... ... you will avoid the message that's slowing you down.  However,
this is
> >considered to be a bad programming practice.  (... ... )
>
> Dan Bale: please would you express more precisely, WHY this is 'considered
> to be a bad programming practice'?
>
> Since a lot of years I use this error-indicator, making after the
> WRITE-statement the error-handling: this could be (not often used) just
> writing to an error-protocol file with sendmessage to the operator after
> LR, but most likely (=nearly always) I have the so-called Unique key, when
> making the databasedesign, always added with an additional (internal)
> numeric field as last portion of the whole key: so I add +1 to it when the
> error-indicator was *ON until it is *OFF, this means that the program has
> never to STOP with the "blue screen of death" /cpyr bill g./, and I can
> alarm the operator/user/human at the program end (or other logical
> transaction end) with a message if interactive, or a protocol file or a
> list if it runs batch, where he has to look for this "duplicate key" in
the
> sense of the application, but not-duplicate for the machine!
>
> (Would this be only a theoretical discussion, I would say, yes + guilty, I
> am quite never using a UNIQUE key even if I write it in the DDS; as
> practical application maker I say, that it is unique until the moment when
> something goes wrong and in this moment I leave NOT the responsibility for
> answering to a CPF (C G I R?) to a user who is not a programmer - then
> something has to be wrong with MY data design and its ME who has to react
> with a better design).--- Of course, the question of alarming or not
> depends of the nature of the application, as in many cases it could be
> nonimportant to allow more "unique" records (as you mention, then look
> first for the highest key with Setll and so on), then use an internal
> numeric field, see above.
>
> If your comment was, to use the error indicator and then NOT doing some
> error handling=doing nothing, then we are meaning the same, this can be
> very stupid and is really not professional.
>
> Thank you for answering
> István (from Austria)
>
> *note: having written now so much about error handling reminds me to:
> SELECT
> - for those who read german you find an article written by Anton in our
> magazine where he shows how to make nice error-handling (Global Message
> Handling in CL), the address is: <www.common.at/info9905.pdf> and there
> starting at page 38.
> - for those who can't read german, a look at the screen shots could be
> informative as CL code is selfexplaining.
> - all others: cheers! ENDSELECT
> +---
> | 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
> +---


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

+---
| 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:
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.