Printing to a file

Brian K. White brian at aljex.com
Wed May 26 11:20:49 PDT 2004


----- Original Message ----- 
From: George Simon
To: Filepro 2 List
Sent: Wednesday, May 26, 2004 12:06 PM
Subject: Printing to a file



Using SCO Unix filePro version 5.0.08R4
I need to print a report to a file.
I'm using this syntax in a subroutine called DEFINEP:

DEFINEP. If        .
       Then:
.
 27  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       . If:
.
       Then: printer type "hp_accting"
.
 28  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       . If:
.
       Then: dt(8,mdyy)=@t4
.
 29  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       . If:
.
       Then: printer file "/u/tracking/"{3{"_onhand_"{dt{".pcl"
.
 30  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       . If:
.
       Then: filename1=""{3{"_onhand_"{dt{".pcl" ; return

The problem is that when I run the report, the report header and the first
record gets written to the file and then I get this error message:

*** A System Error Has Occurred ***

/u/tracking/1148_onhand_05262004.pcl

On File: /u/tracking/1148_onhand_05262004.pcl

Output Processing
Line Number: 29
Permission denied

What do I have to do to avoid this error?

Thanks.

George Simon (IT Department)
American River Logistics, LTD
614 Progress St.
Elizabeth, NJ  07205
Phone:(908)354-7746      Fax:(908)354-7491
mailto:george at worldest.com
http://www.americanriverintl.com/


 ----------------------


I don't think you want a real field variable in your printer file command
since it changes with every record processed
unless field 3 contains the same exact value in every record.

If you really want the filename to change then you have to put a subtotal on
field 3 and do a "printer file ..." command in @wbrkN to create the new
filename when that field changes, or use processing to track when the field
changes and do a gosub when it does. But from the way your complaint is
worded, I doubt you wanted more than one output file.

Make a global dummy in @once and put the filename in there, and do your
printer file ... command there too.
Actually, if you do the printer file command in @once, and don't need to
create other files during the report, then you don't need a global dummy
since you will never need to refer to it anyways. The printer file command
will only be executed one time, before the first record is processed. Note:
the real field "3" may not yet contain a value at @once time, I don't think
I've ever refered to a real field at @once time before so I don't know
offhand. It's just something I wouldn't be surprised about.

Put the @once at the end of the table after an unconditional end (ie: no
chance that an "if: ..." condition might cause the end to get skipped and
have processing fall through to the @once. If you let that happen then the
@once will be @lots-of-times.

1   if:
   then: blah blah
2   if:
   then: blah blah
3   if:
   then: end
4 @once  if:
  then: dt(8,mdyy,g)=@t4 ; of(256,*,g) =
"/u/tracking/"{3{"onhand"{dt{".pcl"
5  if: 'presumably you will want to read and then delete this file from some
other process
  then: system noredraw "umask 0;>"{of"      ' so create it with open perms
first
6  if:
  then: printer type "hplaser" ; printer file of
7  if:
  then: end


I have seen other working processing that was written long before @once came
about that used processing and a few dummies to track when fields changed
and to detect when processing is on the first record of the report
In these, the printer file command is in the main body of processing and
there is a printer reset just before the printer file ...
and there are tests to jump over those two lines except when some field
changes or when the report has just started up.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani



More information about the Filepro-list mailing list