Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel
Table of Contents

Overview

Anchor
1057863
1057863
File specifications can appear in a variety of UDM commands, from copy to forfiles.

Anchor
1057864
1057864
On IBM i, a simple set of rules governs how the full file specification used in an operation is constructed.

Anchor
1057865
1057865
Since there are still subtle differences between source and destination side file specifications, in terms of how they are derived, separate rules are provided for each type of specification:

  • Source File Specification
  • Destination File Specification
    • Source and Destination in LIB
    • Destination (only) in LIB

IBM i Source File Specification Rules

Anchor
1057886
1057886
The following rules apply to file specifications that are in the source position in a copy command.

Anchor
1057887
1057887
(In all examples, CURLIB is the current library.)

  1. If the file specification contains only the file portion, the current library is pre-pended to the name to refer directly to a file with no member component.
    Example:
     

    Panel
    COPY SRC=MYFILE

    The absolute path derived would be CURLIB/MYFILE.
     

  2. If the file specification contains only file and member portions, the current library is pre-pended to the name to refer to a specific member in a file.

    Anchor
    1057892
    1057892
    Example:
     

    Panel
    COPY SRC=MYFILE(MYMBR)

    The absolute path derived would be CURLIB/MYFILE(MYMBR).
     

  3. If the file specification contains only library and file portions, an absolute path without a member component is used.

    Anchor
    1057895
    1057895
    Example:
     

    Panel
    COPY SRC=MYLIB/MYFILE

    The absolute path would be exactly as given: MYLIB/MYFILE.
     

  4. If a file specification contains library, file, and member portions, all of those components are used explicitly in the absolute path.

    Anchor
    1057898
    1057898
    Example:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR)

    The absolute path would be MYLIB/MYFILE(MYMBR).

IBM i Destination File Specification Rules

Anchor
1057917
1057917
Destination path names follow many of the same rules as source path names, with one big exception: all or part of the destination path name may be derived using a name (or names, in the case of IBM i to IBM i LIB file system copies) coming from the source side of a transfer operation.

Source and Destination in LIB File System

Anchor
1057935
1057935
The following rules apply for IBM i to IBM i transfers where both the source and destination are operating in the LIB file system.

Anchor
1057936
1057936
In these example, the current destination library is DSTLIB and the absolute path of the source file being copied is MYLIB/MYFILE(MYMBR).

  1. If the destination file specification contains an empty path (no library, file, or member portions), the file and member portions are derived from the source path. If the destination file is to be a save file, the absolute path in this case would be DSTLIB/MYFILE. If the destination file is to be a physical file, the absolute path would be DSTLIB/MYFILE(MYMBR).

    Anchor
    1057938
    1057938
    Examples:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR)

    The result is a destination name of DSTLIB/MYFILE(MYMBR) if the destination file type is a physical file.
     

    Panel
    COPY SRC=MYLIB/MYFILE

    The result is a destination name of DSTLIB/MYFILE if the destination file type is a save file.
     

  2. If the destination file specification contains only a file portion, the current library is pre-pended to the absolute path. In this case, if the destination file is to be a save file, the absolute path would be DSTLIB/YOURFILE. If the destination file is to be a physical file, the absolute path would be DSTLIB/YOURFILE(MYMBR).

    Anchor
    1057942
    1057942
    Examples:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOURFILE

    The result is a destination name of DSTLIB/YOURFILE(MYMBR) if the destination file type is a physical file.
     

    Panel
    COPY SRC=MYLIB/MYFILE DST=YOURFILE

    The result is a destination name of DSTLIB/YOURFILE if the destination file type is a save file.
     

  3. If the destination file specification contains only a file portion (with an empty member), the result is exactly the same as when just a destination file name is given.

    Anchor
    1057946
    1057946
    Example:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOURFILE()

    The result is a destination name of DSTLIB/YOURFILE(MYMBR) if the destination file type is a physical file.
     

  4. If the destination file specification contains only file and member portions, the resulting absolute path is DSTLIB/YOURFILE(YOURMBR) if a physical file is wanted.

    Anchor
    1057949
    1057949
    Example:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOUFILE(YOURMBR)

    The result is a destination name of DSTLIB/YOURFILE(YOURMBR) if the destination file type is a physical file.
     

  5. If the destination file specification contains only a library portion, that library is used instead of the current library. In this case, an absolute path of YOURLIB/MYFILE is used if a save file is wanted. If a physical file is wanted, an absolute path of YOURLIB/MYFILE(MYMBR) is used.

    Anchor
    1057952
    1057952
    Examples:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOURLIB/

    The result is a destination name of YOURLIB/MYFILE(MYMBR) if the destination file type is a physical file.
     

    Panel
    COPY SRC=MYLIB/MYFILE DST=YOURLIB/

    The result is a destination name of YOURLIB/MYFILE if the destination file type is a save file.
     

  6. If the destination file specification contains only library and file portions, an absolute path of YOURLIB/YOURFILE is derived if a save file is wanted. If a physical file is wanted, YOURLIB/YOURFILE(MYMBR) is used.

    Anchor
    1057956
    1057956
    Examples:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOURLIB/YOURFILE

    The result is a destination name of YOURLIB/YOURFILE(MYMBR) if the destination file type is a physical file.
     

    Panel
    COPY SRC=MYLIB/MYFILE DST=YOURLIB/YOURFILE

    The result is a destination name of YOURLIB/YOURFILE if the destination file type is a save file.
     

  7. If the destination file specification contains library and file portions, as well as an empty member name, the result is exactly the same as when the file specification contains only library and file portions.

    Anchor
    1057960
    1057960
    Example:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR) DST=YOURLIB/YOURFILE()

    The result is a destination name of YOURLIB/YOURFILE(MYMBR) if the destination file type is a physical file.
     

  8. If the destination file specification contains a complete absolute path (library, file, and member portions), the source file name has no effect on the destination path in any way. In this case, if the destination file type is a save file, YOURLIB/YOURFILE is used. If the destination file type is a physical file, YOURLIB/YOURFILE(YOURMBR) is used.

    Anchor
    1057963
    1057963
    Examples:
     

    Panel
    COPY SRC=MYLIB/MYFILE(MYMBR)DST=YOURLIB/YOURFILE(YOURMBR)

    The result is a destination name of YOURLIB/YOURFILE(YOURMBR) if the destination file type is a physical file.
     

    Panel
    COPY SRC=MYLIB/MYFILE DST=YOURLIB/YOURFILE

    The result is a destination name of YOURLIB/YOURFILE if the destination file type is a save file.
     

  9. In cases where a member is specified explicitly in the destination file name and the destination file type is a save file, an error is issued.
     

    Note
    titleNote

    If the user issues a cd dst-logical-name=.. command to blank out the current library on the destination side, the library name in the absolute path of the source file is used in the destination absolute path in cases where no library is specified explicitly.

     

    Anchor
    1057968
    1057968
    This works only for IBM i to IBM i copies where both operating systems are operating in the LIB file system.
    Anchor
    1057969
    1057969
    Example:
     

    Panel
    CD DST=..
    COPY SRC=MYLIB/MYFILE(MYMBR)

    The result is a destination of MYLIB/MYFILE(MYMBR), using the source's library, file, and member names, because none are supplied explicitly in the copy command. The current directory on the destination side is empty because the command cd DST=.. was issued.

Destination (only) in LIB File System

Anchor
1058002
1058002
Transfers where only the destination is operating in the LIB file system produce slightly different results.

Anchor
1058003
1058003
The following rules apply for:

  • Copies from non-IBM i machines to an IBM i machine operating in the LIB file system
  • Copies from IBM i machines working in the HFS file system to an IBM i machine operating in the LIB file system,

Anchor
1058006
1058006
These operations do not make use of source attributes describing all the library and file portions of the source file specification.

Anchor
1058007
1058007
(In the following example, the source file being copied is MYFILE and the current library on the destination side is MYDSTLIB.)

  1. If the destination file specification contains an empty path (no library, file, or member portions), the source file name is used for the file and member names on the destination side. If the destination file is to be a save file, the absolute path in this case would be DSTLIB/MYFILE. If the destination file is to be a physical file, the absolute path would be DSTLIB/MYFILE(MYFILE).

    Anchor
    1058009
    1058009
    Example:
     

    Panel
    COPY SRC=MYFILE

    DSTLIB/MYFILE(MYFILE) will be used as the destination name if the destination file type is a physical file and DSTLIB/MYFILE will be used if the destination file type is a save file.
     

  2. If the destination file specification contains only a file portion, the current library is pre-pended to the absolute path and the source file name is used for the member (if it applies). In this case, if the destination file is to be a save file, the absolute path would be DSTLIB/YOURFILE. If the destination file is to be a physical file, the absolute path would be DSTLIB/YOURFILE(MYFILE).

    Anchor
    1058012
    1058012
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURFILE

    DSTLIB/YOURFILE(MYFILE) will be used as the destination name if the destination file type is a physical file and DSTLIB/YOURFILE will be used if the destination file type is a save file.
     

  3. If the destination file specification contains only a file portion and an empty member portion, the result is exactly the same as when the file specification contains only file portion.

    Anchor
    1058015
    1058015
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURFILE()

    DSTLIB/YOURFILE(MYFILE) will be used as the destination name if the destination file type is a physical file.
     

  4. If the destination file specification contains only file and member portions, the resulting absolute path is DSTLIB/YOURFILE(YOURMBR) if a physical file is wanted.

    Anchor
    1058018
    1058018
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURFILE(YOURMBR)

    DSTLIB/YOURFILE(YOURMBR) will be used as the destination name if the destination file type is a physical file.
     

  5. If the destination file specification contains only a library portion, that library is used instead of the current library. In this case, an absolute path of YOURLIB/MYFILE is used if a save file is wanted. If a physical file is wanted, an absolute path of YOURLIB/MYFILE(MYFILE) is used.

    Anchor
    1058021
    1058021
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURLIB/

    YOURLIB/MYFILE(MYFILE) is used as the destination name if the destination file type is a physical file or YOURLIB/MYFILE if the destination file type is a save file.
     

  6. If the destination file specification contains only library and file portions, an absolute path of YOURLIB/YOURFILE is derived if a save file is wanted. If an absolute path of YOURLIB/YOURFILE(MYFILE) is used if a physical file is wanted,

    Anchor
    1058024
    1058024
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURLIB/YOURFILE

    YOURLIB/YOURFILE(MYFILE) is the destination name if a physical file is wanted and YOURLIB/YOURFILE is used if a save file is wanted.
     

  7. If the destination file specification contains library and file portions, as well as an empty member portion, the result is exactly the same as when the specification contains only a library and file portions.

    Anchor
    1058027
    1058027
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURLIB/YOURFILE

    YOURLIB/YOURFILE(MYFILE) is the destination name if a physical file is wanted.
     

  8. If the destination file specification contains a complete absolute path (library, file, and member portions), the source file name has no effect on the destination path in any way. In this case, if the destination file type is a physical file, YOURLIB/YOURFILE(YOURMBR) is used.

    Anchor
    1058030
    1058030
    Example:
     

    Panel
    COPY SRC=MYFILE DST=YOURLIB/YOURFILE(YOURMBR)

    YOURLIB/YOURFILE(YOURMBR) is the destination if the destination file type is a physical file.
     

  9. In cases where a member is specified explicitly in the destination file name and the destination file type is a save file, an error is issued.