The COPY TO command does not support 'AS' clause in the field list. You can modify CSV file after creating it. Something like (untested)
lcFileName = "mycsvfile.csv"
COPY TO (lcFileName) FIELDS uic, para, lineno CSV
lcStr = FILETOSTR(lcFileName)
lcOldName = "lineno"
lcNewName = "line#"
lnPos = ATC(lcOldName, lcStr)
lcStr = STUFF(lcStr, lnPos, LEN(lcOldName), lcNewName)
STRTOFILE(lcStr, lcFileName)
Or you can use COPY TO...DELIMITED to create a file w/o header row and than add teh header row.
>
>I am attempting to run the follwing program :
>COPY TO mycsvfile.csv FIELDS uic, para, lineno csv
>
>The problem is that I would like to run the following line of code but it's giving me syntax error:
>
>COPY TO mycsvfile.csv FIELDS uic, para, lineno as line# csv
--sb--