I would like to append a header row to the top of a txt file without using copy to file type csv. The header row column names will contain spaces and characters not allowed in dbf column names. I tried using SET ALTERNATE ON ADDITIVE, but that appends to the bottom of the file.
What I'm trying to do is break up a file into 10,000 record chunks if the qnty is over 15,000. Using type csv puts the dbf header name at the beginning of each record, but I need a different header which can be seen between the TEXT..ENDTEXT lines.
The specific code of what I'm doing is here:
if qnty>14999
for x=1 to qnty step 10000
goto x
incr=incr+1
copy next 10000 to "d:\lists\"+print_jobs(acnt,1)+"_"+alltrim(str(incr))+".txt" type delimited
SET ALTERNATE TO "d:\lists\"+print_jobs(acnt,1)+"_"+alltrim(str(incr))+".txt" ADDITIVE 2
SET ALTERNATE ON
SET CONSOLE OFF
TEXT
"FIRST","LAST","Or Current Resident","STREET","CITY","ST","ZIP4","JOBNUM","Part","Opt. Endorsement Line","POSTNET Barc","Sequenti","Sch","StudentID","VAR1","VAR2"
ENDTEXT
SET ALTERNATE OFF
CLOSE ALTERNATE
SET CONSOLE ON
next
else
endif
ENDFOR
Thanks!
Chandler
I ran over my dogma with karma!
What I'm trying to do is break up a file into 10,000 record chunks if the qnty is over 15,000. Using type csv puts the dbf header name at the beginning of each record, but I need a different header which can be seen between the TEXT..ENDTEXT lines.
The specific code of what I'm doing is here:
if qnty>14999
for x=1 to qnty step 10000
goto x
incr=incr+1
copy next 10000 to "d:\lists\"+print_jobs(acnt,1)+"_"+alltrim(str(incr))+".txt" type delimited
SET ALTERNATE TO "d:\lists\"+print_jobs(acnt,1)+"_"+alltrim(str(incr))+".txt" ADDITIVE 2
SET ALTERNATE ON
SET CONSOLE OFF
TEXT
"FIRST","LAST","Or Current Resident","STREET","CITY","ST","ZIP4","JOBNUM","Part","Opt. Endorsement Line","POSTNET Barc","Sequenti","Sch","StudentID","VAR1","VAR2"
ENDTEXT
SET ALTERNATE OFF
CLOSE ALTERNATE
SET CONSOLE ON
next
else
endif
ENDFOR
Thanks!
Chandler
I ran over my dogma with karma!