Bruce,

First, thanks for using the correct Subject:.

Please try the following three examples and see what results you get.

-- Syntax:

   (SLOCP(TextNoteVarcharValue,string,occurrence))

   Locates the exact position of a given string and occurrence
   in a TEXT, NOTE or VARCHAR value.

-- Example 01:
   SET VARIABLE v1 VARCHAR = 'ABCDEABC_AB'
   SET VARIABLE vSLoc1 = (SLOCP(.v1,'AB',1))
   Resulting variable vSloc1 will return the integer value of 1.

-- Example 02:
   SET VARIABLE v1 VARCHAR = 'ABCDEABC_AB'
   SET VARIABLE vSLoc2 = (SLOCP(.v1,'AB',2))
   Resulting variable vSloc2 will return the integer value of 6.

   The above two examples will locate the exact position of a
   given string and occurrence. However, if you wish to find
   the LAST occurrence in the value of your string, use the "-1".

   Here's how:

-- Example 03:
   SET VARIABLE v1 VARCHAR = 'ABCDEABC_AB'
   SET VARIABLE vSLocLast = (SLOCP(.v1,'AB',-1))
   Resulting variable vSlocLast will return the integer value of 10.

Very Best R:egards,

Razzak.


Reply via email to