One way to do it is to do the following:
ADDPFCST FILE(ROB/DOUGDTL2)
TYPE(*REFCST)
KEY(ORDERNO)
PRNFILE(ROB/DOUGHDR)
PRNKEY(ORDERNO)
Then look for the messages:
CPD32C5 - Key values for referential constraint are not valid.
... The constraint is in check pending because record 1 in the dependent
file has a foreign key value that does not match the parent key value in
the parent file...
Clear up all those records. Or, use DSPCPCST to find the ones in error.
Once completed then
CHGPFCST FILE(ROB/DOUGDTL2)
CST(...)
STATE(*ENABLED)
and you'll never have another detail record without a corresponding
header.

But, if you're not ready for a reliable long term solution you could try
select orderno from rob.dougdtl2
where orderno not in(select orderno from rob.doughdr)



Rob Berendt

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