[Tutor] Converting EBCDIC characters to ASCII

bob gailer bgailer at gmail.com
Thu Nov 13 19:36:21 CET 2008

Steve Bricker wrote:
> I see the scenario does not give enough to really allow someone to 
> formulate an answer.  

An excellent reminder to write no code until the user's requirements are 
fully understood!

OTOH a little rapid prototyping can be a fast path to discovery of 

> Allow me to clarify a bit.  The three PD fields are each 10 positions 
> in length.  Using the example below, a field with 
> X'0000000000000000014C' would need to be expanded to a 19-character 
> field of '0000000000000000014'.

So you are going to ignore the sign nibble?
Modify the code I wrote - ignore the sign; treat results as positive.
At the end add "%019i" % value

> Steve Bricker
> On Thu 13/11/08 10:14 , Steve Bricker bricker.steve at imonmail.com sent:
>     I am trying to build an application for work that FTPs a file from
>     an IBM mainframe to my Windows desktop then process it.  The
>     EBCDIC-to-ASCII conversion works nicely (using a BAT file I
>     created) except for three packed-decimal data fields (for example,
>     X'0000000000000000014C' is equal to integer 14).  I am assuming I
>     need to go through this byte-by-byte to convert.  Is that the best
>     approach, or is there a better way?
>     Steve Bricker
> ------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

Bob Gailer
Chapel Hill NC 

When we take the time to be aware of our feelings and 
needs we have more satisfying interatctions with others.

Nonviolent Communication provides tools for this awareness.

As a coach and trainer I can assist you in learning this process.

What is YOUR biggest relationship challenge?

More information about the Tutor mailing list