CDS094

New Page / Close Printer

Last Revised: 03/16/11

This routine should be used by all print jobs both at the start of a new page, and when necessary to close the printer channel before returning to the menu, or by applications that do not return to the Dynamo Tools menu program CDS001.  It handles all new page logic, printing reports to the display, and special end-of-job logic.  It also works with all supported printer devices including dot matrix printers, laser/inkjet printers, printing to the display (both 80 and 132 column display types), faxing, printing to a file, printing to a PDF file, emailing text, emailing PDF files as attachments, as well as printing in portrait or landscape mode.  If you use CDS094, then no additional logic is required within the application program to handle printing to the display, or other special output device.

New Page Logic

In the NEWPAGE routine of any program that prints, call CDS094 before printing anything to the page.  There should be no 'FF' mnemonics anywhere in the application program.  CDS094 will print the 'FF' when applicable. 

    CALL "CDS094",Y6$

In most circumstances, you want to send a form feed to the printer when starting a new page, except on the very first page.  CDS094 will handle this for you, and take into account any fax cover page that may have been printed.  This prevents a blank page at the beginning of each report.

When printing to the display, CDS094 will prompt the operator to continue, so the display can be cleared to display the next page.  The operator is also given an F2 choice to continue without prompting for each page, and an F4 option to abort the job and return to the menu processor.  CDS094 also changes the display to 132 column mode when the report requires more than 80 columns and the display device supports 132 column mode.  If the display device does not support 132 column mode, then the new page prompt will allow the user to slide the view window to view either the leftmost 80 or rightmost 80 columns of the report using the ArrowLf & ArrowRt keys.

When printing to a file, CDS094 will not send the form feed to the file.

CDS094 increments the page counter Y6.P and sets the line counter Y6.L to the maximum lines on the page Y6.MAXL so that the operator does not need to do so in the application.  Application programs should use Y6.P as the page numbers, and Y6.L as the lines left on the page.  If the application program still uses the simple variable L and not Y6.L, then just set L=Y6.MAXL after calling CDS094.  This will insure the maximum lines per page is correct for printing in portrait, landscape, terminals, files, etc.

Using CDS094 enables a program to work independent of the device being printed to.

Close Printer Logic

When an application is finished and returns the Dynamo Tools menu program CDS001, CDS094 will be called when to close the printer channel if the printer status variable Y6$ (created by the printer selection routine CDS084) is still in memory.

When an application must close the printer channel prior to returning to the Dynamo Tools menu, or if the application does not RUN "CDS001" at the end of the job, then the application needs to call CDS094 one more time to complete the printing process.

    CALL "CDS094",Y6$,"E"

The "E" informs CDS094 that you are done using the printer/device.

When printing to a printer, a form-feed will be sent to the printer causing the last page to be ejected on a laser type printer, or advance to the tear bar on a dot-matrix printer.

When printing to a display, the operator is prompted so that the last page can be displayed before returning to the menu or other logic within the application.

When emailing, the FINISH flag of the email log is set to Y, to provide verification that the application sending the email did in fact finish, and so the email is complete.

When emailing a PDF attachment, CDS094 will call CDS184 to attach the PDF file to the email.

Note that the printer channel opened to Y6.CH is closed, and Y6$ is cleared when CDS094 is called to close the printer.

When running on a linux, Unix, or AIX server from a PC running facetwin, the user will be asked to display the report file at job completion if the report was printed to a text file or to an Adobe PDF file.  This option requires a Server Share named PRT for the PRT folder on the server where these files are created.

Calling Format:

CALL "CDS094", Y6$, { EOJ$ }

CDS094
Y6$ To Printer Type Information provided by the call to CDS084 when the printer was selected
EOJ$ To
"E" End of print job.  If creating a PDF file or text file, and using a workstation using an emulator such as FacetWin or PowerTerm, then launch an appropriate viewer for the file.  If not using the recommended terminal emulator, the operator will be prompter with the URL to use to view the result.
"e" Same as "E" but does not launch a viewer or advise the user with the URL.
null, not passed, or other value Start new page of output.

CDS094 will directly run the external menu, or the Dynamo Tools menu processor CDS001 when printing a report to the display and the operator uses F4 to abort.  This means that any updates that take place at the end of a printed report will not be executed when the user prints the report to the display, and uses the F4 option to abort prior to the report completing.

The CALL to CDS094 does not require an ERR= option.

Example using CDS094 with a program that returns to menu program CDS001 at the end of job
1000 NEWPAGE:
1010 CALL "CDS094",Y6$
1020 PRINT (Y6.CH)..."Page",Y6.P
.

.
.
1090 RETURN

Before each PRINT:

IF Y6.L<1 THEN GOSUB NEWPAGE
PRINT (Y6.CH)...
Y6.L=Y6.L-1

9000 EOJ:
9010 RUN "CDS001"