The "easiest" way is to use the LIST command. Note: it is not true
"comma-delimited" it is items separated with a ",". Also, with SB+ you will
be in ecltype "P" so you need to use "list" and not "LIST".

eg.: list EMPLOYEES FIRSTNAME LASTNAME ADDRESS TO DELIM "," EMPLOYEE.TXT

This will create a file EMPLOYEE.TXT in the current directory (you could
specify a path) with the employees first name, last name, and address
separated with commas. It will not quote text. You can use another delimiter
in the quotes. It will include any UniData delimiters in the text - as per
your dictionary items.

You could also do a Smart Query to excel - but then you would have to export
the file from excel.

Or you could create a DIR type file:

CREATE-FILE DIR TEMP.DIR.FILE

and have a program like:

OPEN 'TEMP.DIR.FILE' TO WORK.FILE ELSE STOP 201, 'TEMP.DIR.FILE'
DIM REC(2)
REC(1) = '1,"Colin","Alfke"'
REC(2) = '2,"Al","DeWitt"'
MATWRITE REC ON WORK.FILE, 'EMPLOYEE.TXT'

or

OPEN 'TEMP.DIR.FILE' TO WORK.FILE ELSE STOP 201, 'TEMP.DIR.FILE'
REC = ''
REC<1> = '1,"Colin","Alfke"'
REC<2> = '2,"Al","DeWitt"'
WRITE REC ON WORK.FILE, 'EMPLOYEE.TXT'

or my favourite if you don't know how big it will get:

EXECUTE "DELETE TEMP.DIR.FILE 'EMPLOYEES.TXT'" CAPTURING XX RETURNING YY
OPENSEQ 'TEMP.DIR.FILE', 'EMPLOYEES.TXT' TO EMPL.TXT THEN
  CRT 'EMPLOYEES.TXT ALREADY EXISTS'
  STOP
END
*
LINE = '1,"Colin","Alfke"'
WRITESEQ LINE APPEND ON EMPL.TXT ELSE CRT 'NOT AT END OF EMPL.TXT'
LINE = '2,"Al","DeWitt"'
WRITESEQ LINE APPEND ON EMPL.TXT ELSE CRT 'NOT AT END OF EMPL.TXT'
CLOSESEQ EMPL.TXT

I have written files over 1GB using this method. These methods all leave the
file on the server - except for the Smart Query in SB+.

hth
-- 
Colin Alfke
Calgary, Alberta Canada

"Just because something isn't broken doesn't mean that you can't fix it"

Stu Pickles


>-----Original Message-----
>From: Al DeWitt [mailto:[EMAIL PROTECTED]
>
>OS: Windows 2K
>U2: UniData 6.0.6
>System Builder 5.2.4
> 
>I'm suffering a senior moment.  I need to output a comma 
>separated file to
>disk for importation into a 3rd party application.  System 
>Builder is too
>cumbersome (from what I can see) and want to do it in 
>UniBasic.  However, I
>have forgotten how to the command(s) to create a new flat file in an
>existing folder.  So some examples would be helpful.
> 
>
>Al DeWitt 
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to