Path name rules for CL commands and displays
When using an integrated file system command or display to operate on an object, you identify the object by supplying its path name.
The following list is a summary of rules to keep in mind when specifying path names. The term object in these rules refers to any directory, file, link, or other object:
- Object names must be unique within each directory.
- The path name that is passed to an integrated file system CL command must be represented in the coded character set identifier (CCSID) currently in effect for the job. If the CCSID of the job is 65535, the path name must be represented in the default CCSID of the job. Because text strings are normally encoded in CCSID 37, it is necessary to convert hard-coded path names to the job CCSID before passing the path to the command.
- Path names must be enclosed in single quotation marks (') when entered on a command line. These marks are optional when path names are entered on displays. If the path name includes any quoted strings, however, the enclosing ' ' marks must also be included.
- Path names are entered left to right, beginning with the highest-level directory and ending with the name of the object to be operated on by the command. The name of each component in the path is separated by a slash (/).
Some CL commands also allow the backslash (\) to be used as a separator by automatically converting the backslash (\) to a slash (/). Some other CL commands, however, treat the backslash (\) no differently than they treat any other character. Therefore, the backslash (\) separator should be used with caution.
For example:
'Dir1/Dir2/Dir3/UsrFile'or
'Dir1\Dir2\Dir3\UsrFile'
- The slash (/) and backslash (\) characters and nulls cannot be used in the individual components of the path name when the slash (/) and backslash (\) are used as separators. Lowercase letters are not changed to uppercase letters by the commands. The name might or might not be changed to uppercase, depending on whether the file system containing the object is case-sensitive and whether the object is being created or searched for.
- The length of an object name is limited by the file system the object is in and the maximum length of a command string. The commands accept object names up to 255 characters long and path names up to 5000 characters long.
- A separator character (for example: /) at the beginning of a path name means that the path begins at the topmost directory, the "root" (/) directory; for example:
'/Dir1/Dir2/Dir3/UsrFile'
- If the path name does not begin with a separator character (for example: /) , the path is assumed to begin at the current directory of the user entering the command; for example:
'MyDir/MyFile'where MyDir is a subdirectory of the user's current directory.
- A tilde (~) character followed by a separator character (for example: /) at the beginning of a path name means that the path begins at the home directory of the user entering the command; for example:
'~/UsrDir/UsrObj'
- A tilde (~) character followed by a user name and then a separator character (for example: /) at the beginning of a path name means that the path begins at the home directory of the user identified by the user name; for example:
'~user-name/UsrDir/UsrObj'
- In some commands, an asterisk (*) or a question mark (?) can be used in the last component of a path name to search for patterns of names. The * tells the system to search for names that have any number of characters in the position of the * character. The ? tells the system to search for names that have a single character in the position of the ? character. The following example searches for all objects whose names begin with d and end with txt:
'/Dir1/Dir2/Dir3/d*txt'The following example searches for objects whose names begin with d followed by any single character and end with txt:'/Dir1/Dir2/Dir3/d?txt'
- To avoid confusion with i5/OS® special values, path names cannot start with a single asterisk (*) character. To perform a pattern match at the beginning of a path name, use two asterisks (*); for example:
'**.file'This only applies to relative path names where no other characters precede the asterisk (*).
- When operating on objects in the QSYS.LIB file system, the component names must be of the form name.object-type; for example:
'/QSYS.LIB/PAY.LIB/TAX.FILE'
- When operating on objects in the independent ASP QSYS.LIB file system, the component names must be of the form name.object-type; for example:
'/asp_name/QSYS.LIB/PAYDAVE.LIB/PAY.FILE
- The path name must be enclosed in additional sets of single quotation marks (') or quotation marks (") if any of the following characters is used in a component name:
- Asterisk (*)
To avoid confusion with i5/OS special values, path names should not start with a single asterisk (*) character.
- Question mark (?)
- Single quotation mark (')
- Quotation mark (")
- Tilde (~), if used as the first character in the first component name of the path name (if used in any other position, the tilde is interpreted as just another character)
For example:
'"/Dir1/Dir/A*Smith"'or
'''/Dir1/Dir/A*Smith'''This practice is not recommended because the meaning of the character in a command string can be confusing and it is more likely that the command string might be entered incorrectly.
- Do not use a colon (:) in path names. It has a special meaning within the system.
- The processing support for commands and associated user displays does not recognize code points below hexadecimal 40 as characters that can be used in command strings or on displays. If these code points are used, they must be entered as a hexadecimal representation, such as the following example:
crtdir dir(X'02')Therefore, use of code points below hexadecimal 40 in path names is not recommended. This restriction applies only to commands and associated displays, not to APIs. In addition, a value of hexadecimal 0 is not allowed in path names.
Parent topic:
Accessing using CL commands
Related concepts
File systems
Related information
Control language (CL)