Set printer or device to file 
Author Message
 Set printer or device to file

I have a report that has to go to a printer attached to an AS/400.  There
can be nothing but text in the report, since any control codes cause the
print spooler to throw an 'Invalid data' error.  The original version of the
program is in FP 2.6 for DOS, and I do a set printer to file ..., then do

<filename> lpt2.  It's worked for 6 years.

Now I've updated everything to VFP 5 and the set printer to file command no
longer works.  I trace through the program, the command executes, sys(6)
shows that the file is the output device, but the file is never created and
nothing is written to it, the output goes directly to the printer.  I also
tried set device to file ..., with the same results.  Interestingly, the
same problem happens in FPW 2.6.

Am I missing something really obvious?

Thanks!
Jed



Wed, 05 Mar 2003 03:00:00 GMT  
 Set printer or device to file

Jed,
This may work, if you first set your current "printer" to a Generic/Text
Only printer driver. Otherwise the file will get all the control codes
and/or graphics commands that the Windows printer driver in use will create.

Rick


Quote:
> I have a report that has to go to a printer attached to an AS/400.  There
> can be nothing but text in the report, since any control codes cause the
> print spooler to throw an 'Invalid data' error.  The original version of
the
> program is in FP 2.6 for DOS, and I do a set printer to file ..., then do

> <filename> lpt2.  It's worked for 6 years.

> Now I've updated everything to VFP 5 and the set printer to file command
no
> longer works.  I trace through the program, the command executes, sys(6)
> shows that the file is the output device, but the file is never created
and
> nothing is written to it, the output goes directly to the printer.  I also
> tried set device to file ..., with the same results.  Interestingly, the
> same problem happens in FPW 2.6.

> Am I missing something really obvious?

> Thanks!
> Jed



Wed, 05 Mar 2003 03:00:00 GMT  
 Set printer or device to file
I'm not sure what you're missing, but I've successfully created files


file.

I've found, though, that SET TEXTMERGE TO filename is much more useful

(and SET TEXTMERGE ON, and << >> )

On Sat, 16 Sep 2000 13:02:51 -0600, "Jed Goldstein"

Quote:

>I have a report that has to go to a printer attached to an AS/400.  There
>can be nothing but text in the report, since any control codes cause the
>print spooler to throw an 'Invalid data' error.  The original version of the
>program is in FP 2.6 for DOS, and I do a set printer to file ..., then do

><filename> lpt2.  It's worked for 6 years.

>Now I've updated everything to VFP 5 and the set printer to file command no
>longer works.  I trace through the program, the command executes, sys(6)
>shows that the file is the output device, but the file is never created and
>nothing is written to it, the output goes directly to the printer.  I also
>tried set device to file ..., with the same results.  Interestingly, the
>same problem happens in FPW 2.6.

>Am I missing something really obvious?

>Thanks!
>Jed



Sat, 08 Mar 2003 10:00:27 GMT  
 Set printer or device to file

The interesting thing is that I can pull out the code and run it and everything

say, the printer icon appears in the task bar, and spooling has started.  Thanks
to you and Rick Bean for your suggestions.  I'll check out the alternatives.

Jed

Quote:

> I'm not sure what you're missing, but I've successfully created files


> file.

> I've found, though, that SET TEXTMERGE TO filename is much more useful

> (and SET TEXTMERGE ON, and << >> )

> On Sat, 16 Sep 2000 13:02:51 -0600, "Jed Goldstein"

> >I have a report that has to go to a printer attached to an AS/400.  There
> >can be nothing but text in the report, since any control codes cause the
> >print spooler to throw an 'Invalid data' error.  The original version of the
> >program is in FP 2.6 for DOS, and I do a set printer to file ..., then do

> ><filename> lpt2.  It's worked for 6 years.

> >Now I've updated everything to VFP 5 and the set printer to file command no
> >longer works.  I trace through the program, the command executes, sys(6)
> >shows that the file is the output device, but the file is never created and
> >nothing is written to it, the output goes directly to the printer.  I also
> >tried set device to file ..., with the same results.  Interestingly, the
> >same problem happens in FPW 2.6.

> >Am I missing something really obvious?

> >Thanks!
> >Jed



Sat, 08 Mar 2003 03:00:00 GMT  
 Set printer or device to file

Jed,

I have created several routines that require exact ASCII format such as
electronic tax filing and ACH bank transfer files.  These files can't have any
exrta carriage returns or line feeds or end of line markers etc.  I struggled
trying to use foxpro's data to text conversions and they cause me all sorts of
grief.

It is a simple process however to create a pure text file using foxpro's
low-level file creation routines.  Here is a sample of one of mine:

mfile = fcreate("ach.txt")    \\ create/open a text file
mline = "101 "+mrouting+[1]+mempid+;
         md+mt+[A]+[094101]+mbank+substr(mname,1,23)+[        ]

* I create a vaiable with the text data that I want in the exact format I want -
all the
* variables in the above line are established lengths, mostly coming from
fields.

=fput(mfile,mline)

* I put it in the file

=fclose(mfile)

* I close and write the file

I hope this helps
Bruce from Idaho



Wed, 19 Mar 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. FPW2.6 printing to network printer w/SET DEVICE TO PRINTER

2. Printing using set device to and set printer on

3. set device to printer prompt ?

4. SET DEVICE TO PRINTER

5. Problem: Set device to printer

6. Multiple SET DEVICE TO FILE commands

7. SET DEVICE TO FILE PROBLEM IN VFP 7.0

8. set device to file

9. SET DEVICE TO FILE PROBLEM IN VFP 7.0

10. Printer Device/Driver Information in reports

11. Device context for FoxPro printer

12. SYS(6) - Current Printer Device

 

 
Powered by phpBB® Forum Software