Midrange News for the IBM i Community

Posted by: rpgprogrammer
Vancouver, BC
Scan for a word in Files
has no ratings.
Published: 05 Jun 2013
Revised: 22 Jul 2013 - 3958 days ago
Last viewed on: 22 May 2024 (4227 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Scan for a word in Files Published by: rpgprogrammer on 05 Jun 2013 view comments(2)

Need a expert advice

I have few of the PF's in a given library.  Want to read the data of each file to check wither a given word "MYLIB" exist in any of the field data.

Is there any way?  I know we can write a utility program to read all the files and scan for the word but it will take a lot of time.

Similar like DSPPFM and then search for the word  and put in a outfile.


Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: DaleB
Premium member *
Reading, PA
Comment on: Scan for a word in Files
Posted: 10 years 11 months 18 days 13 hours 8 minutes ago

FNDSTRPDM works on PF-DTA...

Posted by: rpgprogrammer
Premium member *
Vancouver, BC
Comment on: Scan for a word in Files
Posted: 10 years 10 months 1 days 15 hours 28 minutes ago
Step 1: Create a PF UTL017 with below fields and compile the file in a library A R UTL017R A LIBNM 10A A FILEN 10A A TYPEN 10A A SRCN 10A Step 2: Create a RPGLE Program UTL017 and compile the program in library FUTL017 UF A E K DISK C EXSR SR999 C WRITE UTL017R C C SETON LR C SR999 BEGSR C *ENTRY PLIST C PARM LIBNM 10 C PARM FILEN 10 C PARM TYPEN 10 C PARM SRCN 10 C C SR999E ENDSR Step 3: add the library where the program and file is compiled in your library list Step 4: From Command Prompt do WRKMBRPDM Step 5: Press Shift F4(Work with User-Defined Options) Step 6: Press F6 and enter below values Option : L2 (or any value you want) Command: CALL PGM(UTL017) PARM(&L &F &T &N) And press enter Step 7: From Command Prompt Type WRKOBJPDM and enter your library name Step 8: Type 25 and then Shift F1 (This will select all the source files in your library Step 9: Press Enter and type L2( or the option you entered in step 6) in Option Field Step 10: Enter the word/text you want to file in the FIND field And press enter :o) You are done. Once the scan is finished you can do run query in the output file UTL017. It will have the source details where the text/word is found This is a 1 time process only. Next time if you want to find any text, just clear UTL017 and do Find string.