> -----Original Message-----
> From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor-
> bounces+steve.flynn=capita.co...@python.org] On Behalf Of Steven
D'Aprano
> Sent: Saturday, July 14, 2012 2:42 AM
> To: tutor@python.org
> Subject: Re: [Tutor] converting EBCIDIC to ASCII
> 
> Prinn, Craig wrote:
> > I am trying to convert an EBCIDIC file to ASCII, when the records
are
> fixed
> > length I can convert it fine, I have some files that are coming in
as
> > variable length records, is there a way to convert the file in
Python? I
> > tried using no length but then it just reads in to a fixed buffer
size
> and
> > I can't seem to break the records properly
> 
> 
> I'm afraid that I have no idea what you mean here. What are you
actually
> doing? What does "tried using no length" mean?

The conversion to ASCII from EBCDIC is only going to get Craig so far -
depending on how the sender transferred the files to him, there's a very
good chance that the 4 byte RDW (Record Descriptor Word) has been
stripped off the start of each record.

This 4 byte RDW should indicate that the next N bytes belong to this
record. Without it, you have no way of determining how long the current
record should be and thus where the next RDW should be. This makes
finding the start and end of records tricky to say the least.

I've written to Craig off list with some info as it's not particularly
relevant to Python, other than letting python do the work of iconv.

S.



This email and any attachment to it are confidential.  Unless you are the 
intended recipient, you may not use, copy or disclose either the message or any 
information contained in the message. If you are not the intended recipient, 
you should delete this email and notify the sender immediately.

Any views or opinions expressed in this email are those of the sender only, 
unless otherwise stated.  All copyright in any Capita material in this email is 
reserved.

All emails, incoming and outgoing, may be recorded by Capita and monitored for 
legitimate business purposes. 

Capita exclude all liability for any loss or damage arising or resulting from 
the receipt, use or transmission of this email to the fullest extent permitted 
by law.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to