aftp_send_file

The aftp_send_file call sends a single file to the AFTP server. A connection to the AFTP server must be established before using this call.

AFTP_ENTRY aftp_send_file(
IN AFTP_HANDLE_TYPE
connection_id,
IN unsigned char AFTP_PTR
local_file,
IN AFTP_LENGTH_TYPE
local_file_length,
IN unsigned char AFTP_PTR
remote_file,
IN AFTP_LENGTH_TYPE
remote_file_length,
OUT AFTP_RETURN_CODE_TYPE AFTP_PTR
return_code
);

Parameters

connection_id
An AFTP connection object originally created with aftp_create.
local_file
The name of the file sent from the AFTP client. The format of this name can be either the native syntax on the AFTP client or the AFTP common naming convention described in the APPC Application Suite User's Guide. The file specified can contain either an absolute or relative path name.
local_file_length
The length of the local_file parameter in bytes.
remote_file
The name given to the file received on the AFTP server. The format of this name can be either the native syntax on the AFTP server or the AFTP common naming convention described in the APPC Application Suite User's Guide. The file specified can contain either an absolute or relative path name.
remote_file_length
The length of the remote_file parameter in bytes.
return_code
The return code issued for this function. See AFTP Return Codes for the list of possible return codes.

Example

{
    AFTP_HANDLE_TYPE                     connection_id;
    AFTP_RETURN_CODE_TYPE                aftp_rc;

    /* The value used for filespec will vary based on platform:
     *   VM common naming:       filespec="/a/myfile.dat"
     *   VM native naming:       filespec="myfile.dat.a"
     *   MVS PDS common naming:  filespec="/user.mypds/myfile"
     *   MVS PDS native naming:  filespec="'user.mypds(myfile)'"
     *   MVS sequential common:  filespec="/user.qual.myfile"
     *   MVS sequential native:  filespec="'user.qual.myfile'"
     */
    static unsigned char AFTP_PTR local_file = "/user.mypos/myfile";
    /* MVS */
        static unsigned char AFTP_PTR remote_file = "/a/myfile.dat";
    /* VM */

    /*
     * Before issuing the example call, you must have:
     *    a connection_id, use:         aftp_create()
     *    a connection to server, use:  aftp_connect()
     */

    aftp_send_file(
        connection_id,
        local_file,
        (AFTP_LENGTH_TYPE)strlen(local_file),
        remote_file,
        (AFTP_LENGTH_TYPE)strlen(remote_file),
        &aftp_rc);

    if (aftp_rc != AFTP_RC_OK) {
        fprintf(stderr, "Error sending AFTP file.\n");
    }
}
 

Line Flows

The send file request is sent to the AFTP server, immediately followed by all records of the files. The call waits for a response indicating the success or failure of the send file operation.