I have been asked to post this to the list:
Robert Schlosser _ MPE-CSM
Ochsner Health Plan
(504) 219-8134
I have a need to scan several lines of JCL some of which may include either single or double quotes, and some of which may not appear in pairs. The commonest example being the appearance of an apostrophe. THis can be made to work provided it is
not, itself, in a string delimited by double quotes.
The problem is that any of the standard ways of cleaning up a line before processing it don't work! Things I've tried include:
setvar s "Here's an example of a string with a single quote in it! "
echo !s
setvar s3 repl(!s,"'"," ") These work fine for a string with ONLY a single instance of a single quote - we can use the double quotes to surround it.
However, put it in a pair of double quotes, and it doesn't work! (Similarly for any line with both types of quotes!)
setvar s3 '"'+"!s"+'"'
calc pos(!s3,"'") returns 0, rather than 6!
calc pos("!s3","'") has unmatched quotes
calc pos('!s3',"'") has unmatched quotes, and so on!
Now - granted the number of times this is likely to happen is very small, but I have no way of knowning prior to testing, if a line will contain single quotes or double quotes and in what sort of combination.
Bottom line question is - how can I safely process any combination and sequence of single and double quotes in a string, using the only MPE parsing functions?
Tony Furnivall
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|