• 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
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    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

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

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