ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Getting last member of QAPM* database files

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

  • Getting last member of QAPM* database files

    Hi there,

    I apologize for my ignorance, I'm still learning iSeries/AS400. I'm trying to programmatically retrieve PFRDATA from the QAPM* database files (QAPMSYSTEM, QAPMDISK, QAPMSYSCPU, QAPMJOBOS, etc.) remotely, and I am using odbc to query these. I understand that when I query these tables I always get results from the *FIRST member. My question is, how do I always make sure I query the *LAST member in the database files?
    I cannot create an ALIAS unless I first know the exact member name, (I tried using *LAST when creating an alias and didn't work).

    I tried using OVRDBF FILE(SOMEFILE) TOFILE(QPFRDATA.QAPMDISK) MBR (*LAST) but that does not work either once it recycles at midnight and creates a new member. I still get the same member from the first time I executed OVRDBF even when running the OVRDBF CL command again.

    I know this is about SQL and touches some CL, my goal is to be able to always query the last member of the custom perf data (R00000****) member in the QAPM* tables using just SQL but if I have to run some CL commands before I can do that, that's also fine.

    Your help is much appreciated.

    Thanks!


  • #2
    Maybe you can use the RTVMBRD *LAST command in a CL program...

    Comment


    • #3
      What about accessing the catalog view SYSPARTITIONSTAT for determining the last member?
      Something like this:
      Code:
      Select Table_Partition
        from SysPartitionStat
        Where Table_Name = 'QAPMSYSTEM'
        Order By Partition_Number Desc
        Fetch First Row only;
      Birgitta

      Comment


      • #4
        This is great, thanks guys! Exactly what I needed. Sorry I couldn't reply either, there was some permissions issue with my profile that didn't allow me to reply.

        Much appreciated!

        Comment

        Working...
        X