|
> > Is there a way to retrive the decimal and/or hex value of a character? > That's easy to do with a data structure. For example: D ds D char 1A D num 3U 0 overlay(char:1) Then, set char to whatever you want to get the numeric value for. c eval char = whatever the numeric value of that character will be in the "num" variable as soon as char is set. For example, if you set CHAR to a blank, then NUM will contain 64 (or hex 40, the EBCDIC value of a blank) > Can we scan the text in a record and check for special characters like > , line feed, carriage return? I think decimal values 32 thru 126 > represent valid/most widely used characters. 32-126 would be the most common range in ASCII, but the iSeries is primarily an EBCDIC machine. Presumably, your iSeries data has already been converted to EBCDIC? I guess, unsurprisingly, I don't know much about your application and how it works. If you're reading a file that's still in ASCII, you need to scan for the ASCII characters, if you're reading one that's in EBCDIC, you scan for the EBCDIC equivalents. The range of characters isn't so simple when working with EBCDIC, but it's certainly doable. > How can we retrieve the decimal value of the characters (dec value <32 > and >126)? Is there a way to identify these special characters while > reading a text record? You can get the value using the DS I've shown above, so as long as you know the numbers of the characters your scanning for, it's easy. Just loop through the "record" comparing each character to the ones you're looking for. > I need to take care of these special characters for an xml document upload. > Since we replace & with a & in xml document, all the special characters > need to be converted to xml standard so that the xml parser can read the > data. That should be easy to do. Personally, I'd keep the data in a stream file, and read it with automatic conversion from the file's codepage (possibly ASCII) to the iSeries' native codepage (probably EBCDIC) and then make your replacements in the native codepage. That way, if you need to deal with files that use different codepages (or CCSID, or whatever) it'll happen automatically simply by tagging the stream file with the correct codepage/ccsid. Surely, the XML parser doesn't keep the data in an iSeries DB2 "record-based" file, but uses stream files, yes? If you're not familiar with reading stream files in RPG, I've got a tutorial on my web site here: http://www.scottklement.com/rpg/ifs.html Good Luck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.