ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

retrieve user library list and all source file in library amd plot in a physical file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • retrieve user library list and all source file in library amd plot in a physical file

    hi

    any handy way i can retrieve all source file name in the users's library list and plot in a pf

    thanks

  • #2
    Re: retrieve user library list and all source file in library amd plot in a physical

    There are a few ways. One simple way:
    Code:
    DSPFD FILE(*USRLIBL/*ALL)
          TYPE(*BASATR)
          OUTPUT(*OUTFILE)
          FILEATR(*PF)
          OUTFILE(QTEMP/BASATR)
    
    RUNSQL SQL('DELETE FROM QTEMP/BASATR WHERE ATDTAT = ''D''')
           COMMIT(*NONE)
    The DSPFD builds a list of all PFs. Then the SQL DELETE deletes all rows that indicate 'Data' Pfs, rather than 'Source' PFs. The RUNSQL command requires i 6.1 or later (or any SQL command utility or other SQL processor).

    For a more technical method, you could call the List Objects (QUSLOBJ) API to build a list of *ALL *FILE objects in *USRLIBL. Then process the list, perhaps calling the Retrieve Database File Description (QDBRTVFD) API for each entry to determine, first, if it's a PF, and second, if it's a source PF. For each source-PF entry, you'd write some record to your chosen output PF.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      Re: retrieve user library list and all source file in library amd plot in a physical

      this would be the best method for me in a clean cl.
      but can i loop though the outfile for another action?

      thanks for the tips

      Comment


      • #4
        Re: retrieve user library list and all source file in library amd plot in a physical

        Sure, you can do a DLCF in CL (Ug) or use a cursor in SQLRPGLE (Better / more open and robust).
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: retrieve user library list and all source file in library amd plot in a physical

          Originally posted by peacealida View Post
          ...but can i loop though the outfile for another action?
          Sure. Why not?

          Note that you can't compile the CL and declare the *OUTFILE unless the *OUTFILE already exists first. However, you can declare the "model file" that is supplied with the OS and use OVRDBF to override to your *OUTFILE at run-time. The <help> text for the DSPFD OUTFILE() parameter tells you the name of the file that you can declare for the compile. There are different "model files" depending on the TYPE() that you choose.

          After the *OUTFILE has records added to it by your program, use OVRDBF so that your program reads from it instead of trying to read from the "model file".
          Tom

          There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

          Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

          Comment

          Working...
          X