Question

  Asked: Jun 5 2008   4:18 PM GMT
  Asked by: DLM2007


RPG %SCAN Question


RPG IV, RPG, AS/400 Query

I am unable to get all the scanned records for a string in a file. For example, my file itemmast has 1000 records in it. When I use Query 400 and search for 'cable' I get 50 records with the word cable in various positions of a 30 character field. When I use the statement "x = %scan (xcust_pn : cpt#:1);" in RPG I get 15 records. If I replace the field xcust_pn with 'cable' I get all 50 records. What am I missing to get all 50 records in RPG using the %scan and the field xcust_pn.

Thank You,

Douglas L. McDuffie

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Check your field len... If it is more than 5, then you scan for "CABLE " instead of "CABLE" If you still want to use a variable name, use X = %scan (%TRIM(xcust_pn) : cpt#:1) to get your result.

Good luck !

_______________________
DanTheMan
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register