<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE>.hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Verdana
}
</STYLE>

<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY class=hmmessage>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>Peter, and all the rest of you Wise Powerhousers out 
there ....</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>What Peter is suggesting will work, although my style 
would be as follows (this works, I tested it):</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp; I put the value 
"1,234,567.89&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
" (note the trailing spaces) into a file named "g"</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp; cat g | sed 
's/,//g'</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>This converts the number 
wonderfully.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>One issue to watch with would be that this would strip 
ALL commas out of your input file and it's assuming that the records are 
delimited by a Carriage Return.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>I didn't attempt to do Peter's really slick looking 
Powerhouse code because I'm not sure what kind of overhead would be generated by 
placing this into Powerhouse.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=3><SPAN 
class=869074416-03092009>If there's an issue with other fields having commas 
that you don't want to kill, then awk code like this will 
work:</SPAN></FONT></DIV><FONT face=Arial><SPAN class=869074416-03092009>
<P dir=ltr align=left><FONT face=r_ansi color=#0000ff></FONT>&nbsp;</P>
<P dir=ltr align=left><FONT color=#0000ff size=3>cat g.awk</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>BEGIN { FS = "|"; OFS="|" 
}</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>{</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp; </SPAN>MFGP = ""</FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp; </SPAN>for (i=1; i&lt;= 20; 
++i)</FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>{</FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if ( 
substr($2,i,1) != "," &amp;&amp; substr($2,i,1) != " " )</FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>MFGP = MFGP toupper(substr($2,i,1))</FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>}</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>print $1, $2, $3, $4, " 
Re-formatted field 2 ", MFGP</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>}</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3></FONT>&nbsp;</P>
<P dir=ltr align=left><FONT color=#0000ff size=3></FONT>&nbsp;</P>
<P dir=ltr align=left><FONT><FONT color=#0000ff><FONT size=3><SPAN 
class=869074416-03092009>Here is our input file:</SPAN>&nbsp;cat 
/tmp/glw/g1</FONT></FONT></FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3>a text field, with commas, 
needs them|1,234,569.89 |1234|test</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3></FONT>&nbsp;</P>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3>So, we have 4 fields, delimited with pipes.&nbsp; Now, we process that 
through awk, being very careful to do our "comma processing" on the CORRECT 
field!</FONT></SPAN></P>
<P dir=ltr align=left><FONT size=3></FONT>&nbsp;</P>
<P dir=ltr align=left><FONT color=#0000ff size=3>cat /tmp/glw/g1|awk -f 
g.awk</FONT></P>
<P dir=ltr align=left><FONT color=#0000ff size=3></FONT>&nbsp;</P>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3>Gives the following result:</FONT></SPAN></P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <P><FONT color=#0000ff size=3>a text field, with commas, needs 
  them|1,234,569.89 |1234|test|Re-formatted field 2 |1234569.89</FONT></P>
  <P><FONT color=#0000ff size=3></FONT>&nbsp;</P></BLOCKQUOTE>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3>I know there's likely a more elegant way to strip the commas/spaces out, 
I'm a poor COBOL boy at heart, so I brute-forced it, but this WILL 
work.</FONT></SPAN></P>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3></FONT></SPAN>&nbsp;</P>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3>Unless, you happen to be one of those poor mortals doomed to spend your 
days toiling on something other than Unix .....</FONT></SPAN></P>
<P dir=ltr align=left><SPAN class=869074416-03092009><FONT color=#0000ff 
size=3></FONT></SPAN>&nbsp;</P>
<P dir=ltr align=left><SPAN class=869074416-03092009></SPAN>&nbsp;</P><SPAN 
class=869074416-03092009>
<P><FONT color=#0000ff size=3>Guy L. Werry<BR>Senior Systems Analyst<BR>Hudson 
Bay Mining &amp; Smelting Co., Limited.</FONT> </P></SPAN></SPAN></FONT>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
face=Tahoma><B>From:</B> Peter Bateman [mailto:peterbateman808@hotmail.com] 
<BR><B>Sent:</B> Thursday, September 03, 2009 11:35 AM<BR><B>To:</B> Guy Werry; 
PowerHouse List<BR><B>Subject:</B> RE: Formatting a number in PowerHouse - 
version 8.49.E<BR></FONT><BR></DIV>
<DIV></DIV>Hi all;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;Guy&nbsp;makes an interesting 
point.<BR>&nbsp;<BR>&nbsp;&nbsp; I think the following sed command would get rid 
of the comma<BR>&nbsp;&nbsp; in INNUM. Note the ` to cause the output from sed 
to be&nbsp;put in the variable.<BR>&nbsp;&nbsp; It has been awhile since I have 
coded UNIX scripts.&nbsp;Guy if you have access to <BR>&nbsp;&nbsp; an UNIX box 
please try it.<BR><BR>&gt; def INNUM char*20 = "1,234,567.89"<BR>&gt; <BR>&gt; 
def OUTNUM num = nconvert(lj(getsystemval("OUTVAR"))) * 1000 &amp;<BR>&gt; If 
setsystemval("OUTVAR",( "`<FONT face="Courier New">sed 's/,//g' &lt; echo " 
+</FONT><FONT face="Courier New">&nbsp;INMUM )&nbsp;</FONT>)<BR>&nbsp;<BR>&nbsp; 
<BR>&gt; Subject: RE: Formatting a number in PowerHouse - version 8.49.E<BR>&gt; 
Date: Wed, 2 Sep 2009 08:04:26 -0500<BR>&gt; From: guy.werry@hbms.ca<BR>&gt; To: 
powerh-l@lists.sowder.com<BR>&gt; <BR>&gt; The original post didn't specify what 
system they're running on. What<BR>&gt; about tools like Unix's awk or perhaps 
even Perl?<BR>&gt; I haven't attempted this at all, but I have used awk pretty 
often in the<BR>&gt; past for similar situations. It may well be smart enough to 
figure this<BR>&gt; field out for you.<BR>&gt; <BR>&gt; Guy L. Werry<BR>&gt; 
Senior Systems Analyst<BR>&gt; Hudson Bay Mining &amp; Smelting Co., Limited. 
<BR>&gt; <BR>&gt; -----Original Message-----<BR>&gt; From: 
powerh-l-bounces+guy.werry=hbms.ca@lists.sowder.com<BR>&gt; 
[mailto:powerh-l-bounces+guy.werry=hbms.ca@lists.sowder.com] On Behalf<BR>&gt; 
Of Knox, Dave (Carrollton, TX)<BR>&gt; Sent: Tuesday, September 01, 2009 12:41 
PM<BR>&gt; To: powerh-l@lists.sowder.com<BR>&gt; Subject: RE:Formatting a number 
in PowerHouse - version 8.49.E<BR>&gt; <BR>&gt; The almost fool proof solution 
(for HP3000 MPE at least).<BR>&gt; <BR>&gt; Just need to remove the commas. 
Using getsystemval/setsystemval and an<BR>&gt; MPE FUNCTION you can strip them 
out in one statement. No formatting<BR>&gt; control required, and all done in 
one statement. Any number of decimals<BR>&gt; (or none).<BR>&gt; <BR>&gt; def 
INNUM char*20 = "1,234,567.89"<BR>&gt; <BR>&gt; def OUTNUM num = 
nconvert(lj(getsystemval("OUTVAR"))) * 1000 &amp;<BR>&gt; If 
setsystemval("OUTVAR",'![repl("' + trunc(INNUM) + '",",","")]')<BR>&gt; <BR>&gt; 
;; the setsystemval is evaluated before the getsystemval is actioned.<BR>&gt; 
<BR>&gt; <BR>&gt; rep INNUM OUTNUM pic "^^^^^^^^^.^^^"<BR>&gt; go<BR>&gt; 
<BR>&gt; INNUM OUTNUM<BR>&gt; <BR>&gt; 1,234,567.89 1234567.890<BR>&gt; <BR>&gt; 
<BR>&gt; Caveat<BR>&gt; Matchpattern required if input data not 
trustworthy.<BR>&gt; TRAILING negatives can be a problem (flip to front if 
necessary)<BR>&gt; No idea if this works on other platforms!<BR>&gt; <BR>&gt; 
Regards<BR>&gt; Dave Knox<BR>&gt; <BR>&gt; 
----------------------------------------------------------------------<BR>&gt; 
<BR>&gt; Message: 1<BR>&gt; Date: Tue, 1 Sep 2009 12:56:34 -0400<BR>&gt; From: 
"Ken Langendock" &lt;ken.langendock@rogers.com&gt;<BR>&gt; Subject: RE: 
Formatting a number in PowerHouse - version 8.49.E<BR>&gt; To: 
&lt;powerh-l@lists.sowder.com&gt;<BR>&gt; Message-ID: 
&lt;001701ca2b25$2a577740$7f0665c0$@langendock@rogers.com&gt;<BR>&gt; 
Content-Type: text/plain; charset="us-ascii"<BR>&gt; <BR>&gt; There is no fool 
proof solution unless the string is exactly the same<BR>&gt; every time.and from 
what he said here, this is not the case.<BR>&gt; <BR>&gt; By using INDEX, this 
solution is relatively easy:<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; TEMP T-XAmount 
CHARACTER * 20<BR>&gt; <BR>&gt; ITEM T-XAmount = Field OF InputFile<BR>&gt; 
<BR>&gt; ; remove 1st ','<BR>&gt; <BR>&gt; ITEM T-XAmount = T-XAmount 
[INDEX(T-XAmount,',') + 1:20] &amp;<BR>&gt; <BR>&gt; IF 0 NE 
INDEX(T-XAmount,',') <BR>&gt; <BR>&gt; ; remove 2nd ','<BR>&gt; <BR>&gt; ITEM 
T-XAmount = T-XAmount [INDEX(T-XAmount,',') + 1:20] &amp;<BR>&gt; <BR>&gt; IF 0 
NE INDEX(T-XAmount,',') <BR>&gt; <BR>&gt; ; remove 3rd ','<BR>&gt; <BR>&gt; ITEM 
T-XAmount = T-XAmount [INDEX(T-XAmount,',') + 1:20] &amp;<BR>&gt; <BR>&gt; IF 0 
NE INDEX(T-XAmount,',') <BR>&gt; <BR>&gt; . etc.<BR>&gt; <BR>&gt; ITEM T-Amount 
= NCONVERT(T-XAmount)<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Ken<BR>&gt; <BR>&gt; 
<BR>&gt; <BR>&gt; From: 
powerh-l-bounces+ken.langendock=rogers.com@lists.sowder.com<BR>&gt; 
[mailto:powerh-l-bounces+ken.langendock=rogers.com@lists.sowder.com] On<BR>&gt; 
Behalf Of Lowe, Chuck J<BR>&gt; Sent: August 31, 2009 1:04 PM<BR>&gt; To: 
powerh-l@lists.sowder.com<BR>&gt; Subject: [Bulk] Formatting a number in 
PowerHouse - version 8.49.E<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; I have a file 
from an outside vendor. They are sending it pipe<BR>&gt; delimited "|", There is 
an amount field that is left justified. Is there<BR>&gt; anyway to take that 
character field and convert it to a numeric field<BR>&gt; without doing<BR>&gt; 
INDEX and bit extracts. Sometimes the field is 123.45 and sometimes<BR>&gt; 
3,123.45. I thought I could use the FORMATNUMBER function but that is<BR>&gt; 
for doing the opposite. <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; The vendor states 
they can not send it unformatted. <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Thanks in 
advance. <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Chuck Lowe Quest Diagnostics | Sr. 
Programmer/Analyst,SYS Billing<BR>&gt; System/Denver| 400 Egypt Rd. | West 
Norriton, PA 19403 USA | phone<BR>&gt; 610-650-6679| fax 610-650-2111 |<BR>&gt; 
&lt;mailto:Chuck.J.Lowe@questdiagnostics.com&gt;<BR>&gt; 
Chuck.J.Lowe@questdiagnostics.com<BR>&gt; | 
&lt;http://www.questdiagnostics.com/&gt; www.QuestDiagnostics.com<BR>&gt; 
<BR>&gt; Please think about resource conservation before you print this 
message<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; 
------------------------------------------<BR>&gt; The contents of this message, 
together with any attachments, are<BR>&gt; intended only for the use of the 
person(s) to which they are addressed<BR>&gt; and may contain confidential 
and/or privileged information. Further, any<BR>&gt; medical information herein 
is confidential and protected by law. It is<BR>&gt; unlawful for unauthorized 
persons to use, review, copy, disclose, or<BR>&gt; disseminate confidential 
medical information. If you are not the<BR>&gt; intended recipient, immediately 
advise the sender and delete this<BR>&gt; message and any attachments.<BR>&gt; 
Any distribution, or copying of this message, or any attachment, is<BR>&gt; 
prohibited.<BR>&gt; <BR>&gt; -------------- next part --------------<BR>&gt; An 
HTML attachment was scrubbed...<BR>&gt; URL:<BR>&gt; 
http://lists.sowder.com/pipermail/powerh-l/attachments/20090901/de04668f<BR>&gt; 
/attachment.html <BR>&gt; <BR>&gt; ------------------------------<BR>&gt; 
<BR>&gt; --<BR>&gt; = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
Mailing list:<BR>&gt; powerh-l@lists.sowder.com<BR>&gt; Subscribe: 
&amp;quot;subscribe&amp;quot; in message body to<BR>&gt; 
powerh-l-request@lists.sowder.com<BR>&gt; Unsubscribe: &amp;quot;unsubscribe 
&amp;lt;password&amp;gt;&amp;quot; in message body to<BR>&gt; 
powerh-l-request@lists.sowder.com<BR>&gt; 
http://lists.sowder.com/mailman/listinfo/powerh-l<BR>&gt; This list is closed, 
thus to post to the list you must be a subscriber.<BR>&gt; Add 
'site:lists.sowder.com powerh-l' to your search terms to search the<BR>&gt; list 
archive at Google.<BR>&gt; <BR>&gt; End of powerh-l Digest, Vol 52, Issue 
2<BR>&gt; ***************************************<BR>&gt; <BR>&gt; <BR>&gt; 
--<BR>&gt; = = = = = = = = = = = = = = = = = = = = = = = = = = = = Mailing 
list:<BR>&gt; powerh-l@lists.sowder.com<BR>&gt; Subscribe: 'subscribe' in 
message body to<BR>&gt; powerh-l-request@lists.sowder.com<BR>&gt; Unsubscribe: 
'unsubscribe &amp;lt;password&amp;gt;' in message body to<BR>&gt; 
powerh-l-request@lists.sowder.com<BR>&gt; 
http://lists.sowder.com/mailman/listinfo/powerh-l<BR>&gt; This list is closed, 
thus to post to the list you must be a subscriber.<BR>&gt; Add 
'site:lists.sowder.com powerh-l' to your search terms to search the<BR>&gt; list 
archive at Google.<BR>&gt; <BR>&gt; The information in this e-mail and any 
attachments is confidential and may be subject to legal professional privilege. 
It is intended solely for the attention and use of the named addressee(s). If 
you are not the intended recipient, or person responsible for delivering this 
information to the intended recipient, please notify the sender immediately. 
Unless you are the intended recipient or his/her representative you are not 
authorised to, and must not, read, copy, distribute, use or retain this message 
or any part of it.<BR>&gt; <BR>&gt; -- <BR>&gt; = = = = = = = = = = = = = = = = 
= = = = = = = = = = = =<BR>&gt; Mailing list: powerh-l@lists.sowder.com<BR>&gt; 
Subscribe: 'subscribe' in message body to 
powerh-l-request@lists.sowder.com<BR>&gt; Unsubscribe: 'unsubscribe 
&amp;lt;password&amp;gt;' in message body to 
powerh-l-request@lists.sowder.com<BR>&gt; 
http://lists.sowder.com/mailman/listinfo/powerh-l<BR>&gt; This list is closed, 
thus to post to the list you must be a subscriber.<BR>&gt; Add 
'site:lists.sowder.com powerh-l' to your search terms to search the list archive 
at Google.<BR><BR>
<HR>
Faster Hotmail access now on the new <A 
href="http://go.microsoft.com/?linkid=9677399" target=_new>MSN homepage.</A> 
The information in this e-mail and any attachments is confidential and may be subject to legal professional privilege. It is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or person responsible for delivering this information to the intended recipient, please notify the sender immediately. Unless you are the intended recipient or his/her representative you are not authorised to, and must not, read, copy, distribute, use or retain this message or any part of it.
</BODY></HTML>