For Programmers: Free Programming Magazines  


Home > Archive > Clipper > November 2004 > Problems with a print function









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problems with a print function
Vincenzo Palomba

2004-11-23, 3:55 pm

Hi, I have some problems with a procedure used to print some data.
I have two different printers: OKI 591 and OKI 391.
The procedure prints two times some data.
I have two different effects on printers:
OKI ML 591 stops printing for about 10 seconds at the beginning of the
second print and then continue printing.
OKI ML 391 stops at the same point and does not continue printing.
I think the problem could be the printer buffer but I'm not sure of it.
Anyone can solve this problem?
Thanks
VP


P.S. I post my code:


procedure STA_POLI

set printer on
set console off
set device to printer
set margin to
@ PRow(), 2 say prn_init
@ PRow(), 82 say LTrim(Str(Day(d_emiss), 3, 0))
@ PRow(), PCol() + 1 say meseit(d_emiss)
* @ PRow(), PCol() + 1 say LTrim(Str(Year(d_emiss), 4, 0))
@ PRow(), PCol() + 1 say "20" + SubStr(LTrim(Str(Year(d_emiss))), 3, 2)
* @ 5 , 5 say SubStr(LTrim(Str(Year(d_emiss))), 3, 2)
@ PRow(), PCol() + 10 say larg1 + pegno + larg0
@ PRow() + 2, 54 say larg1 + pegno + larg0
@ PRow() + 3, 0 say gr_pr picture "999.99"
@ PRow(), 6 say stima picture "@E 99999.99"
@ PRow(), 19 say durata
@ PRow(), 24 say LTrim(Str(Day(d_scad), 3, 0))
@ PRow(), PCol() + 1 say meseit(d_scad)
* @ PRow(), PCol() + 1 say LTrim(Str(Year(d_scad), 4, 0))
@ PRow(), PCol() + 1 say "20" + SubStr(LTrim(Str(Year(d_scad))), 3, 2)
@ PRow(), 46 say converti(prestito) + "**"
@ PRow(), 81 say prestito picture "@E 99999.99"
@ PRow(), PCol() say larg1
@ PRow(), 97 say prestito picture "99999.99"
@ PRow(), PCol() say larg0
@ PRow() + 3, 1 say dir_pr picture "@E 99999.99"
@ PRow(), 12 say netto_pr picture "@E 99999.99"
@ PRow(), 22 say Time()
@ PRow(), 42 say rcv
@ PRow(), 97 say SubStr(cogn_nome, 1, 18)
@ PRow() + 3, 2 say cogn_nome
@ PRow(), 34 say coniuge
@ PRow(), 53 say telefono
@ PRow(), 72 say cod_fisc
@ PRow(), 104 say pezzi picture "999"
@ PRow() + 3, 2 say via
@ PRow(), 35 say cap
@ PRow(), 51 say citta
@ PRow(), 73 say prov
@ PRow(), 77 say atto_doc
@ PRow(), 103 say gr_pr picture "999.99"
@ PRow() + 3, 2 say luogo_n
@ PRow(), 18 say prov_n
@ PRow(), 22 say data_n
@ PRow(), 32 say documento
@ PRow(), 49 say data_doc
@ PRow(), 58 say left(ril_doc,3)
@ PRow(), 62 say sca_doc
@ PRow(), 72 say left(com_doc,15)
@ PRow() + 4, 1 say descr1
@ PRow() + 1, 1 say descr2
@ PRow() + 1, 1 say descr3
@ PRow() + 1, 1 say descr4
@ PRow() + 1, 1 say descr5
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow(), 2 say prn_init
@ PRow(), 82 say LTrim(Str(Day(d_emiss), 3, 0))
@ PRow(), PCol() + 1 say meseit(d_emiss)
* @ PRow(), PCol() + 1 say LTrim(Str(Year(d_emiss), 4, 0))
@ PRow(), PCol() + 1 say "20" + SubStr(LTrim(Str(Year(d_emiss))), 3, 2)
@ PRow(), PCol() + 10 say larg1 + pegno + larg0
@ PRow() + 2, 54 say larg1 + pegno + larg0
@ PRow() + 3, 0 say gr_pr picture "999.99"
@ PRow(), 6 say stima picture "@E 99999.99"
@ PRow(), 19 say durata
@ PRow(), 24 say LTrim(Str(Day(d_scad), 3, 0))
@ PRow(), PCol() + 1 say meseit(d_scad)
* @ PRow(), PCol() + 1 say LTrim(Str(Year(d_scad), 4, 0))
@ PRow(), PCol() + 1 say "20" + SubStr(LTrim(Str(Year(d_scad))), 3, 2)
@ PRow(), 46 say converti(prestito) + "**"
@ PRow(), 81 say prestito picture "@E 99999.99"
@ PRow(), PCol() say larg1
@ PRow(), 97 say prestito picture "999999.99"
@ PRow(), PCol() say larg0
@ PRow() + 3, 1 say dir_pr picture "@E 99999.99"
@ PRow(), 12 say netto_pr picture "@E 99999.99"
@ PRow(), 22 say Time()
@ PRow(), 42 say rcv
@ PRow(), 97 say SubStr(cogn_nome, 1, 18)
@ PRow() + 3, 2 say cogn_nome
@ PRow(), 34 say coniuge
@ PRow(), 53 say telefono
@ PRow(), 72 say cod_fisc
@ PRow(), 104 say pezzi picture "999"
@ PRow() + 3, 2 say via
@ PRow(), 35 say cap
@ PRow(), 51 say citta
@ PRow(), 73 say prov
@ PRow(), 77 say atto_doc
@ PRow(), 103 say gr_pr picture "999.99"
@ PRow() + 3, 2 say luogo_n
@ PRow(), 18 say prov_n
@ PRow(), 22 say data_n
@ PRow(), 32 say documento
@ PRow(), 49 say data_doc
@ PRow(), 58 say left(ril_doc,3)
@ PRow(), 62 say sca_doc
@ PRow(), 72 say left(com_doc,15)
@ PRow() + 4, 1 say descr1
@ PRow() + 1, 1 say descr2
@ PRow() + 1, 1 say descr3
@ PRow() + 1, 1 say descr4
@ PRow() + 1, 1 say descr5
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1 say " "
@ PRow() + 1, 1
set margin to
set printer off
set device to screen
set console on
return


Klas Engwall

2004-11-26, 3:55 am

Davide,

>try to add a SET PRINTER TO, without parameters, at the end of the print
>job.


That will tell Clipper to close the print job. But which print job?
Which spooler? Unless SET PRINTER TO LPT1 (or LPT2 or LPT3) is added
at the beginning Clipper won't know. So ...

SET PRINTER TO LPT1
// all the other stuff
SET PRINTER TO

.... will take care of it.

Klas

-------
klas dot engwall at engwall dot com

Spammers, please use this address :-) mailto:postmaster@[127.0.0.1]
Przemyslaw Czerpak

2004-11-26, 8:55 pm

On Sun, 21 Nov 2004 21:38:52 GMT,
Klas Engwall <klas.engwall@nospam.please> wrote:
> Davide,
> That will tell Clipper to close the print job. But which print job?
> Which spooler? Unless SET PRINTER TO LPT1 (or LPT2 or LPT3) is added
> at the beginning Clipper won't know. So ...


By default Clipper uses "prn" file name as printer output.
I'm not sure it tries to reopen it or uses handle 4 (in DOS by
default mapped to "prn" device) - you can make some simple tests
to determinate it.

best regards,
Przemek
Klas Engwall

2004-11-27, 3:55 am

Przemek,

>By default Clipper uses "prn" file name as printer output.
>I'm not sure it tries to reopen it or uses handle 4 (in DOS by
>default mapped to "prn" device) - you can make some simple tests
>to determinate it.


Yes, I have a vague recollection that it is supposed to be handle 4.
The point is, though, that there have been many reports here about
non-flushed spoolers over the years. When the code was posted we could
often see a single "SET PRINTER TO <nothing>" at the end of the print
job but no "SET PRINTER TO LPT1" at the beginning. After adding that
line, the posters have usually reported successful flushing.

I don't know how Clipper handles this internally, but based on those
reports my guess is that if it is not set explicitly, Clipper doesn't
care about "un-setting" it.

Regards,
Klas

-------
klas dot engwall at engwall dot com

Spammers, please use this address :-) mailto:postmaster@[127.0.0.1]
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com