I've always just opened the file and deleted the record before the OPENSEQ

      OPEN 'MBP' TO F.MBP THEN 
         FILE.NAME='customer_tm.txt'
         DELETE F.MBP,FILE.NAME
         OPENSEQ 'MBP',FILE.NAME TO F.SEQ ELSE NULL
      END ELSE
      END

Mel Maresh

-----Original Message-----
From: Shawn Waldie [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 13, 2004 12:15 PM
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

Reply via email to