in reply to Set Combination

You have three possible conditions in which you want to print this error message, but it seems one of them is out of control. Split the three clauses, as a debug measure, into three seperate statements and make the error message tell you what condition failed.
sub chkfmt { unless ( $DISCPCNT and $DISCDAYSDUE and $NETDAYSDUE and !( $DISCDUEDATE or $NETDUEDATE or $TERMSDISCAMT ) ) { print TSERROR "First condition failed\n"; } unless ( $DISCDUEDATE && $TERMSDISCAMT && ! ( $DISCPCNT || $DISCDAYSDUE || $NETDUEDATE || $NETDAYSDUE ) ) { print TSERROR "Second condition failed\n"; } unless ( $DISCPCNT && $DISCDUEDATE && ! ( $DISCDAYSDUE || $NETDUEDATE || $NETDAYSDUE || $TERMSDISCAMT ) ) { print TSERROR "Third condition failed" }
What I suspect you will find is some varaible you thought was (un)initialized actually (is)isn't. If it gets real bad, you can then take each error condition, test each variable and discover which one is behaving different than you expect. I will leave that as an exercise to the reader :)

mikfire