Hi Vincent,
When our staff were sent home during COVID I had to come up with a way to print D3 reports and to print network documents remotely in people's homes. They also needed to generate PDF documents from network documents and Office documents generated by D3.
I had no idea how to do this but managed to wing my way through it by writing a few subroutines and utility programs to help along the way.
My solution centred on CSV files and plain text files. We use HostAccess as our terminal emulator and I used some of their ideas for file transfers to make my own.
For plain text files, i.e. D3 reports, I set everyone's default printer using SP-ASSING HSF99. This only ever creates a Hold File with a form queue of 99, easy to spot in the LQ listing. I then wrote an EXPORT utility program that sends the hold file to a common network location everyone has access to, in our case Z:\Temp. The users can then pick up the report and do with it as they please.
For Excel spreadsheets, I noted there is a way to produced TSV output from a SORT or LIST command. See the D3 Reference Manual gem below:
Tabbed Output
AQL allows another form of output referred to as tab delimited output for use when transferring data from D3 to PC applications. Optionally, this can be selected by modifying the AQL command that is used in the AQL sentence. This is done by adding an additional mode ID (53) to the third value of attribute 2 of the master dictionary definition of the AQL command that is being used. AQL produces output delimited by tabs and each line of data is terminated with a CR for transfers to applications running on PCs.
I created 2 new verbs SORTT and LISTT which are copies of the SORT & LIST verbs with the change to attrib 2 as noted above. It works just fine and produces a TSV file. There is a caveat though, it does not produce a header row. I have asked Rocket for a solution but none was forthcoming. I began writing a utility program to insert a header row but alas, sadly, I never managed to get it going sufficiently to make it a proper working utility. It only works for VERY simple AQL statements.
For D3 reports generated programmatically by the application, I have a subroutine that generates CSV records from a dynamic array. It is a generic CSV utility sub that generates CSV records by default, but you can specify what field delimiter and value delimiter to use if the standard comma and quote characters are not suitable. I append the generated CSV records into a dynamic array and send it to the network using a utility program/sub that creates a Q-Pointer to the network Share be used for the file transfers (Z:\Temp in our case). Excel can then automatically import the CSV file and create a worksheet from it.
I must admit, I rarely use the SORTT or LISTT verbs, preferring to write report programs (which give me more freedom in selection, formatting and presentation), then generating CSV records from the report lines and finally exporting the generated item to the network.
I'm happy to share my code with you if you like to get an idea of the process or to use it in your business if needed. It's not glorious code, just gets the job done in the short space of time available to me.------------------------------
Walter Kiess
SA Police Super
------------------------------
Original Message:
Sent: 03-04-2021 15:33
From: Vincent Elliott
Subject: Printing and emailing reports via PDF files
Hi Brian,
Yes...it has been a long time and hope that you are also keeping well.
I think it would be a good idea to enter the enhancement requests given the current climate of remote work. Soft copies of reports delivered electronically I think is definitely something that should be brainstormed and implemented.
Another good to have is an Excel spreadsheet generated from the SS
connective.
Best regards and keep safe,
Vincent "Kim" Elliott
ITC, Bearings & Accessories Ltd.
83 Harbour Street,
Kingston, Jamaica
Tel: 876-922-1950
Fax: 876-922-8129
Cell: 876-315-2739
Original Message:
Sent: 3/4/2021 2:41:00 PM
From: Brian Cram
Subject: RE: Printing and emailing reports via PDF files
Hi, Vincent. Brian Cram here. It's been a while since we talked. Hope you are doing well.
To your question about CUPS PDF printing, I don't know if any of this is currently on the radar, and if I had to bet, I would bet that it is not. Would you like me to enter some enhancement requests on your behalf?
------------------------------
Brian Cram
Senior Technical Support Engineer
Rocket Software
Original Message:
Sent: 03-04-2021 09:23
From: Vincent Elliott
Subject: Printing and emailing reports via PDF files
I just discovered (joyfully) that we could print and email (by way of Cups-PDF post processing options) any D3 report to a PDF file by defining a shared printer that outputs its contents through Cups-PDF (we use D3/Linux). The printer also respects the CUPS options passed to it (I have only tested -o landscape and -o cpi=17 so far).
Coming out of this discovery, here is an initial list of wish I hads:
- The ability to directly mail the reports to the consumers rather than having to forward them from a single central mailbox.
- The ability to inject the title of the report into the PDF document and also name the resultant file for ease of identification.
- The ability to colorize elements of the report. I guess this would have to come from some DEVICE file definition.
- The ability to archive the reports based on title and date/time generated.
Any help in respect of the above would be appreciated.
Finally, is ROCKET planning to develop anything in this regard.
Best regards and keep safe,
Vincent "Kim" Elliott
ITC, Bearings & Accessories Ltd.
83 Harbour Street,
Kingston, Jamaica
Tel: 876-922-1950
Fax: 876-922-8129
Cell: 876-315-2739