>LOCAL lcdesc,lcitemno,lnqty,lnprice >IF ... >create table junkpos.dbf(allfields c(254)) >ENDIF >SELECT 1 >USE junkpos >SELECT 2 >USE pos >SELECT 1 >append from pos.txt delimited >go top >do while .not. eof() > lcdesc=SUBSTR(allfields,1,50) > lcitemno=SUBSTR(allfields,60,8) > ....... > SELECT 2 > APPEND BLANK > replace itemno WITH lcitem, itemdesc WITH lcitemdesc > SELECT 1 > skip > loop >ENDDO >>When the row width in the text file is more than 254 Ch then I can not get complete line of the text due to field width 254 CH. I want to save each text file line in a single record with more than 254 Ch.
lcdesc=SUBSTR(allfields,1,50) lcitemno=SUBSTR(allfields,60,8) ....... SELECT 2 APPEND BLANK replace itemno WITH lcitemno, itemdesc WITH lcdescWould become :
create cursor myCursor (itemdesc c(50), myField c(9),itemno c(8)) append from mytextfile.txt type SDFIf you'd use junkpos approach then you could get first defining more than one field. ie:
lnMaxRowWidth = 345 lnFields = ceiling(lnMaxRowWidth/254) dimension arrFields[lnFields,4] arrFields = 0 for ix=1 to lnFields arrFields[ix,1] = 'f'+ltrim(str(ix)) arrFields[ix,2] = 'C' arrFields[ix,3] = iif(ix=lnFields,lnMaxRowWidth-(254*(ix-1)),254) endfor create cursor junkpos from array arrFields append from myFiletxt type SDF && Delimited is dangerous - there might be commas *...Cetin