Blog Archive

AS400 copy IFS filename with Single Quotes

Say for example, if you want to use CPYFRMIMPF or CPYTOIMPF commands on an IFS file for which the name contains a single quote, then it will throw an error

Message ID . . . . . . : CPD0189
Message . . . . : Matching quote not found in path name.

CPYFRMIMPF FROMSTMF('/usr/local/customer''s.txt') TOFILE(CUSTOMER)   
Matching quote not found in path name.                               
Error found on CPYFRMIMPF command. 

Cause . . . . . : Path name /usr/local/customer's.txt specified for FROMSTMF contains an apostrophe (') or double quote (") characters that are not matched.

Solution: Just enclose the path name with additional set of double quotes

CPYFRMIMPF FROMSTMF('"/usr/local/customer''s.txt"') TOFILE(CUSTOMER)   

Here is a snippet from the IBM infocenter on Path name rules for CL commands and displays.

The path name must be enclosed in additional sets of apostrophes (') or quotation marks (") if any of the following characters is used in a component name:

  • Asterisk (*)
  • Question mark (?)
  • Apostrophe (')
  • 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: