Solved

Is there a statement in C# (using .Net Framework 4.0) that would convert an EBCDIC value to its DEC equivalent?

Posted on 2016-10-20
1
48 Views
Last Modified: 2016-10-24
I am writing a C# Console Application using VS2010 and .Net Framework 4.0.
I read a txt file as input.
I used the debugger to execute the following statement for 1 iteration of my application to read in the values for the 1st input record:

string[] readText = File.ReadAllLines(filePath, Encoding.UTF8);
           
            foreach (string s in readText)
            {
                Console.WriteLine(s);
            }

Then, from the Immediate Window, I executed the following query and got back the result:

? s[3]
38 '&'

Is there a statement I could issue in my C# application that would convert the EBCDIC value (which in this case is '&') into its DEC equivalent (which in this case is '80') ?

I see the translated values from "EBCDIC" to Dec in the following link:

http://www.longpelaexpertise.com/toolsCode.php
0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
JesterToo earned 500 total points
ID: 41853035
Have a look at the "Encoding" class in System.Text namespace.  The properties (there are several) of interest are probably "ASCII" and "Codepage".  I believe Codepage 037 is for EBCDIC.  The method to use in this class is "Convert".

If your EBCDIC data contains signed zoned decimal or packed decimal fields then you may need to handle them separately from the other potions of each record.  Blindly converting them from EBCDIC to ASCII will not result in correct values.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question