+

Search Tips | Advanced Search

Transfer physical files located in QSYS.LIB on IBM i

Managed File Transfer supports the transfer of physical file members in the QSYS.LIB file system between two IBM i systems. Consider the following information when you request file transfers of physical file members.

A physical file member on IBM i is located in a physical file, which in turn is located in a library on IBM i. A library can be one of the standard libraries that ship with the operating system (for example, QSYS or QGPL) or it can be a library that we have created.

Physical files in the QSYS.LIB file system are identified in two different ways on IBM i. When you run CL commands on an IBM i command line, use the following naming syntax:
FILE(library name/file name) MBR(member name)
For example, a physical file member that is called MYMBR is in a file that called MYFILE in a library that is called SOMELIB is identified as FILE(SOMELIB/MYFILE) MBR(MYMBR). We can also identify the same physical file member by specifying a UNIX-like path name that follows the Integrated File System (IFS) naming convention. Using the IFS naming convention, MYMBR in MYFILE in SOMELIB has the following path name:
/QSYS.LIB/SOMELIB.LIB/MYFILE.FILE/MYMBR.MBR
For more information, see Path names in the QSYS.LIB file system. Managed File Transfer on IBM i recognizes the IFS naming convention but does not support the syntax used by CL commands. The following examples illustrate valid and invalid path names for MFT. The following example is a valid path name for a physical file member:
/QSYS.LIB/SOMELIB.LIB/MYFILE.FILE/MYMBR.MBR 
This example assumes MYFILE is a physical file in the library SOMELIB and contains a member that is called MYMBR. The following examples are invalid path names for physical file member transfers:

  • /QSYS.LIB/SOMELIB.LIB/MYFILE.FILE (.FILE assumes a SAVF, not a physical file. If MYFILE is a physical file, the transfer fails with an invalid file type error)
  • /QSYS.LIB/MYLIB.LIB/ (physical file and member names are required)
  • /QSYS.LIB/SOMELIB.LIB/MYFILE.FILE/MYMBR (the member name must contain an extension of .MBR)
  • /QSYS.LIB/SOMELIB.LIB/MYFILE/MYMBR.MBR (the physical file name extension must be .FILE)


Transfer multiple physical file members from a physical file in a single transfer request

Managed File Transfer on IBM i supports the transfer of multiple physical file members from a single physical file as a single transfer request. We can specify an appropriate path name that includes wildcard characters as shown in the following examples:

  • ABCLIB contains a physical file MYFILE with multiple members. To transfer all these members in a single request, specify the following path name: /QSYS.LIB/ABCLIB.LIB/MYFILE.FILE/*.MBR
  • XYZLIB contains a physical file MYFILE whose member names differ by a single character, that is: TEST1.MBR, TEST2.MBR. TEST3.MBR, and so on. To transfer all these members in a single request, specify the following path name: /QSYS.LIB/XYZLIB.LIB/MYFILE.FILE/TEST?.MBR.

The following types of transfer requests are not supported for transferring multiple physical file members and result in an error:

  • /QSYS.LIB/MYLIB.LIB/*.*
  • /QSYS.LIB/MYLIB.LIB/*
  • /QSYS.LIB/MYLIB.LIB/*.FILE/MYMBR.MBR
  • /QSYS.LIB/MYLIB.LIB/MYFILE*.FILE/*.MBR (there is no support for wildcarding on file names, only on member names)
  • /QSYS.LIB/MYLIB.LIB/*.FILE/*.MBR
  • /QSYS.LIB/MYLIB.LIB/MYFILE.FILE (.FILE assumes a SAVF not a physical file, so if MYFILE is a physical file, the transfer fails with invalid file type error)


Transfer physical file members to and from non-IBM i systems

MFT supports the transfer of physical file members to and from non-IBM i systems, such as UNIX, Linux, and Windows. All transfers must be done in text mode. The following examples illustrate some of the supported fteCreateTransfer requests when working with non-IBM i systems:

  • This command transfers physical file member FILE(FROMIBMI/FILE1) MBR(FILE1) on IBM i to text file /home/qfte/fromibmi/linux.mbr.txt on Linux:

    fteCreateTransfer -da linux -dm QM1 -sa ibmi -sm QM1 -t text -df /home/qfte/fromibmi/linux.mbr.txt /qsys.lib/fromibmi.lib/file1.file/file1.mbr

  • This command transfers physical file member FILE(FROMIBMI/FILE1) MBR(FILE1) on IBM i to text file C:\FTE\fromibmi\windows.mbr.txt on Windows:

    fteCreateTransfer -da windows -dm QM1 -sa ibmi -sm QM1 -t text -df C:\FTE\fromibmi\windows.mbr.txt /qsys.lib/fromibmi.lib/file1.file/file1.mbr

  • This command transfers text file C:\FTE\toibmi\file.txt on Windows to physical file member FILE(TOIBMI/EXISTS) MBR(WINDOWS) on IBM i:

    fteCreateTransfer -da ibmi -dm QM1 -sa windows -sm QM1 -t text -df /qsys.lib/toibmi.lib/exists.file/windows.mbr C:\FTE\toibmi\file.txt 

The following commands are examples of invalid physical file member transfers with non-IBM i systems:

  • This command fails because the source file on Windows has a .txt file extension but a destination directory of .file has been specified. When transferring using the destination directory parameter to specify a destination physical file, the source file extension must be .mbr file, for example, C:\FTE\toibmi\file.mbr

    fteCreateTransfer -da ibmi -dm QM1 -sa windows -sm QM1 -t text -dd /qsys.lib/toibmi.lib/windows.file C:\FTE\toibmi\file.txt
  • The default transfer mode is binary and text mode must be specified when transferring physical file members.

    fteCreateTransfer -da windows -dm QM1 -sa ibmi -sm QM1 -df C:\FTE\fromibmi\file.bin /qsys.lib/fromibmi.lib/file1.file/file1.mbr

MFT supports the transfer of physical file members that are in the QSYS.LIB file system but does not support the transfer of source physical file members that are in the QSYS.LIB file system. File transfers in the QDLS file system are supported using the provided sample user exits. We can use the user exit samples provided in MFT for the following tasks:

  • Transfer files in the QDLS file system.
  • Automatically transfer physical file members from an IBM i library in the same way as an MFT file monitor.
  • Delete an empty file object when the source file member is deleted as part of the transfer.

For more information, see Sample MFT on IBM i user exits. Parent topic: Guidelines for transferring files


Related reference

Last updated: 2020-10-04