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
Hi Craig, You might find it easier to pass the records through iconv if you're on a Linux/Unix box and convert to ISO8859 from IBM037 (or whatever codepage your ENCDIC files are in). There are versions of this gnu software for Windows too, if that's your platform - it's trivial to use. Shout if you need a hand. Saying that, you'll almost certainly find that the 4 byte RDW has been stripped from the file when it was sent to you, so you're not being given any information to determine the length of each variable length record. Quick way to check - open the EBCDIC file up in an hex editor (I use HxD (from http://mh-nexus.de/en/hxd/as it will happily run in EBCDIC mode). If you can't see 4 bytes at the start of each record, then you're in trouble as you have no way of determining the record length, without the copybook for the file on the mainframe. 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