Character replace in Quiz

Robert Mills robert.mills@windsong-services.co.uk
Thu, 6 Jan 2005 15:57:35 -0000


This is a multi-part message in MIME format.

------_=_NextPart_001_01C4F408.70627A3B
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Michael,
=20
Had thought of that method but decided that it was VERY inefficient. It =
could also be dangerous if I did not cater for enough semi-colons (see =
my previous post). To be on the safe side I'd need to allow for the =
field to be full of semi-colons. Therefore, 60 defines would be needed =
for the field in question (only a char*30). As the program is extracting =
approx 350,000 records each time that works out to 21,000,000 define =
evaluations per run. As I said 'VERY inefficient'. Still think I'll stay =
with Dave's solution.
=20
regards,=20
 =20
Robert W.Mills=20
Systems Development Manager=20
Windsong Services=20
(020) 8309 3604=20

-----Original Message-----
From: Michael Lee [mailto:Michael.Lee@mclsystemsinc.com]
Sent: 06 January 2005 15:44
To: Robert Mills
Cc: PowerHouse Mail List (E-mail)
Subject: Re: Character replace in Quiz


Hi Robert,

Or one could use Powerhouse and the INDEX function as follows:

DEFINE t_IDX1 =3D INDEX(field_in_question,";")
DEFINE t_NEW1 char*40 =3D field_in_question[1:t_idx1 -1] + =
field_in_question[t_idx1 + 1] &
              if t_IDX1 <> 0 else field_in_question
DEFINE t_IDX2 =3D INDEX(t_NEW1,";")
DEFINE t_NEW2 char*40 =3D t_NEW1[1:t_idx2 -1] + t_NEW1[t_idx2 +1] &=20
               if t_IDX2 <> 0 else t_NEW1 if t_IDX1 <> 0 else =
field_in_question
DEFINE t_IDX3 =3D INDEX(t_NEW2,";")
DEFINE t_NEW3 char*40 =3D t_NEW2[1:t_idx3 -1] + t_NEW2[t_idx3 +1] &=20
               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,
=20
Cool (as my son would say). Had never thought of this method. Can think =
of several other uses for this.
=20
regards,=20
 =20
Robert W.Mills=20
Systems Development Manager=20
Windsong Services=20
(020) 8309 3604=20

-----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
=20
Use MPE system functions to do it for you...
=20
In your quiz...
=20
define D-REPLACE char*50 =3D '![repl("' + NAME + '",";"," ")]'
define D-NAME char*30 =3D getsystemval("D_REPL") if =
setsystemval("D_REPL",D-REPLACE)

Where NAME is your source field and D-NAME is the result.
=20
Regards
Dave Knox
=20

-----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,=20

Environment: Quiz 8.39.C running on MPE/iX 6.5=20

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,=20
 =20
Robert W.Mills=20
Systems Development Manager=20
Windsong Services=20
(020) 8309 3604=20


------_=_NextPart_001_01C4F408.70627A3B
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE></TITLE>

<META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><SPAN class=3D593134615-06012005><FONT face=3D"Comic Sans MS" =
color=3D#0000ff=20
size=3D2>Hi Michael,</FONT></SPAN></DIV>
<DIV><SPAN class=3D593134615-06012005><FONT face=3D"Comic Sans MS" =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D593134615-06012005><FONT face=3D"Comic Sans MS" =
color=3D#0000ff=20
size=3D2>Had thought of that method but decided that it was VERY =
inefficient. It=20
could also be dangerous if I did not cater for enough semi-colons (see =
my=20
previous post). To be on the safe side I'd need to allow for the field =
to be=20
full of semi-colons. Therefore,&nbsp;</FONT></SPAN><SPAN=20
class=3D593134615-06012005><FONT face=3D"Comic Sans MS" color=3D#0000ff =
size=3D2>60=20
defines would be needed&nbsp;for the field in question (only a char*30). =
As the=20
program is extracting approx 350,000 records each time that works out to =

21,000,000 define evaluations per run. As I said 'VERY inefficient'. =
Still think=20
I'll stay with Dave's solution.</FONT></SPAN></DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS" size=3D2>regards,</FONT> <BR><FONT=20
face=3DArial>&nbsp;</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>Robert=20
W.Mills</FONT> <BR><FONT face=3D"Comic Sans MS" size=3D2>Systems =
Development=20
Manager</FONT> <BR><FONT face=3D"Comic Sans MS" size=3D2>Windsong =
Services</FONT>=20
<BR><FONT face=3D"Comic Sans MS" size=3D2>(0</FONT><FONT face=3D"Comic =
Sans MS"=20
size=3D2>20</FONT><FONT face=3D"Comic Sans MS" size=3D2>)</FONT> <FONT=20
face=3D"Comic Sans MS" size=3D2>8309 3604</FONT> </DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Michael Lee=20
  [mailto:Michael.Lee@mclsystemsinc.com]<BR><B>Sent:</B> 06 January 2005 =

  15:44<BR><B>To:</B> Robert Mills<BR><B>Cc:</B> PowerHouse Mail List=20
  (E-mail)<BR><B>Subject:</B> Re: Character replace in=20
  Quiz<BR><BR></FONT></DIV>Hi Robert,<BR><BR>Or one could use Powerhouse =
and the=20
  INDEX function as follows:<BR><BR>DEFINE t_IDX1 =3D=20
  INDEX(field_in_question,";")<BR>DEFINE t_NEW1 char*40 =3D=20
  field_in_question[1:t_idx1 -1] + field_in_question[t_idx1 + 1]=20
  =
&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
  if t_IDX1 &lt;&gt; 0 else field_in_question<BR>DEFINE t_IDX2 =3D=20
  INDEX(t_NEW1,";")<BR>DEFINE t_NEW2 char*40 =3D t_NEW1[1:t_idx2 -1] +=20
  t_NEW1[t_idx2 +1] &amp;=20
  =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
  if t_IDX2 &lt;&gt; 0 else t_NEW1 if t_IDX1 &lt;&gt; 0 else=20
  field_in_question<BR>DEFINE t_IDX3 =3D INDEX(t_NEW2,";")<BR>DEFINE =
t_NEW3=20
  char*40 =3D t_NEW2[1:t_idx3 -1] + t_NEW2[t_idx3 +1] &amp;=20
  =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
  if t_IDX3 &lt;&gt; 0 else t_NEW2 if t_IDX2 &lt;&gt; 0=20
  &amp;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;=20
  else t_NEW1 if t_IDX1 &lt;&gt; 0 else =
field_in_question<BR>etc.<BR><BR><BR>I=20
  don't know how efficient this method is but it's tried and=20
  true.<BR><BR><BR>Regards,<BR><BR>Michael Lee<BR>MCL Systems=20
  Inc.<BR><BR><BR>Robert Mills wrote:<BR>
  <BLOCKQUOTE =
cite=3Dmid08F03A7FCBC8AD4AAB87773F25282729A2392A@whgexh01.whgl.co.uk=20
  type=3D"cite">
    <META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR>
    <DIV><FONT face=3D"Comic Sans MS" color=3D#0000ff size=3D2><SPAN=20
    class=3D328504210-06012005>Dave,</SPAN></FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3D"Comic Sans MS" color=3D#0000ff size=3D2><SPAN=20
    class=3D328504210-06012005>Cool (as my son would say). Had never =
thought of=20
    this method. Can think of several other uses for =
this.</SPAN></FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3D"Comic Sans MS" size=3D2>regards,</FONT> <BR><FONT =

    face=3DArial>&nbsp;</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>Robert=20
    W.Mills</FONT> <BR><FONT face=3D"Comic Sans MS" size=3D2>Systems =
Development=20
    Manager</FONT> <BR><FONT face=3D"Comic Sans MS" size=3D2>Windsong=20
    Services</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>(0</FONT><FONT=20
    face=3D"Comic Sans MS" size=3D2>20</FONT><FONT face=3D"Comic Sans =
MS"=20
    size=3D2>)</FONT> <FONT face=3D"Comic Sans MS" size=3D2>8309 =
3604</FONT> </DIV>
    <BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
      <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
      size=3D2>-----Original Message-----<BR><B>From:</B> Knox, Dave =
(Dallas, CSC)=20
      [<A class=3Dmoz-txt-link-freetext=20
      =
href=3D"mailto:KnoxDa01@unisourcelink.com">mailto:KnoxDa01@unisourcelink.=
com</A>]<BR><B>Sent:</B>=20
      05 January 2005 18:46<BR><B>To:</B> Robert Mills; PowerHouse Mail =
List=20
      (E-mail)<BR><B>Subject:</B> RE: Character replace in=20
      Quiz<BR><BR></FONT></DIV>
      <DIV><SPAN class=3D102072618-05012005><FONT face=3DArial =
color=3D#0000ff=20
      size=3D2>Robert</FONT></SPAN></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><SPAN class=3D102072618-05012005><FONT face=3DArial =
color=3D#0000ff=20
      size=3D2>Use MPE system functions to do it for =
you...</FONT></SPAN></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><SPAN class=3D102072618-05012005><FONT face=3DArial =
color=3D#0000ff=20
      size=3D2>In your quiz...</FONT></SPAN></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3Dr_ansi color=3D#0000ff size=3D2>define D-REPLACE =
char*50=20
      =3D<SPAN class=3D102072618-05012005> '![repl("' + NAME + '",";","=20
      ")]'</SPAN><BR></FONT><FONT face=3Dr_ansi color=3D#0000ff =
size=3D2>define D-NAME=20
      char*30 =3D getsystemval("D_REPL")&nbsp;if=20
      setsystemval("D_REPL",D-REPLACE)<BR></FONT></DIV>
      <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
      class=3D102072618-05012005>Where NAME is your source field and =
D-NAME is the=20
      result.</SPAN></FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
      class=3D102072618-05012005>Regards</SPAN></FONT></DIV>
      <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
      class=3D102072618-05012005>Dave Knox</SPAN></FONT></DIV>
      <DIV>&nbsp;</DIV>
      <BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
        <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
        face=3DTahoma size=3D2>-----Original =
Message-----<BR><B>From:</B> <A=20
        class=3Dmoz-txt-link-abbreviated=20
        =
href=3D"mailto:powerh-l-admin@lists.sowder.com">powerh-l-admin@lists.sowd=
er.com</A>=20
        [<A class=3Dmoz-txt-link-freetext=20
        =
href=3D"mailto:powerh-l-admin@lists.sowder.com">mailto:powerh-l-admin@lis=
ts.sowder.com</A>]=20
        <B>On Behalf Of </B>Robert Mills<BR><B>Sent:</B> Wednesday, =
January 05,=20
        2005 12:06 PM<BR><B>To:</B> PowerHouse Mail List=20
        (E-mail)<BR><B>Subject:</B> Character replace in=20
        Quiz<BR><BR></FONT></DIV><!-- Converted from text/rtf format -->
        <P><FONT face=3D"Comic Sans MS" size=3D2>Greetings to the =
-L,</FONT> </P>
        <P><FONT face=3D"Comic Sans MS" size=3D2>Environment: Quiz =
8.39.C running on=20
        MPE/iX 6.5</FONT> </P>
        <P><FONT face=3D"Comic Sans MS" size=3D2>I have a char*30 source =
field that=20
        may contain any number of semi-colons which I need to replace =
with=20
        spaces. Any advice on the most efficient way of doing =
this?</FONT></P>
        <P><FONT face=3D"Comic Sans MS" size=3D2>regards,</FONT> =
<BR><FONT=20
        face=3DArial>&nbsp;</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>Robert=20
        W.Mills</FONT> <BR><FONT face=3D"Comic Sans MS" size=3D2>Systems =
Development=20
        Manager</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>Windsong=20
        Services</FONT> <BR><FONT face=3D"Comic Sans MS" =
size=3D2>(0</FONT><SPAN=20
        lang=3Den-gb><FONT face=3D"Comic Sans MS" =
size=3D2>20</FONT></SPAN><SPAN=20
        lang=3Den-us><FONT face=3D"Comic Sans MS" =
size=3D2>)</FONT></SPAN><SPAN=20
        lang=3Den-gb> <FONT face=3D"Comic Sans MS" size=3D2>8309 =
3604</FONT></SPAN>=20
        =
</P></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C4F408.70627A3B--