Hi,

I am trying to read in records from an old main frame file. Each record is
640 bytes. I had some success using the following statement:

iconv(readChar(con, nchars=640, useBytes =
TRUE),from="IBM037",to="",sub="#")

What I have found, however, is that ocassionally a record will contain a
Null halfway through, which causes readChar() not to read the rest of the
record. It is a very old database (from the 1970s I think), and I am not
really sure why the Nulls are there. I do know that that after the occurence
of the first Null, the record looks normal (it's not Nulls to the 640th
byte). In any case, I would like to get the whole record and just put some
placeholder, like a 0 or a #, in place of the Nulls.

I tried using readBin() instead, but I couldn't figure out how to pass that
off to iconv...

Can anyone help?

Thanks,
Mike

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to