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



Been awhile, but on your constraint error not only can you handle the code
generated for a constraint violation but you could interpret the
constraint name. Instead of using system generated constraint names you
could call it something like NoOrderHeaderForThisOrderLine. If
multilingual is a concern pull the message description from a message file
keyed by the constraint name. Or your other favored multilingual
technique.
Now's the time you may have to do it right, versus that old 1970's code
that assumed that every write error was a duplicate key error and then did
a chain/update.

The following is a crude example.
There are probably better ways to do it.
But this is interface neutral. Meaning that it works the same in 5250,
Client/Server, etc. In fact, I posted the results from two interfaces.

From sample trigger program
...
When new.tptdesc=*blanks;
ErrMsg='Field TPTDESC is invalid';
exsr fail;
return;
When new.tptlib=*blanks;
ErrMsg='Library name may not be blank';
exsr fail;
return;
...
begsr fail;
// Invalid data. Abort the trigger.
CALLP QMHSNDPM('CPF9898':
'QCPFMSG QSYS ':
ErrMsg:
%len(ErrMsg):
'*ESCAPE':
'*':
1:
MsgKey:
errc0100);
...

UPDDTA TPTYPE
upddta web/tptype
Ownership of object QDZTD00001 in QTEMP type *FILE changed.
Ownership of object QDZTD00001 in QTEMP type *PGM changed.
Library name may not be blank.
Application error. CPF9898 unmonitored by TPTYPET at statement *N,
instruction X'0000'.
Error occurred in trigger program.
Error occurred in trigger program.
Message CPF502B was issued.

Crude, but never really put into production. Again, these are simple
tests that could have been done with constraints.

From iNav's "Run SQL Scripts":
update web.tptype
set TPTLIB=' '
where tpttype='C23.001';
SQL State: 38501
Vendor Code: -443
Message: [CEE9901] Application error. CPF9898 unmonitored by TPTYPET at
statement *N, instruction X'0000'. Cause . . . . . : The application
ended abnormally because an exception occurred and was not handled. The
name of the program to which the unhandled exception is sent is TPTYPET
TPTYPET . The program was stopped at the high-level language statement
number(s) at the time the message was sent. If more than one statement
number is shown, the program is an optimized ILE program. Optimization
does not allow a single statement number to be determined. If *N is shown
as a value, it means the real value was not available. Recovery . . . :
See the low level messages previously listed to locate the cause of the
exception. Correct any errors, and then try the request again.

Rob Berendt

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.