aftp_rename

The aftp_rename call renames a file on the AFTP server. A connection to the AFTP server must be established before using this call.

AFTP_ENTRY aftp_rename(
IN AFTP_HANDLE_TYPE
connection_id,
IN unsigned char AFTP_PTR
oldfile,
IN AFTP_LENGTH_TYPE
oldlength,
IN unsigned char AFTP_PTR
newfile,
IN AFTP_LENGTH_TYPE
newlength,
OUT AFTP_RETURN_CODE_TYPE AFTP_PTR
return_code
);

Parameters

connection_id
An AFTP connection object originally created with aftp_create.
oldfile
The name of the file to be renamed.

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 be either an absolute or relative path name.

oldlength
The length in bytes of the oldfile parameter.
newfile
The new name of the file.

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 be either an absolute or relative path name.

newlength
The length in bytes of the newfile parameter.
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:       newfile="/a/foo.file"
     *   VM native naming:       newfile="foo.file.a"
     *   MVS PDS common naming:  newfile="/user.clist/foo"
     *   MVS PDS native naming:  newfile="'user.clist(foo)'"
     *   MVS sequential common:  newfile="/user.qual.a.foo"
     *   MVS sequential native:  newfile="'user.qual.a.foo'"
     */
    static unsigned char AFTP_PTR newfile = "/user.clist/foo";
    static unsigned char AFTP_PTR oldfile = "/user.clist/abc";

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

    aftp_rename(
        connection_id,
        oldfile,
        (AFTP_LENGTH_TYPE)strlen(oldfile),
        newfile,
        (AFTP_LENGTH_TYPE)strlen(newfile),
        &aftp_rc);

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

}
 

Line Flows

The rename request and the old and new file names are sent to the AFTP server and the call waits for a response indicating the success or failure of the rename operation.