• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Use SQL to Run PDM Options?

    January 25, 2006 Hey, David

    Do you know of any way to filter the object list shown by PDM based on object ownership or other attributes like last used date? I have looked through the documentation, but I can’t find an API or exit program to select PDM records. Instead, I write one-time programs that read output from the Display Object Description (DSPOBJD) or Display File Description (DSPFD) commands and then execute a command. Is there a scripting tool I can use to run commands on objects that allows for more flexible object selection?

    –Susan

    I can’t tell you how to filter the object list provided by PDM, but I can show you an alternative that uses SQL scripts. You will need iSeries Navigator to run the SQL scripts. The trick is to generate your commands using SQL and then run them using iSeries Navigator.

    Suppose you want to change every object in library MYLIB that is owned by JDOE so that it is owned by QPGMR. Start Operations Navigator and select Run SQL scripts by expanding the Database node and right clicking on the database icon for your system. The first time you run SQL scripts; you should open the Connection drop-down menu and select JDBC Setup. Next, click on the Format tab and change the Naming Convention to System *SYS. After changing the naming convention, close and reopen the run SQL scripts window.

    You are now ready to run system commands and SQL statements that build an output file and generate commands to change the owner of selected objects. Separate each SQL command with a semi-colon (;) and start CL commands with CL: (that’s CL followed by a colon and no spaces). Enter the following statements replacing Display Object Description (DSPOBJD) command parameters to something that is valid on your system.

    CL:dspobjd obj(mylib/*all) objtype(*all) output(*outfile) outfile(qtemp/objects);

    Now you have an output file containing all of the objects in MYLIB. You can verify this by running the following statement.

    select * from qtemp/objects;

    Now try generating commands to change the ownership of objects by running the following statement. Note that these statements will not be run in this step. Remember to replace the JDOE in the where clause with something that is valid on your system.

    select ‘CL:chgobjown obj(‘ || trim(ODLBNM) || ‘/’ || trim(ODOBNM) || ‘) objtype(‘ || trim(ODOBTP) || ‘) newown(qpgmr);’ from qtemp/objects where ODOBOW = ‘JDOE’;

    I have joined constant data like ‘CL:chgobjown obj(‘ with data returned from the input file like the object library and object name. The two perpendicular bars represent the concatenate operator and join two strings together. The output from this statement will look something like the following.

    CL:chgobjown obj(MYLIB/TEST) objtype(*PGM) newown(qpgmr);
    CL:chgobjown obj(MYLIB/TEST) objtype(*MODULE) newown(qpgmr);

    CL:chgobjown obj(MYLIB/TEST) objtype(*FILE) newown(qpgmr);
    CL:chgobjown obj(MYLIB/TEST) objtype(*QRYDFN) newown(qpgmr);
    CL:chgobjown obj(MYLIB/TEST) objtype(*QMQRY) newown(qpgmr);

    You can now select the records shown by clicking on the first record, scrolling to the end, press and hold the shift key and click on the last record. Copy these records by selecting Copy from the Edit drop down menu. Now paste the selected records to the script pane using Paste from the Edit drop down menu.

    Run the Change Object Owner (CHGOBJOWN) commands by placing the cursor on the first command and clicking on the From Selected option on the Run drop down menu.

    I have given you enough information to get started. Now, you need to do some exploring to see just how powerful and quick this technique can be. In my example, you can select based on any object attribute. You can also use SQL’s built-in functions and powerful record selection capabilities to build your command strings. You are not limited to output generated by the DSPOBJD command; you can read input generated by any command that supports an output file.

    I hope this gets you off to a good start.

    –David

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Rocket Software

    Two Steps Forward, No Steps Back

    For over 35 years, Rocket Software’s solutions have empowered businesses to modernize their infrastructure, unlock data value, and drive transformation – all while ensuring modernization without disruption.

    LEARN MORE

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    T.L. Ashford:  BARCODE400 - the fastest way to create compliance labels directly from the iSeries
    COMMON:  Join us at the Spring 2006 conference, March 26-30, in Minneapolis, Minnesota
    Bug Busters Software Engineering:  Quality software solutions for the iSeries since 1988

    Vision Solutions Appoints New Executive VP of Sales and Marketing How Low Can You Go?

    Leave a Reply Cancel reply

Volume 6, Number 4 -- January 25, 2006
THIS ISSUE SPONSORED BY:

Advanced Systems Concepts
Gabriel Consulting Group
COMMON

Table of Contents

  • Today’s Special: Data Area Surprise!
  • Use SQL to Run PDM Options?
  • Admin Alert Feedback: Quicker Ways to Change Library Object Ownership

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Liam Allan Shares What’s Coming Next With Code For IBM i
  • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
  • VS Code Will Be The Heart Of The Modern IBM i Platform
  • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
  • IBM i PTF Guide, Volume 27, Number 25
  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle