EBCDIC fixes

We are working to get Perl v5.22 to support EBCDIC platforms again.  We have a smoker set up there now.  These changes were made in a branch off blead to get this module working there.

I also found it useful to change the debug statements to print to STDERR, in order for them to not interfere with and/or get swallowed by the test harness.  I can submit a patch with that if you'd like.  It was kind of a pain to do, as there were so many of them, and I had to make sure that only debug prints were changed.  It might be better to have a function call instead which allowed a one-place-only edit to change the output file.  In some circumstances, I could see wanting to log to a file instead of STDOUT or STDERR.  Let me know.