It will only clear whatever data is already in X.FILE.
It appears I made an incorrect statement in a previous post, and I must
correct myself. I previously stated that WRITESEQ will overwrite and
effectively clear a file. It does not.
The sequential file must be positioned at the end of file before a WRITESEQ
is executed, or the write will fail, and the ELSE clause will be taken.
There are three ways to do this:
1) READSEQ until eof
2) Use the APPEND clause to the WRITESEQ statement
3) WEOFSEQ (truncates the file at the current position, effectively making
the end of file)
I revise my basic flow as follows:
OPENSEQ 'dirfile','seq.file.name' TO FIL.SEQ THEN
WEOFSEQ FIL.SEQ
END ELSE
IF STATUS() NE 0 THEN
PRINT 'Could not open/create seq.file.name'
STOP
END
END
* Loop through data & build seq records
WRITESEQ var ON FIL.SEQ
...
* At eof
CLOSESEQ FIL.SEQ (No WEOFSEQ required here)
Larry Hiscock
Western Computer Services
http://www.wcs-corp.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Shawn Waldie
Sent: Wednesday, April 14, 2004 10:49 AM
To: U2 Users Discussion List
Subject: WEOFSEQ
I need some clarification.
Given the following:
X.DIR = "X.HOME.WALDIES"; * the VOC item 'X.HOME.WALDIES' is a
pointer to /home/waldies
X.FILE = "SRW_TEST_SEQ.txt"
OPENSEQ X.DIR,X.FILE TO FV.SEQ THEN
WEOFSEQ FV.SEQ
ELSE
...
END
Upon a successful open of X.DIR at X.FILE, will the WEOFSEQ erase
everything in X.DIR starting with X.FILE, including other files that may
exist under - positionally - X.FILE? Or is it just suppose to "clear"
anything that might be contained in X.FILE?
This what the *help* says:
The UniBasic WEOFSEQ command writes an end-of-file mark at the record
pointer position in a sequential file, which results in the file (...in
my case, X.DIR or X.FILE?) being truncated at the current position.
TIA
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users