Frank Frank 3 3 silver badges 3 3 bronze badges. The answer provided by Simon is the correct handling for these fields. The data we get may be a subset of what you might get, so see if this works for you: using System; using System. Insert 0, "-" ; strAmount. Replace "A", "1" ; strAmount.
Replace "J", "1" ; strAmount. Replace "B", "2" ; strAmount. Replace "K", "2" ; strAmount. Replace "C", "3" ; strAmount. Replace "L", "3" ; strAmount. Replace "D", "4" ; strAmount. Replace "M", "4" ; strAmount. Replace "E", "5" ; strAmount.
Replace "N", "5" ; strAmount. Replace "F", "6" ; strAmount. Replace "O", "6" ; strAmount. Replace "G", "7" ; strAmount. Replace "P", "7" ; strAmount. Replace "H", "8" ; strAmount.
Replace "Q", "8" ; strAmount. Replace "I", "9" ; strAmount. TryParse strAmount. Simon Chadwick Simon Chadwick 1, 6 6 silver badges 12 12 bronze badges. Parse num, NumberStyles. AllowLeadingWhite NumberStyles. AllowTrailingWhite ;. This library is all most users will need. More details are provided below. A test program This is a console application built from a single C source file and requiring the library described above. Currently it just displays the encoded version of "hello" and then decodes it.
The encoding library is very simple to use, as the encoding class JonSkeet. EbcdicEncoding is a subclass of the standard. NET System. Encoding class. To obtain an instance of the appropriate encoding, use EbcdicEncoding. You can find out the list of names of available encodings using the EbcdicEncoding. AddRange currentFieldTemplateProps. RepeatCount; if parentFieldTemplate! ParentHierarchy ; childNodeFieldTemplate. Name, node. ToString ; if x!
Value; else if tmpAttr. ToString " 00" ; fields. Unpacking Packed field not working Member Nov Not sure what is going on here but I have a 1 byte packed field.
The packed value has , which is 0xC1. The Unpack code is looking at the first nibble for the sign, but it appears to be in the second left hand nibble. It tries to return the C 12 as the value for the byte. Any ideas what is wrong here? Here's my field template: lineTemplate. Packed, , 1 ; And yes, all my other packed fields are showing the same issue.
Thanks for any help here. I think you have a problem with the source packed bytes packed fields are not generated correctly. To confirm it, look at your parsed packed field in HEX Base Here's what you should see: for example, packed number in HEX is "C.
If you remove dashes, you can actually see "" number followed by "C". If you can't fix the source, you might have to write custom parser convert to hex, than do string manipulation. Re: Unpacking Packed field not working Member Nov Actually, it turns out that the fields I thought were packed were not, but just Numeric Strings.
However, I did find what appears to be a problem with one byte numeric strings in the ConvertEbcdicNumericString method. In the signed integer section of the switch block, my one byte hex C1 converted to the temp string "A". However, the Regex. IsMatch did not catch this: else if Regex. I was able to correct it using the following: else if Regex. Oh, I see Saved me some work, boss.
I'm sure if there's a better way, somebody will chime in. Worked for me, though. Thanks again! How do I use this API?
How do I actually use this conversion tool, or call this API? I downloaded and unzipped the file, but I have no idea what to do with it at this point. Forgive me for being an idiot! I'm a mainframe dinosaur. To begin with, you need Visual Studio. It will allow you to open a project Ebcdic2Ascii. Inside that project you'll find Program. It's an entry point to your program.
Do you know how to code in C? What are you trying to achieve? Max, thanks for the reply. Yes, I've got a copy of Visual Studio, but I have not really used it before.
Already a Member? Join your peers on the Internet's largest technical computer professional community. It's easy to join and it's free. Register now while it's still free! Already a member? Close this window and log in. Join Us Close.
0コメント