ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Qualified library name in WRKQRY?

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

  • Qualified library name in WRKQRY?

    Hey Guys

    I would like to save an OS400 standard query (*QRYDFN) and restore it on another system. When I select a file, I was expecting the ?Specify File Selections? screen to keep the *LIBL value for the library. But the library name is actually located at design time and changed from *LIBL to the library holding the file . This means that it is impossible to ?export? a query with respect to the library list on the target system.

    Do you have any idea?

    Regards,

    Bent

  • #2
    Re: Qualified library name in WRKQRY?

    Hi Bent:

    If this can be run from a CL use the runqry to override the file/library names
    Code:
                                                                                   
     Query  . . . . . . . . . . . . .                 Name, *NONE                  
       Library  . . . . . . . . . . .     *LIBL       Name, *LIBL, *CURLIB         
     [COLOR="Red"]Query file:                                                                   
       File . . . . . . . . . . . . .                 Name, *SAME                  
         Library  . . . . . . . . . .     *LIBL       Name, *RUNOPT, *LIBL, *CURLIB
       Member . . . . . . . . . . . .   *FIRST        Name, *RUNOPT, *FIRST...     [/COLOR]                + for more values
    Best of Luck
    GLS
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Qualified library name in WRKQRY?

      Thanks, but I have no control over CL at runtime simply because Im running the Query in batch...

      I use the same interface for many queries and I not even kown the files used in the queries to run.

      Bent

      Comment


      • #4
        Re: Qualified library name in WRKQRY?

        change the CL to issue a RTVMBRD before running the query... this will return the file, library, member... tons of info about the file being used... then you can quality the library/file on your RUNQRY command.


        Code:
        dcl &file *char 10
        dcl &rtnlib *char 10
        
        rtvmbrd file(*libl/&file) RTNLIB(&RTNLIB)
        // this will grab the actual file library name in a nice softcoded way
        
        runqry 'queryname' QRYFILE(&RTNLIB/&file)
        // will override the query to use the file in question
        excuse any syntax errors... this is from my jaded memory
        predictably positive, permanently punctilious, purposely proactive, potentially priceless, primarily professional : projex

        Comment


        • #5
          Re: Qualified library name in WRKQRY?

          Thanks,

          This is a perfect solution if I know the files included in the query. My problem is that users adds queries to a list to be executed later on another system. And therefore I do not know the files included in the queries.

          I was looking for a way to convert the query so that the query is "self describing". If you understand


          Best regards,

          Bent

          Comment


          • #6
            Re: Qualified library name in WRKQRY?

            You can do this in 6 steps to know what files are used :
            1. Read the list of queries
            2. Save the QRYDFN in a SAVF
            3. Dump the SAVF in a PF
            4. Store the PF in a user space
            5. Parse the user space to find out the files used in the qry
            6. Use the Finkpad's suggestion to qualify with library name and run the query


            Check out http://www.code400.com/forum/showthr...hlight=rtvqryf and d/l the attached sources.
            Last edited by Mercury; December 15, 2009, 07:06 AM.
            Philippe

            Comment


            • #7
              Re: Qualified library name in WRKQRY?

              Thanks a lot Philippe,

              It seems to be the way to do it - a little heavy maybe .


              Regards,

              Bent

              Comment

              Working...
              X