× 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 question doing stuff in triggers that are best left in constraints.
Specifically you just mentioned referential integrity. Which means stuff
like "don't allow an order line entry if there is no order header record"
kind of stuff. On this you should simply do something like
ADDPFCST FILE(ORDLINE)
TYPE(*REFCST)
KEY(LORDNUM)
PRNFILE(ORDHEAD)
PRNKEY(HORDNUM)
DLTRULE(*RESTRICT)
UPDRULE(*RESTRICT)
Try that on your order line file. Now try an RPG write into that order
line file with an order number that does not exist in the order header
file.
Also, simple checking should also be done with contraints. Now the syntax
below may be garbage (as I'm trying to leave for the weekend) but I hope
you get the idea.
ADDPFCST FILE(ORDLINE)
TYPE(*CHKCST)
CHKCST('lactrec in(''A'', ''Z'')')
This validates the active record code in the order line file.
Again, try that RPG write with an invalid record code and see what
happens.

Before you start thinking "but if I do all my contraints in my trigger I
can do the error handling there and display the message just so" remember,
what if the input is coming from something other than 5250?

This is one of the advantages of DDL over DDS. In DDL source you can put
all the constraints. In DDS you have to use a 'make' program to run a
bunch of ADDPFCST commands.


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.