Use the $UPDFILE function in conjunction with the ON FIELD CONSTRAINT CONFLICT unit.
If $UPDFILE is invoked from an ON FCC unit following the detection of a field-level constraint conflict, it returns the name of the file in which the constraint violation occurs. If the file is remote, $UPDFILE also returns its location (in the form filename AT location). At all other times, $UPDFILE returns a null string. The $UPDFILE function takes no arguments.