encodeFile instrumented with errorcodes