If you don't position the file with READSEQ, and you don't use the APPEND clause on WRITESEQ, it should overwrite the file from the beginning. The initial WEOFSEQ should be unnecessary, and in fact is probably why you're only seeing an empty file. We use sequential file processing in a number of programs, including data transfer to/from a webserver, EDI, data export to other applications, etc.
Here is the basic flow that we use: OPENSEQ 'DIRFILE',SEQ.NAME TO FIL.SEQ ELSE ;* 'DIRFILE' is a DIR-type file pointer in VOC IF STATUS() NE 0 THEN PRINT "Unable to open ":SEQ.NAME STOP END END LOOP read data from UniData files ... UNTIL EOF DO build variable with appropriate delimiters, etc WRITESEQ VAR ON FIL.SEQ ELSE PRINT "Error writing to file ..." END REPEAT WEOFSEQ FIL.SEQ CLOSESEQ FIL.SEQ This works consistently in our apps. Larry Hiscock Western Computer Services http://www.wcs-corp.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shawn Waldie Sent: Tuesday, April 13, 2004 10:15 AM To: U2 Users Discussion List Subject: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ Except for one possible inconsistency with the instructions regarding OPENSEQ, the documentation seems very straight-forward. However, I'm still missing something. My intention is to: 1) create a record (if it doesn't already exist) in a DIR-type file; 2) clear said record if data exists; 3) write "new" data to the record; and 4) close the file. The problem is that only an empty record is created if the WEOFSEQ command is executed. However, if the WEOFSEQ command is not executed, the record will not first be cleared. In other words, each time someone runs the program, the new info is appended to whatever exists. Here's my code: X.DIR = "X.HOME.WALDIES" X.FILE = "SRW_TEST_SEQ.txt" X.DELIM = "|" ******** * MAIN * ******** GOSUB OPEN.SEQFILE FOR I = 0 TO 9 OUTPUT.DATA = "" FOR J = 0 TO 9 BEGIN CASE CASE J # 9 OUTPUT.DATA := I:"-":J:X.DELIM CASE 1 OUTPUT.DATA := I:"-":J END CASE NEXT J GOSUB WRITE.TO.SEQFILE NEXT I CLOSESEQ FV.SEQ *~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~*~-~* * ----------- OPEN.SEQFILE: * ----------- PCPERFORM 'touch ':@PATH:'/':X.DIR:'/':X.FILE OPENSEQ X.DIR,X.FILE TO FV.SEQ ELSE CRT "File ":X.FILE:" in ":X.DIR:" didn't open!" END WEOFSEQ FV.SEQ RETURN * --------------- WRITE.TO.SEQFILE: * --------------- WRITESEQ OUTPUT.DATA APPEND TO FV.SEQ ELSE CRT "Can't append ":OUTPUT.DATA:" to ":X.FILE:" in ":X.DIR:"!" END RETURN TIA Shawn -- 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