RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-14 Thread alfkec
Here is the basic structure I've been using in my export programs. It does
require that the directory you are working in is setup in the VOC for the
DELETE to work - I just wanted to be extra sure that it wouldn't pick up
anything from a prior run.

EXECUTE DELETE CONVERT.FILE, 'EXPORT.TXT' CAPTURING XX RETURNING YY
OPENSEQ 'CONVERT.FILE', 'EXPORT.TXT' TO EXPORT.TXT THEN
  CRT 'EXPORT.TXT ALREADY EXISTS'
  STOP
END
LOOP
  READNEXT ID ELSE DONE = 1
WHILE NOT(DONE) DO
  READ REC FROM WORK.FILE, ID ELSE REC = ''
  GOSUB BUILD.LINE
  WRITESEQ LINE APPEND ON EXPORT.TXT ELSE CRT 'NOT AT END OF EXPORT.TXT'
REPEAT
*
CLOSESEQ EXPORT.TXT

I've used this on a couple of versions of UD running on windows. I've also
opened the directory as a file and done a clearfile on it. Since I have the
directory setup I could just use the regular read and write commands but
some of the items grow rather large (1 is over 1GB) this just flies through
the data. It also allows me to easily change the location of the directory.

hth
-- 
Colin Alfke
Calgary, Alberta Canada

Just because something isn't broken doesn't mean that you can't fix it

Stu Pickles


-Original Message-
From: Shawn Waldie [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 13, 2004 2:02 PM
To: U2 Users Discussion List
Subject: RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


My main problem is resolved but your suggestions raised some other
questions, Larry.

When I take the initial WEOFSEQ out, the first run will produce the
result I need. But if I run the program again, the error statement is
returned each time the WRITESEQ statement is executed.  When WEOFSEQ is
executed right after the OPEN... statement, I get the desired result
each time I run it...also, the APPEND is no longer in the WRITE...
statement.

Something else I don't understand:
When the file to be created/refreshed doesn't exist in X.DIR, the error
message of the OPEN... statement is returned. Even so, the new file is
created and written to, and I receive the desired result.  I don't get
that one.  This happens with or without the PCPERFORM command.

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-14 Thread Shawn Waldie
I'm back.  I lost my machine yesterday afternoon.


-Original Message-
From: Larry Hiscock [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 13, 2004 2:21 PM
To: 'U2 Users Discussion List'
Subject: RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


Comments inline:

What version of UD are you running?  On what OS?  We're on an older
version of UD (4.0.23) on SCO OpenServer 5.0.5, and we use WRITESEQ a
LOT, always with the same basic flow that I posted in my previous
message.  OPENSEQ, loop through WRITESEQ, WEOFSEQ, CLOSESEQ

HP-UX B.11.11
UniData 6.0.9


If the file doesn't exist, it WILL take the ELSE clause, but with
STATUS() = 0.  If it can't create and/or open an existing file, it will
take the ELSE clause, but with STATUS()  0.  Use the following in
your OPENSEQ statement:

OPENSEQ 'dirfile',SEQ.NAME TO FIL.SEQ ELSE
  IF STATUS() NE 0 THEN
PRINT 'Error message...'
recover from error...
  END
END

If the file doesn't already exist, it will take the else branch, but
STATUS() will be zero, so it won't print the error message.
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-14 Thread Shawn Waldie
It's nice to have options.
My thanks again for the suggestions.

I'm going hunting for that post that Bruce was talking about.  If
someone else finds it before me, feel free to shoot it my way. 8^)

Shawn



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 14, 2004 6:53 AM
To: [EMAIL PROTECTED]
Subject: RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


Here is the basic structure I've been using in my export programs. It
does require that the directory you are working in is setup in the VOC
for the DELETE to work - I just wanted to be extra sure that it wouldn't
pick up anything from a prior run.

EXECUTE DELETE CONVERT.FILE, 'EXPORT.TXT' CAPTURING XX RETURNING YY
OPENSEQ 'CONVERT.FILE', 'EXPORT.TXT' TO EXPORT.TXT THEN
  CRT 'EXPORT.TXT ALREADY EXISTS'
  STOP
END
LOOP
  READNEXT ID ELSE DONE = 1
WHILE NOT(DONE) DO
  READ REC FROM WORK.FILE, ID ELSE REC = ''
  GOSUB BUILD.LINE
  WRITESEQ LINE APPEND ON EXPORT.TXT ELSE CRT 'NOT AT END OF EXPORT.TXT'
REPEAT
*
CLOSESEQ EXPORT.TXT

I've used this on a couple of versions of UD running on windows. I've
also opened the directory as a file and done a clearfile on it. Since I
have the directory setup I could just use the regular read and write
commands but some of the items grow rather large (1 is over 1GB) this
just flies through the data. It also allows me to easily change the
location of the directory.

hth
-- 
Colin Alfke
Calgary, Alberta Canada

Just because something isn't broken doesn't mean that you can't fix it

Stu Pickles


-Original Message-
From: Shawn Waldie [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 13, 2004 2:02 PM
To: U2 Users Discussion List
Subject: RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


My main problem is resolved but your suggestions raised some other 
questions, Larry.

When I take the initial WEOFSEQ out, the first run will produce the 
result I need. But if I run the program again, the error statement is 
returned each time the WRITESEQ statement is executed.  When WEOFSEQ is

executed right after the OPEN... statement, I get the desired result 
each time I run it...also, the APPEND is no longer in the WRITE... 
statement.

Something else I don't understand:
When the file to be created/refreshed doesn't exist in X.DIR, the error

message of the OPEN... statement is returned. Even so, the new file is 
created and written to, and I receive the desired result.  I don't get 
that one.  This happens with or without the PCPERFORM command.

-- 
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


[UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Shawn Waldie
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


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Maresh, Mel
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


Re: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Daniel_Plocinik
I may be over simplifying this but there appears to be a STOP missing
after the CLOSESEQ command.  If this is actually the case in your code, the
WEOFSEQ will be executed one last time before the program terminates.

Could this possibly be the reason?

dan



   

  Shawn Waldie   

  [EMAIL PROTECTED] To: U2 Users Discussion List [EMAIL 
PROTECTED]
  ege.edu cc: 

  Sent by: Subject:  [UD] OPENSEQ, WEOFSEQ, 
CLOSESEQ   
  [EMAIL PROTECTED]
 
  ver.com  

   

   

   

  04/13/2004 01:14 PM  

  Please respond to U2 

  Users Discussion 

  List 

   

   





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




Note: Effective February 2, 2004, Arnold  Porter became a limited
liability partnership with the name Arnold  Porter LLP. Please
change your records accordingly. The addresses, telephone and fax
numbers, and e-mail addresses of the firm and attorneys have not changed.
--
This communication may contain information that is legally privileged,
confidential or exempt from disclosure.  If you are not the intended
recipient, please note that any dissemination, distribution, or copying
of this communication is strictly prohibited.  Anyone who receives this
message in error should notify the sender immediately by telephone or
by return e-mail and delete it from his or her computer.
--
Daniel Plocinik [EMAIL PROTECTED]
Arnold  Porter LLP Telephone:  202-274-7639
555 Twelfth Street, NW  Fax

RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Larry Hiscock
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


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Larry Hiscock
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


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Shawn Waldie
That WAS the reason.
Thank you very much.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 13, 2004 11:51 AM
To: U2 Users Discussion List
Subject: Re: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


I may be over simplifying this but there appears to be a STOP missing
after the CLOSESEQ command.  If this is actually the case in your code,
the WEOFSEQ will be executed one last time before the program
terminates.

Could this possibly be the reason?

dan
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Larry Hiscock
Comments inline:

 When I take the initial WEOFSEQ out, the first run will
 produce the result I need. But if I run the program again,
 the error statement is returned each time the WRITESEQ
 statement is executed.  When WEOFSEQ is executed right
 after the OPEN... statement, I get the desired result
 each time I run it...also, the APPEND is no longer in
 the WRITE... statement.

What version of UD are you running?  On what OS?  We're on an older
version of UD (4.0.23) on SCO OpenServer 5.0.5, and we use WRITESEQ a
LOT, always with the same basic flow that I posted in my previous
message.  OPENSEQ, loop through WRITESEQ, WEOFSEQ, CLOSESEQ

 Something else I don't understand:
 When the file to be created/refreshed doesn't exist in
 X.DIR, the error message of the OPEN... statement is
 returned. Even so, the new file is created and written
 to, and I receive the desired result.  I don't get that
 one.  This happens with or without the PCPERFORM command.

If the file doesn't exist, it WILL take the ELSE clause, but with
STATUS() = 0.  If it can't create and/or open an existing file, it will
take the ELSE clause, but with STATUS()  0.  Use the following in your
OPENSEQ statement:

OPENSEQ 'dirfile',SEQ.NAME TO FIL.SEQ ELSE
  IF STATUS() NE 0 THEN
PRINT 'Error message...'
recover from error...
  END
END

If the file doesn't already exist, it will take the else branch, but
STATUS() will be zero, so it won't print the error message.

Larry Hiscock
Western Computer Services
http://www.wcs-corp.com


-Original Message-
From: Larry Hiscock [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 13, 2004 12:50 PM
To: 'U2 Users Discussion List'
Subject: RE: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ


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.
-- 
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


Re: [UD] OPENSEQ, WEOFSEQ, CLOSESEQ

2004-04-13 Thread Bruce Nichol
Goo'day,

Check the archives.

IIRC, somebody (Ray Wurlod??? ) published a *complete* set of code for 
OPENSEQ/READSEQ/WEOFSEQ, etc, full of THEN ELSE's about 12 to 18 months ago 
that goes a long way to getting the damn thing working correctly.

At 03:14 14/04/04, you wrote:

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


--
Incoming mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 262.8.0 - Release Date: 09/04/04
Regards,

Bruce Nichol
Talon Computer Services
ALBURYNSW 2640
Australia
Tel: +61 (0)411149636
Fax: +61 (0)260232119
If it ain't broke, fix it till it is! 

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 262.8.0 - Release Date: 09/04/04
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users