PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: REXAMPLE.XH[Next]: [CONTENTS]
\ -> Examples / Tips -> Rexx Preprocessing -> Rexx Example -> REXAMPLE.REX (generated output)

REXAMPLE.REX (generated output)

/*
 * Generator   : PPWIZARD version 01.059
 *             : FREE tool for Windows, OS/2, DOS and UNIX by Dennis Bareis (dbareis@labyrinth.net.au)
 *             : http://www.labyrinth.net.au/~dbareis/ppwizard.htm
 * Time        : Wednesday, 28 Feb 2001 5:45:26pm
 * Input File  : C:\DBAREIS\Projects\MultiOs\PPWIZARD\rexample.x
 * Output File : out\REXAMPLE.REX
 */

if arg(1)="!CheckSyntax!" then exit(21924)

/*
* $Header:   C:/DBAREIS/Projects.PVCS/MultiOs/PPWIZARD/rexample.x.pvcs   1.0   14 Dec 2000 19:45:24   Dennis  $
*/
/*
* $Header:   C:/DBAREIS/Projects.PVCS/MultiOs/PPWIZARD/rexample.xh.pvcs   1.0   14 Dec 2000 19:45:24   Dennis  $
*/
signal REXAMPLE_1

AddCommas2DecimalNumber:
procedure expose Variable1 Variable2
z1_NoComma = strip( arg(1) )
if  pos(',', z1_NoComma) <> 0 then
return(z1_NoComma)
z1_DotPos = pos('.', z1_NoComma)
if  z1_DotPos = 0 then
z1_AfterDecimal = ''
else
do
if  z1_DotPos = 1 then
return("0" || z1_NoComma)
z1_AfterDecimal = substr(z1_NoComma, z1_DotPos+1)
z1_NoComma      = left(z1_NoComma, z1_DotPos-1)
end
z1_NoComma = reverse(z1_NoComma)
z1_ResultWithCommas = ""
do  while length(z1_NoComma) > 3
z1_ResultWithCommas = z1_ResultWithCommas || left(z1_NoComma, 3) || ','
z1_NoComma          = substr(z1_NoComma, 4)
end
z1_ResultWithCommas = z1_ResultWithCommas || z1_NoComma
z1_ResultWithCommas = reverse(z1_ResultWithCommas)
if  z1_AfterDecimal <> '' then
z1_ResultWithCommas = z1_ResultWithCommas || '.' || z1_AfterDecimal
return(z1_ResultWithCommas)

StringReplace:
z2_String       = arg(1)
z2_ChangeFrom   = arg(2)
z2_ChangeTo     = arg(3)
z2_ChangeCntVar = arg(4)
z2_ChangeFromLength = length(z2_ChangeFrom)
z2_ChangeToLength   = length(z2_ChangeTo)
z2_FoundPosn        = pos(z2_ChangeFrom, z2_String)
z2_ChangesMade      = 0
do  while z2_FoundPosn <> 0
z2_String = left(z2_String, z2_FoundPosn-1) || z2_ChangeTo || substr(z2_String, z2_FoundPosn+z2_ChangeFromLength)
z2_FoundPosn = pos(z2_ChangeFrom, z2_String, z2_FoundPosn+z2_ChangeToLength)
z2_ChangesMade = z2_ChangesMade + 1
end
if  z2_ChangeCntVar <> "" then
interpret z2_ChangeCntVar || " = z2_ChangesMade + " || z2_ChangeCntVar
return(z2_String)

REXAMPLE_1:
Count  = 0
String = StringReplace('AAAA', 'A', 'B', "Count")
if Count = 0 then
say 'No Changes made'
else
say 'Count = ' || AddCommas2DecimalNumber(Count)
return(Count)


email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: REXAMPLE.XH


PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Sunday November 05 2017 at 10:00am