100 pts.
 Want to make a utility to search string.
[h3 class="groups"> Hi,[/h3] [h3 class="groups">I want to make a utility in AS400 to search a string (Such as file name/PGM name) in my current Library and in all Source physical files if found show PGM and all related files. Like I do trough find string Command. [/h3] It would be also help ful you can tell me how to see dependant logical file on a Physical Files I want the name of logical files and Qualified location.

Thanks



Software/Hardware used:
as400
ASKED: January 29, 2012  3:09 PM
UPDATED: March 17, 2012  5:56 AM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,410 pts. , Michael Tidmarsh   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

It would be also help ful you can tell me how to see dependant logical file on a Physical Files I want the name of logical files and Qualified location. Check out command DSPDBR.

 44,200 pts.

 

Search member and Source Member on this board .. we’ve had a number of questions in this area.

Can we eliminate RPG .. just discuss CL and RPGLE???

 44,200 pts.

 

Also look at the command DSPPGMREF

 44,200 pts.

 

What kinds of objects will you be searching? The only useful objects you can usually search will be files, but it seems like you might want to search programs, too. But you can’t search through compiled programs for strings.

Please give examples of some searches.

Tom
.

 108,310 pts.

 

Thanks Philip for you solution that I also Know but I want to retrieve the names of dependent file in my program itself and and want to search in all my source physical file in a library(*CURLIB).

 100 pts.

 

Thanks tom for your response I can make Picture more Clear. I want these steps in my PGM which i Manually do to search anything (PGM/File)

1. WRKOBJPDM object type *file, Object Attribute pf-src. This is how I will get the list of all source file in my Current Library.

2. now write 25 in option infront of any PGM/File Name. This is for search string.

3. Press F13. This will select all, than press enter. Write the string Name you want to Search in option leave it for display. press Enter again you will be able to search all type of objects with the same name.

I want to do this whole Procedure in My Program but I am unable to use any Logic for selection.

 100 pts.

 

FNDSTRPDM will search through file members for specified strings.

To identify dependent logicals you will need to use either the DSPDBR command or the QDBLDBR API.

 5,670 pts.

 

I want to do this whole Procedure in My Program but I am unable to use any Logic for selection.

To search a single source member in a source file in a library, override to the member, open the file, and read each record. For each record, test to see if the string is found anywhere in the SRCDAT field.

To test to see if a substring is found in a character field, you could call the Scan for String Pattern (QCLSCAN) API. (See Examples: Scanning string patterns for some discussion of patterns and results.)

Or if you’re more comfortable with C, you could use the strstr() — Locate Substring C runtime library function.

Either one can be used in any ILE language.

If you need to search through all members of a source file, you’ll want to create a list of members. For each member in the list, call the function you create for the process above. You can create a list in a file by running the DSPFD command with either TYPE(*MBRLIST) or TYPE(*MBR) and with OUTPUT(*OUTFILE). You can also call the List Database File Members (QUSLMBR) API if you prefer having the list in a user space (which has advantages over building a list in a file).

If you want to search members in multiple source files, then you’ll need to create a list of those files. For each file, you would call the function you created above to process each member. And if you need to process files from multiple libraries, you’ll need to create a list of those libraries. For each library, you will call your function to list the files in the library in order to call the function to list the members in each file, in order to search each member.

Each higher function calls down to the next lower function.

In any case, it’s not clear yet what you actually want to do. You described an interactive process that uses PDM. Why isn’t that good enough? What will your program do that you can’t do with PDM?

A simple search doesn’t actually do anything. What do you want to happen when a match is found?

The FNDSTRPDM command will do a lot of the whole process. But even for that, you have to tell it what to do when it finds a match.

Tom

 108,310 pts.

 

Thanks tom Now its Crystal Clear

 100 pts.

 

actually I got the requirement from some Client so have to do this

 100 pts.