ebcdic

How to read EBCDIC data with a non standard codepage, and not mess up numbers?

那年仲夏 提交于 2019-12-01 09:38:35
问题 Here is one for the old(er) hands :-) I'm reading a binary dump from a mainframe DB2 table. The table has varchar, char, smallint, integer and float columns. To make it interesting, the DB2 uses code page 424 (Hebrew). I need my code to be codepage independent. So I open the file with a streamreader using System.Text.Encoding like so: Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(20424) Dim sr As New StreamReader(item.Key, encoding) and proceed to read the VARCHAR

Java: Convert String to packed decimal

淺唱寂寞╮ 提交于 2019-11-30 14:48:22
new here! Situation: I'm working on a project which needs to communicate with an AS/400 server. My task is to basically handle the requests which will be sent to the AS/400 server. To do this, all the user input should be in EDCDIC bytes. Problem: I have managed to convert packed decimals to String with the code below, found on this forum : public class PackedDecimal { public static long parse(byte[] pdIn) throws Exception { // Convert packed decimal to long final int PlusSign = 0x0C; // Plus sign final int MinusSign = 0x0D; // Minus final int NoSign = 0x0F; // Unsigned final int DropHO = 0xFF

Java: Convert String to packed decimal

谁都会走 提交于 2019-11-29 21:11:59
问题 new here! Situation: I'm working on a project which needs to communicate with an AS/400 server. My task is to basically handle the requests which will be sent to the AS/400 server. To do this, all the user input should be in EDCDIC bytes. Problem: I have managed to convert packed decimals to String with the code below, found on this forum: public class PackedDecimal { public static long parse(byte[] pdIn) throws Exception { // Convert packed decimal to long final int PlusSign = 0x0C; // Plus

Java comparator for String in EBCDIC encoding

戏子无情 提交于 2019-11-29 11:16:49
I have come across a requirement where I need to convert a string to EBCDIC encoding and then sort it. We need to sort it with EBCDIC because the string has to go in mainframe. The string I will sort will have only alphabets in captial and integers only. I googled it some and then I came across the link from IBM which has listed the characters in order What I realized was that EBCDIC sorting is exactly opposite to normal java lexicographic sorting (at least for the type of data which I am going to process). My question is my realization right ? If not what I am missing ? OR is there any java

Character set that is not a superset of ASCII

青春壹個敷衍的年華 提交于 2019-11-29 09:50:37
Is there a character set other than EBCDIC that is not a superset of 7-bit ASCII? Yes. JIS X 0208 is not a superset of ASCII. Some versions of this standard include most of the ASCII characters, but not all of them. A related fact is that a file encoded with UTF-16 or UTF-32 is not byte-equivalent to an ASCII file of the same characters, but since those are not character sets, and since Unicode is certainly a superset of ASCII, they do not qualify as answers to your question. There were some ISO 646 derivatives that were basically ASCII, but replaced various punctuation marks with various

Converting EBCDIC to ASCII in java

本秂侑毒 提交于 2019-11-29 05:52:19
I am supposed to convert an EBCDIC file to ASCII by using Java. So far I have this code: public class Migration { InputStreamReader reader; StringBuilder builder; public Migration(){ try { reader = new InputStreamReader(new FileInputStream("C:\\TI3\\Legacy Systemen\\Week 3\\Oefening 3\\inputfile.dat"), java.nio.charset.Charset.forName("ibm500") ); } catch(FileNotFoundException e){ e.printStackTrace(); } builder = new StringBuilder(); } public void read() throws IOException { int theInt; while((theInt = reader.read()) != -1){ char theChar = (char) theInt; builder.append(theChar); } reader.close

Convert Mainframe Binary to Ascii Using any Open Source Code or Tool

一世执手 提交于 2019-11-28 10:27:14
How can I convert a mainframe binary file (EBCDIC) having cobol copybook as record layout information to ASCII file by keeping in mind regarding the packed and zoned decimal format using any Java API or Open source tool? Reading in Java If you want to Read Mainframe Cobol Files in java, have a look at JRecord - You will have to specify the charset (font). For US EBCDIC use CP037. Legstar - Have variety of Mainframe - Cobol Tools CB2java - Has not been updated in a while (not supported any more and has problems) Also the RecordEditor will let you view / Edit Mainframe Cobol Files Conversion

Java comparator for String in EBCDIC encoding

亡梦爱人 提交于 2019-11-28 04:45:28
问题 I have come across a requirement where I need to convert a string to EBCDIC encoding and then sort it. We need to sort it with EBCDIC because the string has to go in mainframe. The string I will sort will have only alphabets in captial and integers only. I googled it some and then I came across the link from IBM which has listed the characters in order What I realized was that EBCDIC sorting is exactly opposite to normal java lexicographic sorting (at least for the type of data which I am

Converting EBCDIC to ASCII in java

北城以北 提交于 2019-11-27 23:43:56
问题 I am supposed to convert an EBCDIC file to ASCII by using Java. So far I have this code: public class Migration { InputStreamReader reader; StringBuilder builder; public Migration(){ try { reader = new InputStreamReader(new FileInputStream("C:\\TI3\\Legacy Systemen\\Week 3\\Oefening 3\\inputfile.dat"), java.nio.charset.Charset.forName("ibm500") ); } catch(FileNotFoundException e){ e.printStackTrace(); } builder = new StringBuilder(); } public void read() throws IOException { int theInt; while

How to convert from EBCDIC to ASCII in C#.net

懵懂的女人 提交于 2019-11-27 23:02:48
I have a value in EBCDIC format "000000{". I want to convert it into a.Net Int32 type. Can anyone let me know what I can do about it?? So my question is given a string that contains a signed numeric in EBCDIC , what should I be doing to convert it into a .NET Int32. Thanks so much in advance! Try this #region public static byte[] ConvertAsciiToEbcdic(byte[] asciiData) public static byte[] ConvertAsciiToEbcdic(byte[] asciiData) { // Create two different encodings. Encoding ascii = Encoding.ASCII; Encoding ebcdic = Encoding.GetEncoding("IBM037"); //Retutn Ebcdic Data return Encoding.Convert