27h FL$COPY copy file(s)
Input D = addresse of 'copy-to' string.
X = addresse of 'copy-from' string.
UTW_S0 = type of copy to perform.
Output - none -
Description

Copies files or block files from one device to another, as in the top level COPY or PROG COPY menu options.

The values if UTW_S0 are as follows:

$0000 - files
$8300 - OPL procedures
$8301 - OPL procedures, object only
$xx00 - other block files of type xx

The high byte of UTW_S0 must be either zero for files or a legal block file type in the range $82 to $8F inclusive. FL$COPY must not be called with any other values of UTW_S0.

X points to the 'copy from' string, D points to the 'copy to' string. Both are leading byte count and the following forms are allowed:

Copy-from Copy-to  
<pack>:<name> <pack>: copy one file
<pack>:<name> <pack>:<name> copy and rename a file
<pack>: <pack>: copy all files

The copy-from device must not be the same as the copy-to device. A file may be copied to a different name on the target device. If a device only is specified in the copy-to string, the file is copied with the same name.

If the file already exists on the TO device then the records will be appended to the file otherwise a new file of the appropriate name will be created.

Note : When used to copy an OPL procedure to a different name, FL$COPY does not actually change the name on the first line of the procedure. This means that if an OPL procedure is copied to a different name and then listed on a printer, it will be shown with the original name.

LZ users, see also FL$WCPY.

Example To copy all files from A: to B: :
COPY_FROM:
        ASCIC   "A:"
COPY_TO:
        ASCIC   "B:"

        CLRA
        CLRB
        STD     UTW_S0:         ; copy files
        LDX     #COPY_FROM
        LDD     #COPY_TO
        OS      FL$COPY
        BCS     ERROR

        ...
To copy A:MYPROC to B:HISPROC, object only
COPY_FROM:
        ASCIC   "A:MYPROC"
COPY_TO:
        ASCIC   "B:HISPROC"

        LDD     #8201h
        STD     UTW_S0:         ; copy OPL, object only
        LDX     #COPY_FROM
        LDD     #COPY_TO
        OS      FL$COPY
        BCS     ERROR
        ...
To copy all data from A: to B:.
COPY_ALL:
        CLRA                    ; first call to FL$COPY
        BSR     COPY_TYPE_A     ; to copy files
        BCS     ERROR

        LDAA    #82h            ; copy all block types from $82 to $8F
LOOP:   PSHA
        BSR     COPY_TYPE_A
        PULA
        BCS     ERROR

        INCA
        CMPA    #8Fh
        BLS     LOOP

COPY_TYPE_A:
        CLRB
        STD     UTW_S0:         ; set type of copy
        LDX     #COPY_FROM
        LDD     #COPY_TO
        OS      FL$COPY
        RTS

COPY_FROM:
        ASCIC   "A:"
COPY_TO:
        ASCIC   "B:"
Errors 194 - battery too low
200 - read pack err
232 - pack not copyable
233 - directory full
234 - file not found
236 - bad file name
238 - end of file
239 - pack full
240 - unknown pack
241 - pack not blank
242 - pack changed
243 - bad device name
244 - read only pack
245 - write pack err
246 - no pack