[comp.sys.ibm.pc] Help w/appending files

cmm1@CUNIXA.CC.COLUMBIA.EDU (Christopher M Mauritz) (06/10/89)

Is there a way to force a file with a filename that already exists to
append itself to the end of the previous file rather than overwrite the
old one?  I am writing a DBaseIV application that creates a report and
sends it to a disk file.  I would like to just use the 
ALTERNATE SET TO: filename to collect the data as DBaseIV spits it out.
It would be great if I could have one file collect all the output from
one session.  Maybe there is a better way?

All this is designed to send the output to our LaserWriterII.  The program
does not support the printer so I need to collect the data and use WP 5.0
to send it to the printer.

Sorry if this seems to be a simple question.  I'm an Atari ST man who has
been forcibly transplanted to the pee cee world. :-)  As ever, any and all
replies are greatly appreciated.

Regards,



------------------------------+-----------------------------
Chris Mauritz                 |Support the Chinese Students! 
cmm1@cunixa.cc.columbia.edu   |Down with Li Peng!  Jin tian,
(c)All rights reserved.       |Wo men duo shi zhong guo ren!
------------------------------+-----------------------------

baird@cod.NOSC.MIL (John M. Baird) (06/10/89)

From article <8906091823.AA06940@cunixa.cc.columbia.edu>, by cmm1@CUNIXA.CC.COLUMBIA.EDU (Christopher M Mauritz):
> 
> Is there a way to force a file with a filename that already exists to
> append itself to the end of the previous file rather than overwrite the
> old one?
Why not just redirect the DBase printer output to a file, collecting it there
until you have everything you want, and then printing it?  You can use a
program called LPTX to do that, and it will let you append to the redirected
file later on, if you want to. A portion of the LPTX man page is appended to 
this message.

John Baird, Naval Ocean Systems Center, San Diego
--------
LPTx - Line Printer Redirection Program - V7.00

Calling sequence : 

LPTx [?] [-m] [-x] [-l] [-i] -p -f <[d:][\pathname\pathname]filename>

    where  p = printer number : 1, 2, or 3
           f = function : o for open a print file
>NOTE>>>                  a for append to a print file             <NOTE<<<
                          c for close a print file
           drive letter & pathname are optional

richard@iesd.dk (Richard Flamsholt S0rensen) (06/14/89)

>Is there a way to force a file with a filename that already exists to
>append itself to the end of the previous file rather than overwrite the
>old one? I am writing a DBaseIV application that creates a report and

I'm not quite sure how DBaseIV could handle this, but if your application
program supports access to DOS, one way of getting round is by writing
something like

COPY OldFile.DBF + NewFile.DBF OldFile.DBF

This simply adds your old file to the new extension and - voila !

awd@dbase.UUCP (Alastair Dallas) (06/14/89)

You're lucky.  You're using dBASE IV, which now includes the syntax:

	SET ALTERNATE TO <filename> ADDITIVE

This will append each session to the end of the existing file, rather
than overwriting it each time.

Hope it helps.

/alastair/

Disclaimer:  This is unofficial.  Ashton-Tate doesn't speak for me, and
I return the favor.

awd@dbase.UUCP (Alastair Dallas) (06/14/89)

In article <1552@cod.NOSC.MIL>, baird@cod.NOSC.MIL (John M. Baird) writes:
> From article <8906091823.AA06940@cunixa.cc.columbia.edu>, by cmm1@CUNIXA.CC.COLUMBIA.EDU (Christopher M Mauritz):
> > 
> > Is there a way to force a file with a filename that already exists to
> > append itself to the end of the previous file rather than overwrite the
> > old one?
> Why not just redirect the DBase printer output to a file, collecting it there
> until you have everything you want, and then printing it?  You can use a
> program called LPTX to do that, and it will let you append to the redirected

Many people are familiar with dBASE III Plus and assume that we didn't 
improve many aspects of the language for dBASE IV.  But we did.  In addition
to the SET ALTERNATE TO...ADDITIVE change mentioned earlier, we also now
support SET PRINTER TO FILE <filename>.  If there's something you need to
do and dBASE IV can't do it for you, I'd like to hear about it :-).

/alastair/

Disclaimer:  This is unofficial.  Ashton-Tate doesn't speak for me and I
return the favor.

THALL@UALTAVM.BITNET (Tom Hall) (06/16/89)

In article <2061@iesd.dk>, richard@iesd.dk (Richard Flamsholt S0rensen) writes:
 
>
>>Is there a way to force a file with a filename that already exists to
>>append itself to the end of the previous file rather than overwrite the
>>old one? I am writing a DBaseIV application that creates a report and
>
>I'm not quite sure how DBaseIV could handle this, but if your application
>program supports access to DOS, one way of getting round is by writing
>something like
>
>COPY OldFile.DBF + NewFile.DBF OldFile.DBF
>
>This simply adds your old file to the new extension and - voila !
 
A better way would be to use COPY /B FILE1+FILE2, etc., otherwise, if
you are copying text files, you will get an imbedded Ctrl-Z (end-of-file
marker). If the files you are copying are NOT ascii text files, then
omitting the /b could get you into some trouble ;-)
 
This, at least, is my experience with DOS 3.3. Earlier versions I think
may have behaved differently. In fact, I ran across a patch for DOS
3.3's copy command that fixed some bug or other..
 
Tom
----------------------------------------------------------------------
Tom Hall                             FidoNet:  1:342/6
Edmonton, Alberta                    BitNet :  THALL@UALTAVM.BITNET
----------------------------------------------------------------------