Results 1 to 10 of 10

Thread: [RESOLVED] EBCDIC Question

  1. #1

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Resolved [RESOLVED] EBCDIC Question

    Hi! mate !
    I've to convert some numeric value to EBCDIC format.
    Does someone can help me put light on this?

    As far as I know, I thing that I have to change the last number for a special one with a “}“ but there stop my knowledge on this.

    Thanks in advance!!

    Zak
    Using VS 2010 on Fw4.0

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: EBCDIC Question

    Not sure if this is of any help but I found this piece of code on the web (sorry I forgot the link) that enables you to read an EBCDIC file. I guess the reverse will hold tru if you want to write an EBDIC file since one of the StreamWriters allow you to specify the Encoding.
    VB Code:
    1. Dim source As Encoding = Encoding.GetEncoding(37)'///EBCDIC encoding.
    2.         Dim path As Encoding = Encoding.ASCII
    3.         Dim b As Byte() = path.GetBytes(TextBox1.Text.ToCharArray)
    4.         Dim aB As Byte() = Encoding.Convert(source, path, b)
    5.  
    6.         Console.WriteLine(path.GetString(aB))

    By the way can someone point us to somewhere we can get a list of encoding numbers for example I would have never guessed that 37 stands for EBCDIC.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    New Member
    Join Date
    Mar 2005
    Posts
    9

    Re: EBCDIC Question

    I did a Google search on "ASCII to EBCDIC" and got lots of info.

  4. #4

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: EBCDIC Question

    Quote Originally Posted by BankCop
    I did a Google search on "ASCII to EBCDIC" and got lots of info.
    I've also do it .. Don’t worry
    I've found a bunch of info about EBCDIC to ASCII but very little for ASCII to EBCDIC.
    And what I want is not really to convert string to EBCDIC but the way to write number in EBCDIC format especially the signed number. As far as I know, it Consist of replacing the last number with is signed EBCDIC "equivalent", and it is this "equivalent" that I search for ...
    Using VS 2010 on Fw4.0

  5. #5

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: EBCDIC Question

    Ok i've found!!

    Code:
    -0    -> }
    -1    -> J
    -2    -> K 
    -3    -> L
    -4    -> M
    -5    -> N
    -6    -> O
    -7    -> P
    -8    -> Q
    -9    -> R
    So for example
    -12345.67 will be 12345.6P
    -12345.62 will be 12345.6K
    Using VS 2010 on Fw4.0

  6. #6

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: EBCDIC Question

    Quote Originally Posted by Mr.No
    Not sure if this is of any help but I found this piece of code on the web (sorry I forgot the link) that enables you to read an EBCDIC file. I guess the reverse will hold tru if you want to write an EBDIC file since one of the StreamWriters allow you to specify the Encoding.
    VB Code:
    1. Dim source As Encoding = Encoding.GetEncoding(37)'///EBCDIC encoding.
    2.         Dim path As Encoding = Encoding.ASCII
    3.         Dim b As Byte() = path.GetBytes(TextBox1.Text.ToCharArray)
    4.         Dim aB As Byte() = Encoding.Convert(source, path, b)
    5.  
    6.         Console.WriteLine(path.GetString(aB))

    By the way can someone point us to somewhere we can get a list of encoding numbers for example I would have never guessed that 37 stands for EBCDIC.
    Thanks for this, the Encoding Namepace is now in my knowledge
    Using VS 2010 on Fw4.0

  7. #7
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: [RESOLVED] EBCDIC Question

    Zakary

    Would you mind posting the link wherw you found the equivalents of -1 -> J, -2 -> K etc.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  8. #8

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: [RESOLVED] EBCDIC Question

    Quote Originally Posted by Mr.No
    Zakary

    Would you mind posting the link wherw you found the equivalents of -1 -> J, -2 -> K etc.

    Hi Mr No!
    I've found it here
    http://www.discinterchange.com/TechT...d_fields_.html
    Using VS 2010 on Fw4.0

  9. #9
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: [RESOLVED] EBCDIC Question

    Thanks Zakary.

    Very interesting site indeed, it reminded me of my COBOL days some 8 years ago
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  10. #10

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: [RESOLVED] EBCDIC Question

    8 Year ago, I was a doing DbaseIII and Clipper in my case

    (Sigh) good old time... when beer and spending money was in the top of my priority hehehe
    Using VS 2010 on Fw4.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width