fhg
Volume 7, Number 34 -- October 3, 2007

IFS Commands Give You Generic Access

Published: October 3, 2007

by 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


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
E-mail: software@worksright.com
Web site: www.worksright.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

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


 
The Four Hundred
State of the System i: What's Going On in the Market?

Summit Partners Sells Help/Systems to Audax Group

Reader Feedback on EGL: At Least It's Not Java, But It Ain't RPG, Either

IBM Helps Users Migrate to Power6-Based System i Boxes

The Linux Beacon
IDF Server Wrap Up: Intel to Keep the Pressure on AMD

Mandriva Readies Linux 2008 Editions for October

SAP Plants Its Flag in Mid-Market Territory with SaaS Apps

Opsware Adds Storage, Process Management with System 7 Tools

Four Hundred Stuff
Bug Busters Achieves High Availability Milestone with RSF 8.1

LANSA to Deliver Code-Less Business Process Integration for SMBs

Water District Makes Second Run at Electronic Document Retention

The ROI of RF Technology

Big Iron
Hosing z/OS.e and Other Withdrawals

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
September 29, 2007: Volume 9, Number 39

September 22, 2007: Volume 9, Number 38

September 15, 2007: Volume 9, Number 37

September 8, 2007: Volume 9, Number 36

September 1, 2007: Volume 9, Number 35

August 25, 2007: Volume 9, Number 34

The Windows Observer
Microsoft Launches Business Intelligence Tool for the Masses

Microsoft Revs Betas of Longhorn, Viridian, Vista SP1

IDF Server Wrap Up: Intel to Keep the Pressure on AMD

Sun Ships Intel-Based Galaxy Rack Servers

The Unix Guardian
Sun Enhances Solaris Developer Edition, Adds Support

Sun Ships Intel-Based Galaxy Rack Servers

IDF Server Wrap Up: Intel to Keep the Pressure on AMD

As I See It: Shocking

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

WorksRight Software
Vision Solutions
ARCAD Software


Printer Friendly Version


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

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Crashing processes!

SQL 'Hidden' Field

What's coalesce good for?

How do I transfer output from a query to Excel?

Copying record of join logical file mutiple times





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement