We had a client call after he had managed to create an IFS directory which could not be deleted using the WRKLNK interface or the RMDIR command using our new FTP Client. We didn’t realize that the IBM OS based commands could not delete items on the IFS under certain circumstances, but we also found that those same commands would refuse to create the objects as well.
The client had created a directory called c:ftpclnt in the root directory, trying to delete the item using option 4 from the WRKLNK command failed as did the RMDIR command with a message stating the object could not be found.
Here is a sample of the message sent
Additional Message Information
Message ID . . . . . . : CPFA0A9 Severity . . . . . . . : 40
Message type . . . . . : Diagnostic
Date sent . . . . . . : 11/17/09 Time sent . . . . . . : 18:09:12
Message . . . . : Object not found. Object is /c:/testdir.
Cause . . . . . : Object /c:/testdir, or a directory in the object path,
could not be found, or its type cannot be resolved by this function.
Recovery . . . : Correct the name or specify an object of the correct type.
To determine if the object exists, use the Work with Object Links (WRKLNK)
command. If the name exists, check the type of the object. If the name
contains symbolic link objects, ensure the path names they resolve to exist.
Retry the operation.
Press Enter to continue.
F3=Exit F6=Print F9=Display message details
F10=Display messages in job log F12=Cancel F21=Select assistance level
Apparently this is because the OS commands interpret the character differently,as can be see above it created a path of /c:/testdir which reversed the ” and called it a directory yet didn’t create a subdirectory of /testdir under c:….
We looked at the code which allowed the object to be created and it was the Unix API mkdir(). We also tested the delete of the link using our product and it did as we expected and successfully deleted the object. The question was why did the IBM commands refuse to find the object.
We logged a call with IBM support and they sent us to the following information . Talking with support we explained that we had Googled the problem and didn’t find the document they had sent, they explained this was because the document is contained in a knowledge base that is not viewable by web robots.
So if you are having the same problems, hopefully Google will find this reference and save you some time.
I have also copied the content below just in case the link doesn’t work for some? The customer said his link was only able to be deleted by using Navigator or our program, so make sure you try a few options.
Document Title: Renaming or Removing Files from the Integrated File System That Have Names That Are Not Valid
This document provides tips on how to delete documents and directories in the Integrated File System that were created with invalid names.
Certain applications may create invalid file names in the operating system Integrated File System. For example, a file name containing slashes or quotes is not valid and cannot be removed by the operating system file system code. When trying to rename or delete these files, the iSeries interprets the slashes and quotes as part of the file name and generates an error, CPFA0A9 Object not found, because this naming convention is not valid for the iSeries system.
Note: When this problem is encountered, the best way to remove or access these files is to use the same application that created them.
If the original application is not available or it is not able to remove these objects, there are some other options that can be used. These options include FTP, QShell, iSeries Navigator, IFS tools DLTIFSF, and CleanNames.
FTP can be used to rename or delete files and directories with invalid names that contain only standard ANSI characters. For example, FTP can be used to delete or rename files with names containing a backslash (”), but cannot handle names with embedded nulls or Unicode characters.
FTP Commands: REN (rename) and DEL (delete) for files, RMDIR (remove directory) for directories.
Note: Directories must be empty before they can be removed with the RMDIR command.
For example, a file was created in the root of the Integrated File System. The files is called MYFILE.TXT and must be deleted. Below is a WRKLNK showing how this file looks in the operating system Integrated File System.
Work with Object Links
Directory . . . . : /
Type options, press Enter.
3=Copy 4=Remove 5=Next level 7=Rename 8=Display attributes
11=Change current directory …
Opt Object link Type Attribute Text
QSYS.LIB DIR PROD System Library
Parameters or command
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F12=Cancel F17=Position to
F22=Display entire field F23=More options
Take the following steps to remove the file:
Note: An FTP session may be started either from the iSeries Command Line (on the same iSeries system or on a different iSeries system) or it may be started from a PC DOS Command Prompt.
1 To start an FTP session to the IBM System i system, on the operating system command line type the following command:
Press the Enter key. You are prompted to sign on and type your password.
2 Once signed on, change the naming format from operating system to UNIX by issuing the NAMEFMT 1 command (quote site namefmt 1, and press the Enter key). The FTP session should respond with 250 Now using naming format “1”.
3 To change to the root of the Integrated File System, type the following:
Press the Enter key. Response from the iSeries family system should be 250 “/” is current directory.
If the file is located in a directory or a subdirectory rather than on the root of the Integrated File System, issue CD dirname, and press the Enter key. Response from the iSeries family system should be 250 “/dirname” is current directory.
4 Type the following:
Press the Enter key. The response is 250 Deleted file /MYFILE.TXT. This also works with the RENAME command.
Note: Remember that this is a UNIX format. Therefore, file names are case-sensitive.
The same steps may be used for removing directories with invalid names (such as MYDIR). To do so, follow the steps above substituting the RMDIR command in place of the DEL command used in the example. If the directory which has the invalid character in the name contains other DIRs or STMFs, you will probably need to do a REN on the directory with the invalid character in the name and give it a valid name. At this point, you can use normal methods to delete the contents of the directory and remove it as you normally would.
QShell can be used to remove some invalid file names, including those that contain a backslash as part of the name. To remove a name with a backslash, escape the character with an additional backslash or double quote the name.
Example: To remove “myfile” use ‘rm myfil\le’ or ‘rm “myfile”‘
To use QSHELL to remove the files, do the following:
1 From an operating system command line, type the following:
Press the Enter key.
2 To change directory to the directory containing the invalid file name, type the following: CD mydir
3 To remove the file, type the following: RM “invalid file name”
Note: Double-quotes are required in the RM command.
4 Press F3 to end QSHELL.
The iSeries Navigator File Systems | Integrated File Systems option can be used to delete or rename files and directories with names that Windows considers invalid (and hence network drives can’t handle). This includes names like *.* or *dir and many special ANSI characters such as the trademark symbol (TM) and so on.
To use iSeries Navigator to remove or rename the files, do the following:
1 Open iSeries Navigator.
2 Expand My Connections.
3 Expand File Systems.
4 Expand Integrated File systems and locate the directory or file containing the invalid file name.
5 Right click on the directory or file name and chose the option to delete or rename the file.
IFSTOOLS DLTIFSF and RNMIFSF:
DLTIFSF and RNMIFSF can be used to delete or rename files or directories with names that contain a backslash.
Example (delete): CALL DLTIFSF ‘[filepath]’
Example (rename): CALL RNMIFSF PARM(‘[filepathold]’ ‘[filepathnew]’
Information about downloading and installing IFSTOOLS is in Rochester Support Center knowledgebase document 19175649, Integrated File System Tools: DEL, DELTREE, CMDALL, CHGAUTALL, CHGOWNALL, QRYIFSLIB, DLTIFSF, RNMIFSF:
CleanNames is a Java toolbox utility. It is the best option to use when cleaning up thousands of files or when file names include embedded nulls. CleanNames can clean up invalid directory and file names such as: “*.*”, “*name”, “name”, name with embedded null, name with a Unicode character, and so on. It does not work for names of “.”, “..”, or names that include a forward slash (‘/’).
CleanNames SystemName TargetDir [option]
SystemName – AS/400 system name as entered in DNS or local hosts table
or the AS/400 system IP address. The name “localhost”
is a valid name when run from the AS/400 jvm.
TargetDir – The directory from which to start work. This is the
directory to delete all files from or the directory
to search for other directories with invalid names.
[option] – The menu option to execute. If not supplied, the user
is prompted for one of following options:
1 Rename all files in the target directory to a valid name.
The names are qfrecov1, qfrecov2, etc…
2 Rename all directories in the target directory to a valid name.
The names are qdrecov1, qdrecov2, etc…”
3 List all objects in the target directory. Prompt to rename.
WRKLNK Option 4=Remove:
The WRKLNK command is not Unicode-enabled. It cannot work with files or directories that have ANSI or Unicode characters that do not exist in the operating system CCSID.
will list Stream Files and Directories on the root of the IFS. Normal IFS commands (5 to display, and so on) can be used to locate the Stream File with the invalid name.
Use opt 4 to delete file or opt 9 to delete a directory and its contents.