Should have read farther through your code.   Your problem is the APPEND
clause on the WRITESEQ statement.  This means append this record to the
END of the file.  You don't normally need to use this clause unless you
want to ADD data to the end of an existing file.  You also don't need
the 'PCPERFORM touch ...'.  OPENSEQ will create the file if it doesn't
already exist.  If it can't create it, it will take the ELSE clause with
a non-zero value in STATUS().

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

Reply via email to