• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • IFS Commands Give You Generic Access

    October 3, 2007 Bruce Guetzkow

    Note: The code accompanying this article is available for download here.

    Many i5/OS commands allow you to enter a generic name, such as OBJ*, to reference a collection of objects all beginning with the string OBJ. For example, the Delete File (DLTF) command allows you to delete a group of files using a generic name. Unfortunately there are some commands where generic names are not an option, like the Change Object Owner (CHGOBJOWN) command. The solution for some of these commands is to use their Integrated File System (IFS) equivalents.

    Starting at the Top

    The IFS is the part of i5/OS that supports files like those normally found on PC and Unix systems. Each of these systems can be accessed in a similar manner using a directory structure. The file system most familiar to many i5 professionals is the Library File System, also referred to as QSYS.LIB.

    In traditional Command Language (CL) commands and programs we reference an object using a library/name syntax. For example, a program named PGM123 in library BRUCE would be named BRUCE/PGM123, and its object type would be *PGM. However, you can also refer to the same object from the IFS perspective using a directory/object.type syntax.

    As in any PC-like directory structure, you build a path to an object from the top down. All objects on the System i are in library QSYS, so that is always the first component of the IFS name. If the object is in a library other than QSYS, that library is the next branch of the tree. The object and type follow. If the object is a database file, the member comes last. Each part of the path name must also be qualified with the type of object it represents.

    In my example we have an object of type *PGM in library BRUCE, and that library is in library QSYS. So, starting from the top we have the following:

    • QSYS.LIB
    • BRUCE.LIB
    • PGM123.PGM
    

    The object qualifier is the same as the object type without the leading asterisk (*). Putting this together in the form of a path name we get:

    /QSYS.LIB/BRUCE.LIB/PGM123.PGM
    

    If we take a physical file named BRUCE/MYFILE with a member of MYMBR, the equivalent IFS path name would be:

    /QSYS.LIB/BRUCE.LIB/MYFILE.FILE/MYMBR.MBR
    

    On the Right Path

    As is the norm with the Library File System, object names are not case-sensitive. The following are all references to the same object:

    • /QSYS.LIB/BRUCE.LIB/PGM123.PGM
    • /qsys.lib.bruce.lib/pgm123.pgm
    • /QSYS.lib/bruce.LIB/PgM123.pGm
    

    You can then take any path and insert an asterisk (*) into the last segment of the path to get a generic name. For example, to reference all programs in library BRUCE, you would specify a path of /QSYS.LIB/BRUCE.LIB/*.PGM. For all objects beginning with XYZ in the same library you would use /QSYS.LIB/BRUCE.LIB/XYZ*.*.

    If you are using independent Auxiliary Storage Pools (ASP) you need to also include the ASP-name ahead of QSYS, like this /asp-name/QSYS.LIB/BRUCE.LIB/PGM123A.PGM.

    Now that you can reference an IFS path name, you can make use of some IFS commands that work with the Library File System. To find a complete list of these commands, go to the IBM Information Center. (For V5R4, go to http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp.) Once in the Information Center, drill-down through “Files and File Systems” → “Integrated File System” → “File Systems” → “Library File System” (QSYS.LIB), and select “Integrated File System Commands and Displays” in the QSYS.LIB file system. Select the link “Accessing using CL commands” in the body of the document.

    Taking Command

    As I indicated, the CHGOBJOWN command does not allow the use of a generic object name. Instead we can now use the IFS-equivalent command: Change Owner (CHGOWN). This command accepts a path name for the object parameter, and will allow us to specify a generic name.

    The parameters for the two commands are similar. For CHGOBJOWN they are:

    • OBJ - Object name
    • OBJTYPE - Object type
    • ASPDEV - ASP device name
    • NEWOWN - New owner name (user profile)
    • CUROWNAUT - Revoke or leave current owner authorities
    

    For CHGOWN the parameters are:

    • OBJ - Object path (includes object type and ASP name if appropriate)
    • NEWOWN - New owner name (user profile)
    • RVKOLDAUT - Similar to CUROWNAUT above
    • SUBTREE - Applies to directories
    • SYMLNK - Applies to symbolic IFS links
    

    To change the owner of all data areas in library SMITH to user profile FRED and revoke the previous owner’s authority we specify:

    CHGOWN OBJ(/QSYS.LIB/SMITH.LIB/*.DTAARA) NEWOWN(FRED)
    

    The alternative is to run the CHGOBJOWN command for each object separately. As you can see, if there are a lot of qualifying objects, this can be cumbersome. However, using the CHGOWN command with a generic path simplifies the task greatly. Remember to specify your generic path name carefully as you can also easily affect objects you hadn’t intended to if you specify the wrong path.

    Time Savers

    The IFS-style commands that I find most useful with QSYS.LIB are:

    • CHGATR - Change Attribute
    • CHGAUD - Change Auditing Value
    • CHGOWN - Change Owner
    • DSPAUT - Display Authority
    • DSPLNK - Display Links
    • MOV - Move
    • RNM - Rename
    • WRKAUT - Work with Authority
    • WRKLNK - Work with Links
    

    Some of these commands require specific authority to use them with QSYS.LIB or have restricted uses, but any limitations are easily determined from the command help text.

    Here’s one more way to simplify the task. I’ve created the command Retrieve Object Path (RTVOBJPATH) to make it even easier to determine the path name for a QSYS.LIB object. The command parameters are as follows:

    • OBJECT - Object name with Library
    • MBR - Member name (default *NONE)
    • OBJTYPE - Object Type
    • VLDOBJ - Validate Object (default *NO)
    • PATH - Return value for path name (90-bytes)
    

    Simply specify the pertinent values and the path name is returned in the PATH parameter. (Since we don’t use independent ASPs where I work, there is no logic in the command to add that to the path, but you could easily add it if needed.) You can specify any object, even if it doesn’t exist, unless you indicate VLDOBJ(*YES) or if you use special values that need to be resolved (*LIBL, *FIRST, etc.). Error message ID CPF9897 is returned and can be monitored for the following conditions:

    • Invalid Object Type
    • Object or Member does not exist (if VLDOBJ(*YES) or special value)

    Now you have an easy way to use a generic object name by using the IFS path name, and an easy way to build that path name. So try out a new command and save yourself a little time.



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Maxava

    Migrate IBM i with Confidence

    Tired of costly and risky migrations? Maxava Migrate Live minimizes disruption with seamless transitions. Upgrading to Power10 or cloud hosted system, Maxava has you covered!

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    COMMON:  Join us at the annual 2008 conference, March 30 - April 3, in Nashville, Tennessee
    Help/Systems:  Discover Robot/SECURITY, the i5/OS security monitoring and auditing software
    NowWhatJobs.net:  NowWhatJobs.net is the resource for job transitions after age 40

    IT Jungle Store Top Book Picks

    The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
    The System i Pocket RPG & RPG IV Guide: List Price, $69.95
    The iSeries Pocket Database Guide: List Price, $59.00
    The iSeries Pocket Developers' Guide: List Price, $59.00
    The iSeries Pocket SQL Guide: List Price, $59.00
    The iSeries Pocket Query Guide: List Price, $49.00
    The iSeries Pocket WebFacing Primer: List Price, $39.00
    Migrating to WebSphere Express for iSeries: List Price, $49.00
    iSeries Express Web Implementer's Guide: List Price, $59.00
    Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
    Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
    Getting Started with WebSphere Express for iSeries: List Price, $49.00
    WebFacing Application Design and Development Guide: List Price, $55.00
    Can the AS/400 Survive IBM?: List Price, $49.00
    The All-Everything Machine: List Price, $29.95
    Chip Wars: List Price, $29.95

    Laserfiche Scales to Meet Content Management Needs of i5/OS Shop IBM Preps Update to Virtualization Manager

    Leave a Reply Cancel reply

Volume 7, Number 34 -- October 3, 2007
THIS ISSUE SPONSORED BY:

WorksRight Software
Vision Solutions
ARCAD Software

Table of Contents

  • IFS Commands Give You Generic Access
  • APIs Sometimes Fail (But Programmers Don’t Have To)
  • Admin Alert: Remotely Accessing an HMC System Console, Part 1

Content archive

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

Recent Posts

  • 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
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

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