KB Article 16055
2019/03/25

Close
X
Contact Tech Support

 Email Tech Support
 (250) 655-1766
 [7:30 - 5:00 PST]
Your Meeting ID will be Provided by a Rep.
Tech Support
Tech Support Home
Software Updates
Knowledge Base Search
Recent KB Articles
Product FAQs
Code Samples
Documentation
Tech Blog
System Requirements
Installation Instructions
Support Testimonials
Contact us to...
Create a Ticket
Request a Free Demo
Suggest a New Feature
Submit Feedback
Upload a Large File
Other Services
Software Training
Professional Services

How do I update the X-Analysis repository to reflect real usage data from another server? (in progress)

Product: X-Analysis Type: How to

Sometimes you need to have the last used date and creation date information in X-Analysis to determine which programs and files need to be worked on first but if X-Analysis is running on a different server or partition than production the information in the repository won't reflect the real usage data.

How to copy the last used date and creation date information for for the objects on IBMi into an X-Analysis Repository on another IBMi server or partition.

The following steps outline the process:

  1. Log into the server (usually production) you want to get the object usage data from and set your library list to include only the object libraries you want to export the data for

  2. Run the following command:
    DSPOBJD OBJ(*USRLIBL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/OBJPROD)

  3. Create a save file and put the file created from the output into the save file using the following commands:
    CRTSAVF FILE(QTEMP/OBJPRODSF)
    SAVOBJ OBJ(OBJPROD) LIB(QTEMP) DEV(*SAVF) OBJTYPE(*FILE) SAVF(QTEMP/OBJPRODSF)

  4. Copy the save file to the library QTEMP on the server with the X-Analysis repository you want to update

  5. Log into the server with the X-Analysis repository and restore the file from the save file with the following command (replacing MYREPONAME with the name of the X-Analysis repository you want to update):
    RSTOBJ OBJ(*ALL) SAVLIB(QTEMP) DEV(*SAVF) SAVF(QTEMP/OBJPRODSF) RSTLIB(MYREPONAME)

  6. As the names of the libraries used may not be the same on both servers, we need to create a table that will let us cross reference library names. Create this table with the following SQL:
    CREATE TABLE MYREPONAME/LIBXREF (REMOTE_LIB VARCHAR(10) NOT NULL, LOCAL_LIB VARCHAR(10) NOT NULL, PRIMARY KEY(REMOTE_LIB))

  7. You'll need to insert a row into this file for any libraries that don't match on the remote and local servers. Make sure to use capital letters for the library names.

  8. Run the following SQL queries (replacing MYREPONAME with the name of the X-Analysis repository you want to update):

    • UPDATE MYREPONAME/XOBJECT SET XOBJECT.L#ODTE = (SELECT IFNULL(ODCDAT, '') FROM MYREPONAME/OBJPROD LEFT OUTER JOIN MYREPONAME/LIBXREF ON OBJPROD.ODLBNM = LIBXREF.REMOTE_LIB WHERE XOBJECT.L#LIB = IFNULL(LIBXREF.LOCAL_LIB, OBJPROD.ODLBNM) AND XOBJECT.L#OBJ = OBJPROD.ODOBNM AND XOBJECT.L#TYPE = OBJPROD.ODOBTP) WHERE EXISTS (SELECT 1 FROM MYREPONAME/OBJPROD LEFT OUTER JOIN MYREPONAME/LIBXREF ON OBJPROD.ODLBNM = LIBXREF.REMOTE_LIB WHERE XOBJECT.L#LIB = IFNULL(LIBXREF.LOCAL_LIB, OBJPROD.ODLBNM) AND XOBJECT.L#OBJ = OBJPROD.ODOBNM AND XOBJECT.L#TYPE = OBJPROD.ODOBTP)
    • UPDATE MYREPONAME/X4DSPOBJ SET (X4DSPOBJ.ODUDAT, X4DSPOBJ.ODUCEN, X4DSPOBJ.ODUCNT, X4DSPOBJ.ODLCEN, X4DSPOBJ.ODLDAT, X4DSPOBJ.ODLTIM, X4DSPOBJ.ODCCEN, X4DSPOBJ.ODCDAT, X4DSPOBJ.ODCTIM) = (SELECT IFNULL(ODUDAT, ''), IFNULL(ODUCEN, ''), IFNULL(ODUCNT, ''), IFNULL(ODLCEN, ''), IFNULL(ODLDAT, ''), IFNULL(ODLTIM, ''), IFNULL(ODCCEN, ''), IFNULL(ODCDAT, ''), IFNULL(ODCTIM, '') FROM MYREPONAME/OBJPROD LEFT OUTER JOIN MYREPONAME/LIBXREF ON OBJPROD.ODLBNM = LIBXREF.REMOTE_LIB WHERE X4DSPOBJ.ODLBNM = IFNULL(LIBXREF.LOCAL_LIB, OBJPROD.ODLBNM) AND X4DSPOBJ.ODOBNM = OBJPROD.ODOBNM AND X4DSPOBJ.ODOBTP = OBJPROD.ODOBTP) WHERE EXISTS (SELECT 1 FROM MYREPONAME/OBJPROD LEFT OUTER JOIN MYREPONAME/LIBXREF ON OBJPROD.ODLBNM = LIBXREF.REMOTE_LIB WHERE X4DSPOBJ.ODLBNM = IFNULL(LIBXREF.LOCAL_LIB, OBJPROD.ODLBNM) AND X4DSPOBJ.ODOBNM = OBJPROD.ODOBNM AND X4DSPOBJ.ODOBTP = OBJPROD.ODOBTP)

Note: This updates the following fields:
XOBJECT.L#ODTE: Object Creation Date
X4DSPOBJ.ODUDAT: Last Used Date
X4DSPOBJ.ODUCEN: Last Used Century
X4DSPOBJ.ODUCNT: Days Used Count
X4DSPOBJ.ODLCEN: Change Century
X4DSPOBJ.ODLDAT: Change Date
X4DSPOBJ.ODLTIM: Change Time
X4DSPOBJ.ODCCEN: Creation Century
X4DSPOBJ.ODCDAT: Creation Time
X4DSPOBJ.ODCTIM: Creation Date

XA-10926

Rate This Article

Did this example help you to achieve your goal?
 Yes  No  Don't Know

Enter additional comments below.   If you want to hear back from us, include your contact information.

Email Address:
Comments:
Please enable JavaScript in order to rate this page.