× 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 do not intend to start any religious wars... so just ignore any comments where _you_ [meaning anyone, not Vern] feel some moral obligation to respond\refute. And if further discussion about the check constraints or the example is of interest, perhaps by then, such additional discussion no longer belongs in this same subject\thread.?

One of the big failings in being able to move away from monolithic green screen programs to an alternate interface to service client requests [from other than the interactive 5250], is that the validation typically has been built into either or both the display files and the screen-handling logic within the application. When the logic is in the database, there is no requirement to rewrite nor port the logic from either the DSPF or application, into the alternate-client version of the application.

If the logic is maintained as a single entity [e.g. a procedure in a *SRVPGM] and the TABLE is ensured to effectively-never be updated from any interface other than those to which the logic within that entity will validate the input\updated data, then not having the database protect the data is reasonable. However when there exists an interface that is not properly enforcing the logic via that single entity, either by invoking outdated logic [e.g. from a prior iteration of that entity] or simply having never invoked the logic via that entity, then the data may once again be found to have the errors that were previously eliminated by the /one-time/ scrub. That means then, the one-time scrub may in fact need to be done periodically. Arguably, if the constraint is disabled, the same requirement to re-validate and possibly scrub.

The name of the constraint can be the identifier of the constraint rule being violated. I am sure there are many creative ways, other than using the constraint name, but for two example which do:

// Use the name as literal; e.g. in impromptu messaging:
If chkcst_name='CK_CONTRACT_INPUT_RULES' then
issue_message(%sst(chkcst_name 3) *cat 'was violated')
// Msg: 'CONTRACT_INPUT_RULES was violated'

// More appropriately, to enable national language, a MsgID:
select chkcst_name /* name is MsgId in msgf=CID; e.g. CID7788 */
when 'CID7788' then /* 'Contract "&1" is not a valid ID' */
issue_message(CID7788, CNMACC) /* CNMACC is input value */
// Msg: 'Contract "TEST" is not a valid ID'
otherwise
issue_message(CID9999, '*UNKNOWN Constraint error')
end-select

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.