Al,
Do the following:

     OPENSEQ FNAME TO OUTFILE ELSE NULL
     WEOFSEQ OUTFILE ON ERROR STOPM 'FATAL ERROR: - Cannot write to file ':FNAME


Now, you should be able to perform the writes without a problem.  By the way, 
the ON ERROR clause is optional.

The WEOFSEQ will either create the file, or write an end of file mark at the 
end of an existing file, making the file null.

If you want to keep the data, if the file exists, then add the WEOFSEQ in an 
OPENSEQ ELSE condition... but you need to position the pointer to the end of 
the file or you will be stepping on existing data.

Tom
RATEX Business Solutions
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Al DeWitt
Sent: Wednesday, September 08, 2010 10:15 PM
To: U2 Users List
Subject: Re: [U2] Sequential Files Question

I GET THE FOLLOWING MESSAGE [FATAL ERROR: - Cannot open file
C:\OUTPUT\APCHECKS1002] and I'm sent to the colon prompt. 


Al DeWitt

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath
Sent: Wednesday, September 08, 2010 7:20 PM
To: U2 Users List
Subject: Re: [U2] Sequential Files Question

If you run this code:

OPENSEQ FNAME TO OUTFILE ON ERROR
   STOP 'FATAL ERROR: - Cannot open file ':FNAME END THEN
   STOP 'FATAL ERROR: - Already exiting file called: ':FNAME END ELSE
   CRT "FILE OPEN SUCCEEDED!"
   WRITESEQ "Dummy data" ON OUTFILE THEN NULL END

What happens?


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Al DeWitt
Sent: Thursday, September 09, 2010 10:03 AM
To: U2 Users List
Subject: Re: [U2] Sequential Files Question

I forgot to mention that I'm on Windows.

My output path is: C:\OUTPUT\
My file name isAPCHECKS9999 where is a counter that gets incremented
each time the program is run.

FNAME would be C:\OUTPUT\APCHECKS9999 so that my statement would read:
OPENSEQ FNAME TO OUTFILE...

However, since APCHECKS9999 would be unique each time it doesn't exist.


BTW when I try to display OUTFILE it gives me an Unitialized Variable,
zero assumed error.

Al DeWitt

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dan McGrath
Sent: Wednesday, September 08, 2010 6:29 PM
To: U2 Users List
Subject: Re: [U2] Sequential Files Question

Yes, it will. 

Note: It will drop into the 'ELSE' clause if the file didn't exist to
start with.

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Al DeWitt
Sent: Thursday, September 09, 2010 8:55 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Sequential Files Question

Unidata 7.1.20
 
I've never dealt with sequential files, but I have a need to output
records to a text file.  Each record will be a series of fixed-length
fields.  Each file will need to be created at the time of opening.  The
destination will be a Windows folder on one of our servers.  I will be
using OPENSEQ to open the file.  However, since each file needs to be
created at time of opening what do I use to create the file?  My reading
of OPENSEQ doesn't indicate that it will create it automatically if it
doesn't exist.
 
Thanks.
 
Al DeWitt
 
 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
########################################################################
###################
The information transmitted in this message and attachments (if any) is
intended only for the person or entity to which it is addressed. The
message may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other
than the intended recipient is prohibited.  If you received this in
error, please contact the sender and delete the material from any
computer.

The intended recipient of this e-mail may only use, reproduce, disclose
or distribute the information contained in this e-mail and any attached
files with the permission of IMB.
########################################################################
###################
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
########################################################################
###################
The information transmitted in this message and attachments (if any) is
intended only for the person or entity to which it is addressed. The
message may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other
than the intended recipient is prohibited.  If you received this in
error, please contact the sender and delete the material from any
computer.

The intended recipient of this e-mail may only use, reproduce, disclose
or distribute the information contained in this e-mail and any attached
files with the permission of IMB.
########################################################################
###################
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to