View Full Version : Char to ASCII
Guest.Visitor
09-12-2002, 08:44 PM
For converting EBCDIC to ASCII, you can use this (thanks Hans): <pre> D ch s 1a Inz('9') D ds D ucschar 1c D ucslow 3u 0 C Eval ucschar = %ucs2(ch)</pre> Chris
Guest.Visitor
09-13-2002, 04:56 AM
I'll try that, many thanks. Sky
Guest.Visitor
09-13-2002, 09:13 AM
Just a caveat: this technique works for the ASCII characters whose base 10 value is 32 to 126 (blank to ~) . Chris
Guest.Visitor
09-13-2002, 09:39 AM
I tried doing that in my program but it seems that its not doing anything. this is the scenario, I have a string "ARZ12345" and I have to get the ASCII value of each characters in that string. I this case A=65, R=82, Z=90, 1=49, 2=50, 3=51, 4=52 and 5=53. Then sum all the ascii values (65+82+90+49+50+51+52+53) now I want to get that values in RPGIV. Or, Is there an API that handles this? Thanks A lot. Sky
Guest.Visitor
09-13-2002, 10:31 AM
Chris, Well, I have solved my problem. I think you have missed putting the overlay on the data structure and when I added it I get the value I need. But I really appreciate the time and the idea you gave me. NOw I can move on and hopefully wraps up my applications. Thanks again Sky
Guest.Visitor
09-13-2002, 12:14 PM
Hi to everyone, I have a project that involved barcoding. I was given a formula to get the check digits (at the end of barcode) doing some calculations. However I need to convert characters to ASCII to do the calculations. Is anybody here have done or have any Idea about converting character to ASCII. eg 0 to 9 equal chr(48) to chr(57), or on keyboard alt + 48 = 0, alt+49=1 ... so on. I hope everythings clear. Thanks in Advance Sky,
Guest.Visitor
09-13-2002, 12:14 PM
Yes, I missed the overlay, sorry. <pre> D MyDs ds D UcsChar 1c D UcsLow 3u 0 Overlay(UcsChar:2)</pre> Just add up the UcsLow values as you step through the string. Chris
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.