A Simple Tip for Handling Clarion Errors

When manipulating data files in code, you can check after each operation for errors.

Here’s an example:

clear(peo:Record)

peo:EnteredDate = _:FirstDayOfYearset(peo:keyEntered,peo:keyEntered)

loop

next(People)

if ((errorcode() = 33) or (peo:EnteredDate > today())

break

elsif errorcode()

_AddError(_:ProcedureName,'routinename',subject,body)

end

end

So what’s going on?

When you’re running an error check, there are certain errors that should be handled with special care, contextually based on the preceeding command.

After a next() I know that (errorcode() = 33) means "forgeddabout it, this baby is all done".

The other errorcode()’s to watch out for are

  • = 35 .. You’ve done a get() on a File, and the record (from the primed values + key in the get()) doesn’t exist
  • = 30 .. You’ve done a get() on a Queue, and the record doesn’t exist

Those three are the most frequent errors I check for.

Let’s lay them out one more time.

30 .. get() on Queue, record doesn’t exist.

33 .. next() on File, record doesn’t exist.

35 .. get() on File, record doesn’t exist.

Another quick tip from the simple minds at PimpMyClarion. Simple.