Search for a data in the file in all the library

2505 pts.
Tags:
AS/400
AS/400 Library
I have a file which has an ID field and description. The same file is present in many library. I am trying to create an utility which will ask for the ID and it should display all the library which has the file with that ID in it. How can I achieve this? How to search in that file in all the library for that ID?

Software/Hardware used:
AS400

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    I suppose you'd start by building a list of user libraries. I don't know how you will choose what libraries will go on your list. Then for each library in the list, you'll build a list of all physical files in that library. I don't know how nor if you'll choose which PFs will go into that list. Then for each PF in the list, you'll build a list of fields (columns) in the file. When you find some kind of "ID" column that matches whatever data attributes an "ID" column should have, you can add the library, file and field name to a work list. After going through each file, go to the next library and do it again. . Eventually, you'll have a list containing library, file and column names. You can pass each of those through a dynamic SELECT statement that you build to count how many of that file's "IDs" match your value. I don't have any idea what you'll do when you find a match. . As an alternative, you could do some creative queries of the system catalog to find files and fields that match whatever it is that you need to match. You can retrieve library, file and field names from there for your dynamic SELECTs. . Tom
    125,585 pointsBadges:
    report
  • RamvishakRamesh
    1. I want to get the list of all libraries in the system. I guess the command DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*LIB) will work. Save the output to some file. 2. Search for each record in that file(each record will be a library name) for the one file that I am interested. Get the list of all library which has this file. How to achieve this? 3. Search in that list for the ID match. I guess using an SQL prepare statement I can achieve this.
    2,505 pointsBadges:
    report
  • philpl1jb
    Combine the first two steps: not DGDSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*LIB) use DSPOBJD OBJ(*ALLUSR/MYFILE) OBJTYPE(*FILE) Phl
    50,425 pointsBadges:
    report
  • RamvishakRamesh
    Another alternative found is to use Sys ref file QADBXREF
    2,505 pointsBadges:
    report
  • TomLiotta
    It is not a good idea to access QADBXREF directly. Use the tables and views that IBM has created for system catalog queries instead. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    DSPFD can list all PFs in a library. And DSPFFD can list all fields in a file. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following