Good question. The problem you are facing only occurs under UNIX (i.e. not Windows), and only when not using the AMOSRUNSBR option (e.g. SET AMOSRUNSBR or OPTIONS=AMOS_RUNSBR in the miame.ini). In such a case, the command (TEMP$) passed to AMOS.SBR is converted into the equivalent HOSTEX command "$ASHELL "+TEMP$, and like all HOSTEX commands, gets processed by the applicable UNIX shell command processor before execution. Virtually all UNIX shells will strip quotes (both single and double), which they interpret as being there for the purpose of shielding the contents from certain shell filtering operations.
Fortunately, there are several workarounds:
1. In general, if you know you are dealing with UNIX command lines, you can "escape" any troublesome characters by preceding them with a backslash, e.g.
XCALL AMOS,"COPY filnam.bas=\""/test/dsk3/001002/filnam.bas\"""
In the above example, I used the Basic convention of encoding a literal double-quote character with a pair of them, so, along with the use of the backslash to "escape" the literal quote, you end up with the following, as seen by the UNIX command line processor:
COPY filnam.bas="/test3/dsk3/001002/filnam.bas"
which then results in the following being seen by A-Shell:
COPY filnam.bas="/test3/dsk3/001002/filnam.bas"
which is what you originally wanted.
2. If using XCALL AMOS to execute an A-Shell LIT or RUN command, you can force it to run as a true subroutine (rather than launching a child A-Shell process), either globally by using OPTIONS=AMOS_RUNSBR, or SET AMOSRUNSBR. Or, you can force it for just that XCALL by adding the
pflag parameter set to 1, e.g.:
XCALL AMOS,"COPY filnam.bas=\""/test/dsk3/001002/filnam.bas\""",0,1
That keeps the UNIX shell processor out of the picture and thus eliminates the special handling of quotes.
3. Since you are just copying a file, you could use MIAMEX, MX_COPYFILE which operates at the OS level and thus doesn't require any special handling of quotes, e.g.:
xcall MIAMEX, MX_COPYFILE, "/test/dsk3/001002/filnam.bas", "./filnam.bas", CPYF_REPL, STATUS
4. You could also use XCALL HOSTEX, "cp ...", e.g.:
xcall HOSTEX, "cp /test/dsk3/001002/filnam.bas ./filnam.bas"
Note that in this case, you might need to translate the AMOS spec into native form (using MIAMEX, MX_FSPEC). We avoided it in this example by assuming that the output file was in the current directory.
Warning: in all of the above, except method #2, you probably want to use lower case (i.e. filnam.bas rather than FILNAM.BAS), since A-Shell assumes lower case when converting AMOS filespecs to native. Upper case filenames will appear in DIR (because it scans the directory), but will appear to not exist when you try to open or otherwise access the file directly.