* :--------------------------------------- * ------------------------: Copybook for CopyFile. * : * : See the documentation for details. * :--------------------------------------- * * The CopyFile API copies an existing file to a new file. * * ---------------------------------------------------------------- * * To use: * * COPY WIN32API. * COPY COPYFILE. * . * . * ------------------------: Load the source/target pathspecs, * : which are limited to 1024 bytes. * * MOVE 'C:\MYDIR\SOURCE.FIL' TO CF-SOURCE. * MOVE 'C:\MYDIR\TARGET.FIL' TO CF-DESTINATION. * * ------------------------: Tell it what to do if the file already * : exists in the target directory. * * SET CF-IF-EXIST-REPLACE TO TRUE. * * ------------------------: Call the API to copy the file. * * SET API-COPYFILE TO TRUE. * CALL 'GSWINAPI' USING WIN32API-PARMS * CF-SOURCE * CF-DESTINATION * CF-FLAGS * WIN32API-D * WIN32API-E * WIN32API-F. * * ------------------------: If function failed, * : display a textual error message. * * IF WIN32API-FAILED * MOVE WIN32API-ERROR-TEXT TO my-error-message * do whatever to display my-error-message. * 01 CF-SOURCE PIC X(1024). 01 CF-DESTINATION PIC X(1024). * : Options; set the one you want to TRUE. 01 CF-FLAGS PIC S9(9) COMP-5. * : If a file of the destination name * : exists, replace it. 88 CF-IF-EXIST-REPLACE VALUE 0. * : If the destination file exists, * : DO NOT replace it. 88 CF-IF-EXIST-FAIL VALUE 1. * : * : Same as CF-IF-EXIST-REPLACE when not * : under Client/Server. * : * : If operating under the Client/Server, * : redundant transfers transfers will * : be avoided by comparating date * : and time of source and destination, * : and using the client's cached copy * : if dates and times do match. 88 CF-SYNCHRONIZE-FILE VALUE 2.