Copying Files between the Client and Server

The C$COPY library routine allows the transfer of files between the application host and the display host in thin client and between directories on the display host. A special name notation of "@[DISPLAY]:" indicates that a particular file is located on the display host, or client. Use this designation for the source file or the destination file in the call to C$COPY. If the copy operation is performed entirely on the client side, the "@[DISPLAY]:" notation appears in both the source and destination file parameters. As an example, for a file transfer from the server to the client, "@[DISPLAY]:" precedes the destination file name, as shown:

C$COPY "/usr/data/file1.ext" "@[DISPLAY]:C:\My Documents\file1.ext"

For a file transfer from the client to the server, "@[DISPLAY]:" precedes the source file name. For example:

C$COPY "@[DISPLAY]:C:\My Documents\file1.ext" "/usr/data/file1.ext"

Path specifications on the client are relative to the directory identified in the TEMP user environment variable. On the server, they are relative to the working directory specified in the application's alias definition. For example, if TEMP is C:\Documents and Settings\joe\Local Settings\Temp and the application's working directory on the server is /usr/apps/app1, then the following statement:

C$COPY "@[DISPLAY]:file1.ext" "file2.ext"

uploads C:\Documents and Settings\joe\Local Settings\Temp\file1.ext from the client to /usr/apps/app1/file2.ext on the server.

Access to files on the display host is also accomplished via a set of directory specifiers. If the file name on the client starts with a special directory specifier, the thin client attempts to locate those files in special Windows directories. The special directory names are as follows:

Identifier Directory
<APPDATA> C:\Documents and Settings\<user>\Application Data
<COMMON_APPDATA> C:\Documents and Settings\All Users\Application Data
<COMMON_DOCUMENTS>    C:\Documents and Settings\All Users\Documents
<DESKTOP> C:\Documents and Settings\<user>\Desktop
<LOCAL_APPDATA> C:\Documents and Settings\<user>\Local Settings\Application Data
<MYDOCUMENTS> C:\Documents and Settings\<user>\My Documents

Note that these directories are not necessarily the same for all versions of Windows, and may in fact be on network drives.

If further directory information is specified, the thin client attempts to create the directories added. For example, when attempting to access <APPDATA>\ACUCOBOL-GT\settings.dat, the thin client ensures that the ACUCOBOL-GT directory actually exists as a subdirectory of the Application Data directory.

If the syntax for files on the display host is

C$COPY "@[DISPLAY]:<APPDATA>/filename"

the thin client would attempt to locate the specified file in

C:\Documents and Settings\<user>\Application Data

For security purposes, user authorization is required to allow a file transfer to the server using C$COPY. Copying a file to a location other than the directory named in the TEMP user environment variable also needs user authorization. The thin client displays a dialog box requesting the authorization.

Note that when the "@[DISPLAY]:" notation appears in the first or second parameter in the call to C$COPY, the optional parameter FILETYPE is not used. Only the single file named as the source file is copied. When an application is not running in the thin client, the "@[DISPLAY]:" notation is ignored.