Character replace in Quiz
Michael Lee
Michael.Lee@mclsystemsinc.com
Thu, 06 Jan 2005 07:43:49 -0800
This is a multi-part message in MIME format.
--------------030105060509060301000800
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi Robert,
Or one could use Powerhouse and the INDEX function as follows:
DEFINE t_IDX1 = INDEX(field_in_question,";")
DEFINE t_NEW1 char*40 = field_in_question[1:t_idx1 -1] +
field_in_question[t_idx1 + 1] &
if t_IDX1 <> 0 else field_in_question
DEFINE t_IDX2 = INDEX(t_NEW1,";")
DEFINE t_NEW2 char*40 = t_NEW1[1:t_idx2 -1] + t_NEW1[t_idx2 +1] &
if t_IDX2 <> 0 else t_NEW1 if t_IDX1 <> 0 else
field_in_question
DEFINE t_IDX3 = INDEX(t_NEW2,";")
DEFINE t_NEW3 char*40 = t_NEW2[1:t_idx3 -1] + t_NEW2[t_idx3 +1] &
if t_IDX3 <> 0 else t_NEW2 if t_IDX2 <> 0 &
else t_NEW1 if t_IDX1 <> 0 else field_in_question
etc.
I don't know how efficient this method is but it's tried and true.
Regards,
Michael Lee
MCL Systems Inc.
Robert Mills wrote:
> Dave,
>
> Cool (as my son would say). Had never thought of this method. Can
> think of several other uses for this.
>
> regards,
>
> Robert W.Mills
> Systems Development Manager
> Windsong Services
> (020) 8309 3604
>
> -----Original Message-----
> From: Knox, Dave (Dallas, CSC) [mailto:KnoxDa01@unisourcelink.com]
> Sent: 05 January 2005 18:46
> To: Robert Mills; PowerHouse Mail List (E-mail)
> Subject: RE: Character replace in Quiz
>
> Robert
>
> Use MPE system functions to do it for you...
>
> In your quiz...
>
> define D-REPLACE char*50 = '![repl("' + NAME + '",";"," ")]'
> define D-NAME char*30 = getsystemval("D_REPL") if
> setsystemval("D_REPL",D-REPLACE)
> Where NAME is your source field and D-NAME is the result.
>
> Regards
> Dave Knox
>
>
> -----Original Message-----
> From: powerh-l-admin@lists.sowder.com
> [mailto:powerh-l-admin@lists.sowder.com] On Behalf Of Robert Mills
> Sent: Wednesday, January 05, 2005 12:06 PM
> To: PowerHouse Mail List (E-mail)
> Subject: Character replace in Quiz
>
> Greetings to the -L,
>
> Environment: Quiz 8.39.C running on MPE/iX 6.5
>
> I have a char*30 source field that may contain any number of
> semi-colons which I need to replace with spaces. Any advice on
> the most efficient way of doing this?
>
> regards,
>
> Robert W.Mills
> Systems Development Manager
> Windsong Services
> (020) 8309 3604
>
--------------030105060509060301000800
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Robert,<br>
<br>
Or one could use Powerhouse and the INDEX function as follows:<br>
<br>
DEFINE t_IDX1 = INDEX(field_in_question,";")<br>
DEFINE t_NEW1 char*40 = field_in_question[1:t_idx1 -1] +
field_in_question[t_idx1 + 1] &<br>
if t_IDX1 <> 0 else field_in_question<br>
DEFINE t_IDX2 = INDEX(t_NEW1,";")<br>
DEFINE t_NEW2 char*40 = t_NEW1[1:t_idx2 -1] + t_NEW1[t_idx2 +1] & <br>
if t_IDX2 <> 0 else t_NEW1 if t_IDX1 <> 0
else field_in_question<br>
DEFINE t_IDX3 = INDEX(t_NEW2,";")<br>
DEFINE t_NEW3 char*40 = t_NEW2[1:t_idx3 -1] + t_NEW2[t_idx3 +1] & <br>
if t_IDX3 <> 0 else t_NEW2 if t_IDX2 <> 0
&<br>
else t_NEW1 if t_IDX1 <> 0 else field_in_question<br>
etc.<br>
<br>
<br>
I don't know how efficient this method is but it's tried and true.<br>
<br>
<br>
Regards,<br>
<br>
Michael Lee<br>
MCL Systems Inc.<br>
<br>
<br>
Robert Mills wrote:<br>
<blockquote type="cite"
cite="mid08F03A7FCBC8AD4AAB87773F25282729A2392A@whgexh01.whgl.co.uk">
<meta http-equiv="Content-Type" content="text/html; ">
<title>Message</title>
<meta content="MSHTML 6.00.2800.1476" name="GENERATOR">
<div><font face="Comic Sans MS" color="#0000ff" size="2"><span
class="328504210-06012005">Dave,</span></font></div>
<div> </div>
<div><font face="Comic Sans MS" color="#0000ff" size="2"><span
class="328504210-06012005">Cool (as my son would say). Had never
thought of this method. Can think of several other uses for this.</span></font></div>
<div> </div>
<div><font face="Comic Sans MS" size="2">regards,</font> <br>
<font face="Arial"> </font> <br>
<font face="Comic Sans MS" size="2">Robert W.Mills</font> <br>
<font face="Comic Sans MS" size="2">Systems Development Manager</font>
<br>
<font face="Comic Sans MS" size="2">Windsong Services</font> <br>
<font face="Comic Sans MS" size="2">(0</font><font
face="Comic Sans MS" size="2">20</font><font face="Comic Sans MS"
size="2">)</font> <font face="Comic Sans MS" size="2">8309 3604</font>
</div>
<blockquote dir="ltr" style="margin-right: 0px;">
<div class="OutlookMessageHeader" dir="ltr" align="left"><font
face="Tahoma" size="2">-----Original Message-----<br>
<b>From:</b> Knox, Dave (Dallas, CSC)
[<a class="moz-txt-link-freetext" href="mailto:KnoxDa01@unisourcelink.com">mailto:KnoxDa01@unisourcelink.com</a>]<br>
<b>Sent:</b> 05 January 2005 18:46<br>
<b>To:</b> Robert Mills; PowerHouse Mail List (E-mail)<br>
<b>Subject:</b> RE: Character replace in Quiz<br>
<br>
</font></div>
<div><span class="102072618-05012005"><font face="Arial"
color="#0000ff" size="2">Robert</font></span></div>
<div> </div>
<div><span class="102072618-05012005"><font face="Arial"
color="#0000ff" size="2">Use MPE system functions to do it for you...</font></span></div>
<div> </div>
<div><span class="102072618-05012005"><font face="Arial"
color="#0000ff" size="2">In your quiz...</font></span></div>
<div> </div>
<div><font face="r_ansi" color="#0000ff" size="2">define D-REPLACE
char*50 =<span class="102072618-05012005"> '![repl("' + NAME + '",";","
")]'</span><br>
</font><font face="r_ansi" color="#0000ff" size="2">define D-NAME
char*30 = getsystemval("D_REPL") if setsystemval("D_REPL",D-REPLACE)<br>
</font></div>
<div><font face="Arial" color="#0000ff" size="2"><span
class="102072618-05012005">Where NAME is your source field and D-NAME
is the result.</span></font></div>
<div> </div>
<div><font face="Arial" color="#0000ff" size="2"><span
class="102072618-05012005">Regards</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span
class="102072618-05012005">Dave Knox</span></font></div>
<div> </div>
<blockquote dir="ltr" style="margin-right: 0px;">
<div class="OutlookMessageHeader" lang="en-us" dir="ltr"
align="left"><font face="Tahoma" size="2">-----Original Message-----<br>
<b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:powerh-l-admin@lists.sowder.com">powerh-l-admin@lists.sowder.com</a>
[<a class="moz-txt-link-freetext" href="mailto:powerh-l-admin@lists.sowder.com">mailto:powerh-l-admin@lists.sowder.com</a>] <b>On Behalf Of </b>Robert
Mills<br>
<b>Sent:</b> Wednesday, January 05, 2005 12:06 PM<br>
<b>To:</b> PowerHouse Mail List (E-mail)<br>
<b>Subject:</b> Character replace in Quiz<br>
<br>
</font></div>
<!-- Converted from text/rtf format -->
<p><font face="Comic Sans MS" size="2">Greetings to the -L,</font>
</p>
<p><font face="Comic Sans MS" size="2">Environment: Quiz 8.39.C
running on MPE/iX 6.5</font> </p>
<p><font face="Comic Sans MS" size="2">I have a char*30 source
field that may contain any number of semi-colons which I need to
replace with spaces. Any advice on the most efficient way of doing this?</font></p>
<p><font face="Comic Sans MS" size="2">regards,</font> <br>
<font face="Arial"> </font> <br>
<font face="Comic Sans MS" size="2">Robert W.Mills</font> <br>
<font face="Comic Sans MS" size="2">Systems Development Manager</font>
<br>
<font face="Comic Sans MS" size="2">Windsong Services</font> <br>
<font face="Comic Sans MS" size="2">(0</font><span lang="en-gb"><font
face="Comic Sans MS" size="2">20</font></span><span lang="en-us"><font
face="Comic Sans MS" size="2">)</font></span><span lang="en-gb"> <font
face="Comic Sans MS" size="2">8309 3604</font></span> </p>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>
--------------030105060509060301000800--