Library compare between 2 library lists using Query

180 pts.
Tags:
AS/400
AS/400 Library
AS/400 Query
I have to lists of libraries on the same system as PFs. Using query, I want to see what libraries are not on one system, but on the other and vis-virus and generate a report. Can you offer solution? The two library lists come from two different systems.  I FTP'd the one file over to another so both PFs would be on one system.

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.

Discuss This Question: 2  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.
  • TomLiotta

    Simplest query I can think of is:

    SELECT ODOBSY, ODOBNM FROM mylib1
       WHERE not ODOBNM in( SELECT ODOBNM FROM mylib2 )
    UNION
    SELECT ODOBSY, ODOBNM FROM mylib2
       WHERE not ODOBNM in( SELECT ODOBNM FROM mylib1 )

    That assumes that the mylib1 and mylib2 files were created with DSPOBJD OBJTYPE(*LIB) to *OUTFILEs. The resulting list has all libraries on one system that are not included on the other system.

    Tom

    125,585 pointsBadges:
    report
  • TomLiotta

    Alternative syntax:

    SELECT a.ODOBSY, a.ODOBNM FROM mylib1 a
       EXCEPTION JOIN mylib2 b
          ON a.ODOBNM = b.ODOBNM
    UNION
    SELECT a.ODOBSY, a.ODOBNM FROM mylib2 a
       EXCEPTION JOIN mylib1 b
          ON a.ODOBNM = b.ODOBNM

    That might be the preferred syntax as well as more efficient.

    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.

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

Following

Share this item with your network: