I think the easiest way to do this would be for your program to check for a file's existence before making the attempt, and to create that file once it executes successfully.
If you can't modify the program to do so, use the cronjob itself. Something along the lines of:
test -e /path/to/tempfile || ( /path/to/program && touch -a /path/to/tempfile )
Because of the way unix evaluates condition checks, once the left side of the
|| condition evaluates to
true, the entire expression is true and the right side is never evaluated -- IE, the program isn't called.
Then inside the parens, && requires both sides to evaluate to true, so if
/path/to/program exits with a nonzero return code, there's no point in evaluating the statement on the right -- the expression already evaluates to false -- and
/path/to/tempfile is never created.