On 09/09/10 05:57, Colin Alfke wrote: > Al; > > I use the following code: > > OPENSEQ 'OUTPUT.FILE', 'APCHECKS9999' TO OUTFILE THEN > CRT 'APCHECKS9999 ALREADY EXISTS' > STOP > END
NOTE THE DIFFERENT SYNTAX! Looks like OPENSEQ has multiple syntaxes as everybody else has said OPENSEQ "os pathname" TO ... But I've only ever used the OPENSEQ "uv type 1 file", "record" TO syntax. What happens if you change syntax and try it that way? Cheers, Wol > * 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