Results 1 to 4 of 4

Thread: Convert ebcdic file to ASCII

  1. #1
    Join Date
    Nov 2009
    Posts
    61

    Convert ebcdic file to ASCII

    Hello,

    I am having a small problem regarding the conversion of the ebcdic file. I need to convert the ebcdic file into the ASCII but don't know the code for the same. Is there any method available to the perform the conversion. I have heard about the add on for the conversion not sure that they are available in the market or not. So i need you help to solve my problem regarding the same. A help may be appreciated.

    Thank in advance.

  2. #2
    Join Date
    May 2008
    Posts
    4,831

    Re: Convert ebcdic file to ASCII

    Hi,
    I am forwarding you the code for the conversion of the ebcdic file into the ASCII. So just go through the code and find the solution of your problem.

    Code:
    Dim c As Integer = Asc(Inarray(I))
    Dim Inarray() As Char 
    Dim sign As Integer
    Dim R As Long
    For I As Integer = 0 To Inarray.length - 1
    {
    If I = Inarray.Length - 1 Then
       { If (c And &HF0) = &HD0 Then sign = -1 Else sign = 1
          End If
       } 
        c = Inarray()
        R = R * 10 + c
        Next
        R *= sign
    }

  3. #3
    Join Date
    Apr 2008
    Posts
    4,088

    Re: Convert ebcdic file to ASCII

    Here is the code for the conversion of the file.

    Code:
    public class FileConversion
    {
    public static void Main(string[] args)
    {
      if (args.Length != 2)
     {
       Console.WriteLine 
       ("Result: FileConversion<ebcdic(input)> <ascii(output)>");
        return;
     }
      string inputFile = args[0];
      string outputFile = args[1];
      Encoding inputEncoding = EbcdicEncoding.GetEncoding ("EBCDIC");
      Encoding outputEncoding = Encoding.ASCII;
      try
      {
        using (StreamReader inputReader = 
        new StreamReader (inputFile, inputEncoding))
        {
          using (StreamWriter outputWriter = 
          new StreamWriter (outputFile, false, outputEncoding))
         {
          char[] buffer = new char[8192];
          int len=0;
          while ( (len=inputReader.Read (buffer, 0, buffer.Length)) > 0)
         {
          outputWriter.Write (buffer, 0, len);
         }
         }
       }
    }
          
            catch (IOException e)
            {        }
    }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,139

    Re: Convert ebcdic file to ASCII

    Hi there,

    EBCDIC is an encoding introduced by the IBM, used for the mainframes. It is not the single character encoding as well as is a single-byte encoding. Each character in EBCDIC is encoded individually. It has two character which is known as shift out and shift in. These two character are used for the DBCS to make change between them .

    I hope now you know much about the EBCDIC.

Similar Threads

  1. Replies: 4
    Last Post: 04-04-2012, 01:12 AM
  2. Need software to convert .DBK file to MS EXCEL file
    By Eber in forum Windows Software
    Replies: 6
    Last Post: 26-08-2010, 07:48 PM
  3. How to convert Image To HTML Files With ASCII Characters
    By Francesca in forum Software Development
    Replies: 2
    Last Post: 26-03-2009, 11:26 PM
  4. How to convert a character to ASCII in C++?
    By RupaliP in forum Software Development
    Replies: 2
    Last Post: 18-02-2009, 12:03 AM
  5. Need to convert string to ascii values with C#
    By Shashikant in forum Software Development
    Replies: 2
    Last Post: 02-02-2009, 07:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,533,678.13958 seconds with 16 queries