Ob ich LIKE oder POSSTR verwende ist im Endeffekt egal!

Mit Like (inclusive Wildcards und unter Berücksichtigung der Sonderzeichen % und _) würde die Funktion wie folgt aussehen:
PHP-Code:
P Like            B                   Export

D Like            PI              A
D   PPText                   32740A   varying  
Const 
D   PPSearch                 32740A   varying  Const 
D   PPEscape                     1A            Const Options(*NoPass)  

D ParmEscape      C                   const(3

D  Found          S              1A                                        
 
*----------------------------------------------------------
C/EXEC SQL  Set Option SrtSeq = *LangIdShr                    
C
/End-EXEC                                                    

C                   
If        %Parms >= ParmEscape
C
/EXEC SQL
C
Set :Found    =  Case when :PPText like :PPSearch escape :PPEscape
C
+                       then '1' else '0' End
C
/END-EXEC
C                   
else
C/EXEC SQL
C
Set :Found    =  Case when :PPText like :PPSearch
C
+                       then '1' else '0' End
C
/END-EXEC
C                   
EndIf

C                   Return    Found
P Like            E 
Birgitta