|
Armbruster, Tom wrote:
You don't need, nor should you use, double quotes in an SQL statement.
Here's how I declare the quote character:
d @Q c const(x'7D')
The constant '''' isn't a double quote. It's a single quote character.
I think '''' is a better way of coding a single quote character than x'7D'. '''' might seem strange to non-RPG programmers, but RPG programmers (and CL programmers) should know that a quote within a string has to be doubled up, to let the compiler know that it's not the end of the string.
string = 'Mary''s little lamb'; // "Mary's little lamb"
I don't like x'7D' because a) it's too fancy and b) it isn't correct in an non-EBCDIC environment. What RPG programmer cares about a non-EBCDIC environment? Other than VA RPG programmers, maybe nobody. But if we learned anything during y2k, we learned that code sometimes lasts orders of magnitude longer than its original coders expect. Maybe none of your code will ever been needed for a VA RPG application, and maybe any VA RPG programmer who reads your recommendation will know that x'7D' isn't correct, and maybe your code will never need to be ported to a non-EBCDIC environment. But maybe it will; you might as well avoid using techniques that are known to be non-portable, especially when a completely portable mechanism exists.
That's my x'7D' rant for 2008. Honest, until at least 2009, I'll sit on my hands when I see a recommendation for x'7D'. Cross and stamp and no erasies.
Apologies to Tom, for picking your post for my rant.
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.