45 pts.
 Help with scan
Please could you submit a sample RPG program to scan specific letters in a string that contains numbers, letters and special characters. Thank you!

Software/Hardware used:
ASKED: September 23, 2008  2:07 PM
UPDATED: July 31, 2010  11:00 AM

Answer Wiki:
Examples of all operation codes are in the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092508.pdf">ILE RPG Reference manual</a>. That's where we look up every question like this. Tom ==================================================== I use this routine for lookup requests on entry fields. The program called is a popup window of valid entries. d POS S 3 0 C EVAL POS = %SCAN('?': ECUST ) C IF POS <> 0 c call 'RVEH600W7' C PARM ECUST C END
Last Wiki Answer Submitted:  July 31, 2010  11:00 am  by  Modiyooch   540 pts.
All Answer Wiki Contributors:  Modiyooch   540 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Here are some samples

C EVAL findThis = 'bat'
C Eval findIn = 'battery'
C findThis Scan FindIn
C if %found
C** do something here
C endif

C EVAL findThis = 'bat'
C Eval findIn = 'battery'
C findThis Scan FindIn Location
C if %found and Location = 1
C** do something here
C endif

C EVAL findThis = 'bat'
C Eval findIn = 'battery'
C Eval Location = %SCAN(findThis:findIn)
C if Location = 1
C** do something here
C endif

But if find in were 'bottle' or 'Battery' string 'bot' would not be found

 44,150 pts.