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
);
{
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");
}
}
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.