This is what finally worked. I was hoping to do it w/o having to create a VOC entry, but that was not to be.
Thank you all for your help. Al DeWitt -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Colin Alfke Sent: Wednesday, September 08, 2010 11:57 PM To: 'U2 Users List' Subject: Re: [U2] Sequential Files Question Al; I use the following code: OPENSEQ 'OUTPUT.FILE', 'APCHECKS9999' TO OUTFILE THEN CRT 'APCHECKS9999 ALREADY EXISTS' STOP END * code to build each line goes here MORE.DATA = 1 LOOP WHILE MORE.DATA DO LINE = 'data' 'L#9':MORE.DATA 'L#25':'still more data' 'L#20' WRITESEQ LINE APPEND ON OUTFILE ELSE CRT 'NOT AT END OF APCHECKS9999' MORE.DATA += 1 IF MORE.DATA >= 25 THEN MORE.DATA = 0 REPEAT CLOSESEQ OUTFILE Where OUTPUT.FILE is a VOC item (which means I can change the location of the file without recompiling/changing code): DIR C:\OUTPUT D_VOC Using the "THEN" construct means the program will stop if that item already exists so you won't overwrite any existing data. Technically, the file won't actually exist until you do the WRITESEQ, but it won't matter that it won't already exist, it will create it. You can't really deal with OUTFILE as a variable - it's really a (type of) file handle. The WRITESEQ will fly through the file - you don't have to worry about creating a large array - it will just keep writing until it hits the limit (not sure if it's the OS limit or UniData's 2GB limit). Hth Colin Alfke Calgary, Canada -----Original Message----- From: Al DeWitt 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: Dan McGrath 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: Al DeWitt 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 _______________________________________________ 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