Copy Cloud to File API

Use the Qicc_copy_cloud_to_file API to copy a file from the cloud to the IFS. If the file exists it is updated. If the file does not exist it is created.

You cannot use Cloud Storage Solutions to work with files in the /QSYS.LIB file system.

If you copy a file from an FTP cloud server to the IBM i computer, and that file was not originally copied to the FTP server using Cloud Storage Solutions, Cloud Storage Solutions assigns the file a coded character set identifier (CCSID) of 65535. A CCSID of 65535 means the operating system treats the file as binary data and it is unreadable in an editor.

If you copy a file from an Amazon S3 or IBM Cloud Object Storage cloud server to the IBM i computer, and that file was not originally copied to the cloud server using Cloud Storage Solutions, Cloud Storage Solutions reads the data and from it assigns the file a coded character set identifier (CCSID) of either 1208 (UTF-8) if it is text, or 65535 if it is binary.

If the CCSID of the downloaded file is not correct, you can change it. See the topic Changing the Coded Character Set Identifier (CCSID) in the IBM Documentation.

Required Parameter Group:
1 Resource name Input Char(10)
2 Cloud file name Input Path name structure
3 IFS file name Input Path name structure
4 User data Input Char(52)
5 Asynchronous flag Input Byte(4)
6 Handle Output Byte(4)
7 Error code I/O Error code structure
Threadsafe: No

Required Parameter Group

Resource name
INPUT; CHAR(10)

Specify the unique name of the resource. The name is between 1 and 10 characters long and must be left-justified and padded with spaces.

Cloud file name
INPUT; Path name structure

The path and name of the file in the cloud, for example: dir1/dir2/file.txt. In C++ programs, this is the Qlg_Path_Name_T structure. Do not include the container, bucket, or root directory that is defined in the resource. With most resources the directory and file names are case-sensitive. FTP resources are not case-sensitive when copying to an IFS directory on an IBM i computer. For information on the path name structure, see Path name format in the IBM Documentation.

IFS file name
INPUT; Path name structure

An IFS path and name for the file to be copied from the cloud. In C++ programs, this is the Qlg_Path_Name_T structure. The path must begin with a forward slash (/). If the directories do not exist, they are created. The user copying the file must have Execute (*X) authority on all directories in the path, and Write (*W) authority on the last directory in the path. If the file was copied before and exists in the path, the user must have Write access to it. For example, to copy file.txt to /home/user/jdoe, you must have Execute authority on the home, user, and jdoe directories, and Write authority on jdoe. If file.txt is already there, you must have Write authority on it. For information on authorities, see Planning integrated file system security in the IBM Documentation. For information on the path name structure, see Path name format in the IBM Documentation.

User data
INPUT; CHAR(52)

Data provided by the caller and passed to the exit programs to help the caller identify which file copy completed.

Asynchronous flag
INPUT; BYTE(4)

Specifies whether the copy operation is run in the same job as the command, or run asynchronously in its own separate batch job. When you copy files asynchronously, you do not have to wait for large files to finish copying before running other commands, which can take a long time. You can also use the IBM i facilities to work with asynchronous jobs, for example by scheduling when the job runs.

If zero, the function will wait for the copy to finish before returning to the caller. If non-zero, the function will initiate the copy and return without waiting for the copy to finish.

Handle
OUTPUT; BYTE(4)

An ID that uniquely identifies this file transfer. It will be passed to exit programs that are registered with the Cloud Connect exit point to uniquely identify which file transfer completed.

Error code
I/O; Error code structure

The error code information structure in the ERRC0100 format. For information, see the Error code parameter topic in the IBM Documentation.