This is problably RPG IV "101", but how do I set a field called field_1 and intialize the value to be ' ? (single Apostrophe) For example, like this (although this does not work): d field_1 s 1 inz(''') Thanks
This is problably RPG IV "101", but how do I set a field called field_1 and intialize the value to be ' ? (single Apostrophe) For example, like this (although this does not work): d field_1 s 1 inz(''') Thanks
Add one more '. D x s 1 inz('''') I have never understood this! HTH, Joe
You could probably initialize the field with the hex value of '. I'm not sure what hex code that is though.
Don't know if RPG can deal with Hex but a quote is Hex'7D' bobh
Joe, You're right, it does seem weird, but the concept is that inside of single quotes, it takes 2 single quotes to make 1. '(''for what it''s worth'')' = ('for what it's worth') Kevin
This works as well using the hex code: D Field_1 S 1A Inz(x'7D')
Dave, You could probably initialize the field with the hex value of ' Indeed you could, and as Bob points out you could try x7D. But there is a downside to doing it this way: if you ever have to deal with various code pages for multinational support or translation (who knows who will buy the company?), using the hex constant will not necessarily translate correctly. Using a constant of '''' (four single quotes) will translate to a single quote in other pages, regardless of what hex value that turns out to be. Since RPG only allows the single quote as a string constant delimiter, embedded single quotes as in o'clock must be doubled so the language parser knows it was intentional rather than an error. Thus o'clock becomes o''clock or 'o''clock' as a string constant. Remove the letters and what remains are four single quotes. Looks weird to someone who hasn't seen it before, but then so does RPG.Doug
Thanks to all for your help
Looks weird to someone who hasn't seen it before, but then so does RPG.D oug W hy(do) y o u S aytha t:'?'
Doug is right barbara. Its weired for rpg when it sees a " ' " somewhere inbetween the string. How will it interpret the " ' " as part of the string or end of " ' ". Isn't it weired for RPG?? Elan