The aftp_receive_file call receives a single file from the AFTP server. A connection to the AFTP server must be established before using this call.
AFTP_ENTRY aftp_receive_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_receive_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 receiving AFTP file.\n");
}
}
The request to receive the file is sent to the AFTP server. A send file indicator is returned to the AFTP client. All records of the file are then sent from the AFTP server to the AFTP client.