aftp_change_dir

The aftp_change_dir call changes the current working directory on the AFTP server. A connection to the AFTP server must be established before using this call.

See AFTP File and Directory Concept for details on how the directory concept is handled for supported operating systems.

AFTP_ENTRY aftp_change_dir(
IN AFTP_HANDLE_TYPE
connection_id,
IN unsigned char AFTP_PTR
directory,
IN AFTP_LENGTH_TYPE
length,
OUT AFTP_RETURN_CODE_TYPE AFTP_PTR
return_code
);

Parameters

connection_id
An AFTP connection object originally created with aftp_create.
directory
The new current working directory name. 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 directory specified can be either an absolute or a relative path name.
length
The length of the directory 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 will vary based on platform:
     *   VM common naming:       directory = "/d"
     *   VM native naming:       directory = "/d"
     *   MVS PDS common naming:  directory = "/user.clist/"
     *   MVS PDS native naming:  directory = "'user.clist'"
     *   MVS data set prefix common:  directory = "/user.qual.a."
     *   MVS data set prefix native:  directory =
         "'user.qual.a.'"
     *   NT* common naming:    directory = "/c:/nt"
     *   NT native naming:     directory = "c:\\nt"
     */
    static unsigned char AFTP_PTR directory = "/user.clist/"; /*
    MVS */

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

     /*
      * Specify the new current working directory name
      * using the COMMON name format.
      */

     aftp_change_dir(
         connection_id,
         directory,
         (AFTP_LENGTH_TYPE)strlen(directory),
         &aftp_rc);

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

Line Flows

The directory name is sent to the AFTP server and the call waits for a response indicating the success or failure of the change directory operation.