Subject: | |
From: | |
Reply To: | |
Date: | Fri, 7 Aug 1998 14:29:24 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
[log in to unmask] writes:
>
> I have an input text file that may or may not contain the characters ' or
> ". I need to take the input from that file and create a run statement as
> in the following:
>
> RUN ABC;INFO="passed input"
>
> If there is a " in the file, then the above fails. Somehow I need to strip
> out the ' or " characters.
Or double the characters so they are preserved when passed via INFO=.
MPEKX44C (current) or MPEKX76A (PP4) or MPEJXQ1 (original) give you the
QUOTE() CI function.
Thus you should be able to do:
RUN ABC;INFO="![QUOTE(passedinputvar)]"
From http://jazz.external.hp.com/papers/Communicator/5.5/mpejxq1.html#QUOTE:
QUOTE() - returns the input string with all quotemarks doubled. String
function.
Syntax: quote(str)
This new function scans str and doubles all single and double quote characters
found. This is useful when str is passed to CI
parameter that requires its own quotes, like an INFO= string, or a quoted
string value in the SETVAR command.
Examples:
calc QUOTE('abc"de""f')
abc""de""""f
calc QUOTE("xyz'z'y'")
xyz''z''y''
calc anyparm(abc'def"ghi)k)
abc'def"ghi)k
calc QUOTE(hpresult)
abc''def""ghi)k
setvar x quote('ab"c')
showvar x
X = ab""c
setvar x "!x"
showvar x
X = ab"c
The last example shows that the CI does quote folding in expressions, e.g.,
"ab""c" is folded to the string ab"c.
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support Voice: +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|
|
|