Jim,
Just a point of interest.  Your "IF pkn_inputtext IS NULL" test
is not needed.  The value 0 (zero) is by "SET VAR pkn_stringlen
= (SLEN(.pkn_inputtext))" if "pkn_inputtext" is NULL.  In such
a case the WHILE test will not execute since "1 <= 0" is not true.
-- 
Jim Bentley
American Celiac Society
[EMAIL PROTECTED] - email
(973) 325-8837 voice
(973) 669-8808 Fax


---- Jim Limburg <[EMAIL PROTECTED]> wrote:
> Bill, Sami
> 
> I have been watching this thread with some interest.. I have
> yet to
> fool with stored procedures much, so I decided to look into
> what 
> you are talking about here... WOW... this is cool.
> 
> I debugged and modified your code like this:
> 
> *(
>    Return same string with all non-numeric characters removed
> 
>   (CALL KeepNum(TextValue))
> 
> To store this:
>   SET PROC KeepNum LOCK ON
>   PUT KeepNum.prc AS KeepNum +
>     pKN_InputText TEST (48) +
>     RETURN TEXT (48) +
>     'Strip non-numeric characters from a string'
> )
> CLEAR VAR MICRORIM_RETURN
> 
> SET VAR pkn_returntext TEXT = NULL
> IF pkn_inputtext IS NULL THEN
>   GOTO lbexit
> ELSE
>   SET VAR pkn_stringlen = (SLEN(.pkn_inputtext))
>   SET VAR pkn_counter = 1
>   WHILE pkn_counter <= pkn_stringlen THEN
>     SET VAR pkn_char = (SGET(.pkn_inputtext, 1, pkn_counter))
>     IF '0123456789' CONTAINS .pkn_char THEN
>       SET VAR pkn_returntext = (.pkn_returntext + .pkn_char)
>     ENDIF
>     SET VAR pkn_counter = (.pkn_counter + 1)
>   ENDWHILE
> ENDIF
> LABEL lbexit
> CLEAR VAR pkn_counter, pkn_stringlen, pkn_char
> 
> RETURN .pkn_returntext
> 
> 
> I hope you don't mind.. I think I will start using this a lot
> more.
> 
> Thank you for a great lesson
> 
> Jim Limburg
> 
> 
> --- Bill Downall <[EMAIL PROTECTED]> wrote:
> > Sami,
> > 
> > My apologies for expecting you to do the work for me.
> > 
> > Here.  Your job is the debugging. I didn't do that part yet.
> > 
> > With this, you should be able to:
> > 
> > SELECT COUNT(*) INTO vcount FROM table +
> >   WHERE (call KeepNum(columnname)) = .vtest
> > 
> > or even:
> > 
> >  UPDATE tablename +
> >   SET columnname = (CALL KeepNum(columnname)) +
> >   WHERE (columnname <> (CALL KeepNum(columnname))
> > 
> > Bill
> > =======================================
> > *(
> >      Return same string with all non-numeric characters removed
> > 
> >   (CALL KeepNum(TextValue))
> > 
> > To store this:
> >   SET PROC KeepNum LOCK ON
> >   PUT KeepNum.prc AS KeepNum +
> >     pKN_InputText TEST (48) +
> >     RETURN TEXT (48) +
> >     'Strip non-numeric characters from a string'
> > )
> > CLEAR VAR Microrim_Return
> > 
> > SET VAR pKN_ReturnText TEXT = NULL
> > IF pKN_InputText IS NULL THEN
> >   goto lbExit
> >   
> > SET VAR pKN_StringLen = (SLEN(.pKN_InputText))
> > SET VAR pKN_Counter = 1
> > WHILE pKN_Counter <= pKN_StringLen THEN
> >   SET VAR pKN_Char = (SGET(.pKN_InputText, 1, pKN_Counter))
> >   IF '0123456789' CONTAINS .pKN_Char THEN
> >     SET VAR pkn_ReturnText = (.pKN_ReturnText + .pKN_Char)
> >   ENDIF 
> >   SET VAR pKN_Counter = (.pKN_Counter + 1)
> > ENDWHILE    
> > 
> > LABEL lbExit
> > CLEAR VAR pKN_Counter, pKN_StringLen, pKN_Char
> > 
> > RETURN .pKN_REturnText
> > 
> >  ======================
> > 
> > 
> > On Tue, 11 Jun 2002 10:50:06 -0500, Sami Aaron wrote:
> > 
> > >I want to be able to issue the command:
> > >
> > >SELECT COUNT(*) INTO vcount FROM table WHERE (format
> > (columnname,something,
> > >something)) = .vtest.
> > >
> > >example:  SELECT COUNT(*) INTO vcount FROM table WHERE 
> > 00051334944 =
> > >00051334944
> > >
> > 
> > 
> > 
> > 
> > 
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: INTRO rbase-l
> > ================================================
> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: UNSUBSCRIBE rbase-l
> > ================================================
> > TO SEARCH ARCHIVES:
> > http://www.mail-archive.com/rbase-l%40sonetmail.com/
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
>  
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to