?
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
Medium Priority
?
52 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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