No question, just a some example code to share. (OpenInsight Specific)
At 05 FEB 1999 03:19:57PM B. Cameron wrote:
Below is a sample (stripped down) code of writing a Rev table
to a Dos file in Quote-comma-Quote format. This code will write
a Dos file greater than 64k or less than 64k.
It is something I have written and used lots of times. It is fairly straight
forward but does not include the needed file locking, or error msg routines etc., to make it complete (i.e. good code). It is meant as an example shell for anyone to make use of that might be looking for such an example on writing out to Dos file.
I hope it is useful to some. And, thanks for all the answers I have gotten.
DosFileName=xxxxxx.xxx"
*
Equ DEOFM to Char(26) ;* Dos End of File Mark
Equ DEORM to /0D0A/ ;* Dos End of Record Mark
Equ RecLen$ to 1024 ;* You may increase or decrease
*
* Create or overwrite a empty Dos file with end of file marker
*
OSClose DosFileName
OSWrite DEOFM on DosFileName
*
* Set the Offset (Where to begin reading Dos file from)
*
Offset=0
NoMore=0
*
* Loop through your Rev table
*
Loop
Readnext @ID else NoMore=1Until NoMore do
Read item From RevFile, @ID then
Ditem="Ditem=Quote(item)Ditem=Quote(item)
Convert @FM to "," in xitem
Now append to the DosFile
OSOpen DosFileName to Doshandle ThenLoopOSBRead data From Doshandle at Offset length RecLen$Until Index(data,DEOFM,1)Offset += RecLen$Repeatdata=Field(data,DEOFM,1):Ditem:DEOR:DEOFM)OSBWrite data on Doshandle At OffsetOSClose DoshandleEndEndRepeat
*
Return 0
Please comment on any erroneous errors or improvements.