;----------------------------------------------------------------------------
; MODULE NAME: REXAMPLE.XH
;
; $Author: Dennis_Bareis $
; $Revision: 1.2 $
; $Date: 09 Sep 1999 13:29:16 $
; $Logfile: E:/DB/PVCS.IT/OS2/PPWIZARD/REXAMPLE.XHV $
;
; DESCRIPTION: Small example header file.
;
;----------------------------------------------------------------------------
/*
* $Header: E:/DB/PVCS.IT/OS2/PPWIZARD/REXAMPLE.XHV 1.2 09 Sep 1999 13:29:16 Dennis_Bareis $
*/
/*--- Skip past rexx routines -----------------------------------------------*/
#require 99.249
<?RexxSkip>
#ifdef INCL_AddCommasToDecimalNumber
/*===========================================================================*/
AddCommasToDecimalNumber: /* Integers Only! */
#ifdef Procedure
<$Procedure>
#endif
/*===========================================================================*/
/*--- Get number return it it we already have commas ---------------------*/
acNoComma = strip( arg(1) );
if pos(',', acNoComma) <> 0 then
return(acNoComma);
/*--- split at possible decimal point ------------------------------------*/
acDotPos = pos('.', acNoComma);
if acDotPos = 0 then
acAfterDecimal = '';
else
do
/*--- There is a decimal component -----------------------------------*/
if acDotPos = 1 then
return("0" || acNoComma);
acAfterDecimal = substr(acNoComma, acDotPos+1);
acNoComma = left(acNoComma, acDotPos-1);
end;
/*--- Reverse the integer ------------------------------------------------*/
acNoComma = reverse(acNoComma);
/*--- Grab 3 digits at a time --------------------------------------------*/
acResultWithCommas = "";
do while length(acNoComma) > 3
acResultWithCommas = acResultWithCommas || left(acNoComma, 3) || ',';
acNoComma = substr(acNoComma, 4);
end;
acResultWithCommas = acResultWithCommas || acNoComma;
/*--- Reverse the string and add decimal component -----------------------*/
acResultWithCommas = reverse(acResultWithCommas)
if acAfterDecimal <> '' then
acResultWithCommas = acResultWithCommas || '.' || acAfterDecimal;
return(acResultWithCommas);
#endif
#ifdef INCL_GetAmPmTime
/*===========================================================================*/
GetAmPmTime: /* Fixed length AM/PM time with seconds */
#ifdef Procedure
<$Procedure>
#endif
/*===========================================================================*/
gtCivilTime = time('C'); if length(gtCivilTime) = 6 then gtCivilTime=' 'gtCivilTime;
gtNumSeconds = ':'substr(time(), 7, 2);
return( insert(gtNumSeconds, gtCivilTime, 5) ); /* Insert # seconds */
#endif
#ifdef INCL_ReplaceString
/*===========================================================================*/
ReplaceString: /* Too tricky & limiting to set up as procedure */
/*===========================================================================*/
/*--- Get the passed parameters ------------------------------------------*/
rsString = arg(1);
rsChangeFrom = arg(2);
rsChangeTo = arg(3);
rsChangeCntVar = arg(4); /* Passed by reference! */
/*--- Look for the search string -----------------------------------------*/
rsChangeFromLength = length(rsChangeFrom);
rsChangeToLength = length(rsChangeTo);
rsFoundPosn = pos(rsChangeFrom, rsString);
rsChangesMade = 0;
do while rsFoundPosn <> 0
/*--- Perform the substitution ---------------------------------------*/
rsString = left(rsString, rsFoundPosn-1) || rsChangeTo || substr(rsString, rsFoundPosn+rsChangeFromLength);
/*--- Look for the more occurances of the search string --------------*/
rsFoundPosn = pos(rsChangeFrom, rsString, rsFoundPosn+rsChangeToLength);
rsChangesMade = rsChangesMade + 1;
end;
/*--- Update the change counter and return to the caller -----------------*/
if rsChangeCntVar <> "" then
interpret rsChangeCntVar || " = rsChangesMade + " || rsChangeCntVar;
return(rsString);
#endif
/*--- End of header file ----------------------------------------------------*/
<?RexxSkipTo>