IBM Support

Integrated File System Tools: DEL, DELTREE, CMDALL, CHGAUTALL, CHGOWNALL, QRYIFSLIB, DLTIFSF, RNMIFSF

Troubleshooting


Problem

This document describes the set of Integrated File System tools that are available for download from the IBM Technical Support Center FTP site.

Resolving The Problem

This document describes the set of Integrated File System tools that are available for download from the IBM Technical Support Center FTP site. The tools are intended primarily for system administrators. They assist with common tasks such as recursively running a CL command against all files and subdirectories in a directory. Another tool dumps file and directory information into an externally described file. The output file can be used for various purposes such as querying for disk space usage reports or processing by a CL program.
Caution: The following tools are provided on an unsupported, as is basis. Having a current system backup is recommended before you use the commands that delete or change multiple files. When run recursively from root, some of these commands can affect all files on the system.

Getting the Integrated File System Tools to your system
The tools are included in a save file named Ifstool.savf, which is available at the FTP site, public.dhe.ibm.com/services/us/igsc/cs2/ApiSamples/ The save file is for the R450 operating system and later. The save file contain compiled program objects and source code for all of the Integrated File System utilities. No command wrapper is supplied for these objects. Download the file named Ifstool.savf; in a binary format to save it on your PC. Then, the save file needs to be uploaded to IBM i. For more information about how to upload a save file to IBM i, see Using FTP to Move a File in SAVF Format from a PC to a Library.

Once the save file data is uploaded to the operating system, it is restored by using the command:

RSTOBJ OBJ(*ALL) SAVLIB(DDILLING) DEV(*SAVF) SAVF(IFSTOOLSF) RSTLIB(MYLIB)


Using the Integrated File System Tools

To display the help text for a program, call the program with no parameters. For example,

CALL <pgmname>

Where <pgmname> is the Integrated File System tools program name.
 
ATTRIB Note: OS/400 R510 and later and i5/OS R530 provide a CHGATR command with function similar to this tool. OS/400 R540 added SUBTREE *ALL parameter that allows it to run against all subdirectories (similar to the S switch on this command).

R450 and earlier do not have a native command to change or display certain file attributes such as read-only, hidden, PC archive, system, and ALWCKPWRT. The PC file attributes can be set only from a PC by using a network drive connection.

The ATTRIB program works similar to the DOS ATTRIB command allowing the attributes to be updated from an operating system command line without requiring a network drive connection. This program uses the Qp0lSetAttr() API that is only supported in R440 and later.

Example:
CALL PGM(ATTRIB) PARM('-R' '-H' '/ddilling' '\S')
CHGAUTALL Runs the specified CHGAUT command recursively on all files and subdirectories.
Note: This function was integrated into OS/400 R540 with the SUBTREE *ALL parameter on the CHGAUT command.

Example:
CALL PGM(CHGAUTALL) PARM('/rjzeller' 'USER(DDILLING) DTAAUT(*RWX) OBJAUT(*ALL)')
CHGCCSID Note: OS/400 R510 and later and i5/OS R530 provide a CHGATR command with function similar to this tool.

Change the CCSID on a particular file or all files in a directory. This program does not convert the text.

Example:
CALL PGM(CHGCCSID) PARM('/ddilling/myfile' '1252' )
CHGOWNALL Runs the specified CHGOWN command on all files and subdirectories.
Note: This function was integrated into OS/400 R540 with the SUBTREE *ALL parameter on the CHGOWN command.

Example:
CALL PGM(CHGOWNALL) PARM('/ddilling' 'NEWOWN(DDILLING) + RVKOLDAUT(*YES)')
CMDALL This program executes the specified command against each file and each directory in the target directory as well as all files and directories beneath those directories. The command is executed by using the specified parameters. Any command that has an OBJ parameter can be used.
Note: In OS/400 R540, most commands allow this function with the SUBTREE *ALL parameter.

Example: This example runs the change primary group command against all directories and files in or beneath /test.
CALL PGM(CMDALL) PARM('/test' 'CHGPGP' 'NEWPGP(MYGRP) DTAAUT(*RWX) OBJAUT(*ALL)')
DEL Similar to the Windows DEL command or a recursive version of RMVLNK. Allows the user to specify wildcard pattern match and optionally to perform the operation on all subdirectories.

Example:
CALL PGM(DEL) PARM('/ddilling/*.eml' '\s')
DELTREE Caution: Use this command with caution. There is no undelete.

Note: OS/400 R440 and later and i5/OS R530 include this function in the EDTF command; option 9=Recursive Delete.

Similar to the DOS DELTREE command. Deletes all files and directories and subdirectories from the parent directory down.

Example:
CALL PGM(DELTREE) PARM('/rjzeller')
DLTIFSF This program can be used to remove (delete) an IFS file that has a special character such as a backslash ("\").

Example:
CALL DLTIFSF '[filepath]'
DSPLINK Note: OS/400 R450 and later and i5/OS provide this function in WRKLNK DETAIL(*EXTENDED) Option 12.

Displays the location of the object a symbolic link refers to.

Example:
CALL DSPLINK '[filepath]'
QRYIFSLIB
Note: IBM i5/OS R530 and later now provides similar function with the RTVDIRINF command.

Similar to QRYDOCLIB, this utility dumps all the lstat information for an Integrated File System object into an output file. The output file includes items such as allocated size, actual size, owner, modified date, last accessed date, group, and permissions. It also prints the total allocated size of each directory processed.

Note: The R440 version does not support large files (file size > 2Gig).

As with all of the tools, call the program with no parameters to display the help text:

CALL PGM(QRYIFSLIB)

QRYIFSLIB V1.9a:
Invalid number of arguments.
 Dump stat information for each link into the output file QRYIFSLIB and, if \A option is selected, QRYIFSLIBA.  
   - This program does not follow symlinks.
   - The output file is overwritten on each call.
 This utility is unsupported and provided on an as is basis. Comments can be sent to ddilling@us.ibm.com.
CALL QRYIFSLIB '[path/]*|file' ['\S'] ['\A'] ['\L:lib'] ['\Q'] ['\X:names']
 [path/]   Absolute or relative path ending with a '/'.
 *         Process all files in a directory.
 file      Process only specified file system object.
 \S        Process all subdirectories.
 \A        Include native authority information.
 \L:lib    Library to write output files into (Default is QGPL).
 \Q        Skip /QSYS.LIB
 \X:names  Comma-delimited list of directory names to exclude where one directory name can be the special value *NONLOCAL.            
           *NONLOCAL is a wildcard for the following IBM supplied directories:
           /QSYS.LIB,/QNTC,/QOPT,/QDLS, /QNetWare,/QLANSrv,/QfileSvr.400

Examples:
CALL PGM(QRYIFSLIB) PARM('/ddilling/myfile.txt' '\A')
CALL PGM(QRYIFSLIB) PARM('/ddilling/*')
CALL PGM(QRYIFSLIB) PARM('/ddilling/*' '\s')
CALL PGM(QRYIFSLIB) PARM('/*' '\s' '\X:*NONLOCAL,/ddilling')
RNMIFSF Rename a file in the Integrated File System. It can be used to rename files whose names include special characters not support by the REN command. One common example of an unsupported character is the backslash (\).

Example:
CALL RNMIFSF PARM('[filepathold]' '[filepathnew]'


Using IFSTOOL commands in a CL program or without a terminal session
The commands print informational messages to a terminal session. They might also prompt the user for input or confirmation. The programs use STDIN and STDOUT streams for input and output.

To "hide" the terminal session, STDIN, and STDOUT can be redirected to files by using an override database file command. If the programs are run in batch, IBM i redirects STDOUT to QPRINT (a spool file) while STDIN is redirected to QINLINE. For more information about standard devices, see the "STDIN, STDOUT, and STDERR" section in the ILE C Programmer's Guide in IBM i Documentation. The following example is a CL wrapper over DELTREE. It redirects the output to a file DELTREEOUT. The confirmation prompt is replied to by using a file DELTREE that contains one record with the data 'Y'.

/* DELTREECL example */
 PGM
              OVRDBF     FILE(STDOUT) TOFILE(DDILLING/DELTREEOUT)
              OVRDBF     FILE(STDIN) TOFILE(DDILLING/DELTREEIN) +
                                    MBR(*FIRST)
              CALL            PGM(DELTREE) PARM('/ddilling/b')
             /* Note that if a parm is passed to a one of these utilites */
             /* a null must be added after the last character .          */
             /* See the CL Programming reference - the section on        */
             /* calling ILE C programs from a CLP - for further details. */
             /* Example:                                                 */
             /* DCL    VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')        */
             /* CHGVAR VAR(&PATH) VALUE('/ddilling/b' *CAT &NULL)        */
             /* CALL   PGM(DELTREE) PARM(&PATH)                          */
 ENDPGM

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Historical Number

19175649

Document Information

Modified date:
17 March 2022

UID

nas8N1019580