Changing Printer Setup for R/LIST Reports
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 29 JUL 1990 | 2.X | INTERMEDIATE | REPORTS, PRINTER_SETUP, ESCAPE, SEQUENCES |
If you print R/LIST reports using different printer set-ups (for example, using various fonts and page lengths), you will want a quick easy way to send escape sequences from Advanced Revelation to the printer.
One way to print a report in different formats is to maintain several version of the same report program, each containing a different escape sequence. Another alternative is to put the escape sequences in separate R/BASIC programs and then put the programs on a menu.
A third alternative, and the one described in this technical bulletin, is to write an R/BASIC program that:
- Interprets instructions that you have prefixed to an R/LIST statement, and sends the appropriate escape sequence to the printer.
- Strips the printer instructions.
- Executes the R/LIST statement.
Figure One is a sample program that enables you to include printer setup instructions in an R/LIST statement.
To use the program follow these steps:
- Enter the program into your programs file. Add to or change the CASE conditions to meet your needs.
EDIT BP PRINTER_SETUP
- Compile and catalog the program.
COMPILE BP PRINTER_SETUP MAKEVOC BP PRINTER_SETUP
- Run the program like this:
PRINTER_SETUP SHORTFORM LIST SAMPLE_CUSTOMERS CITY STATE ZIP
The first two words of the program, PRINTER_SETUP (the name of the VOC entry) and SHORTFORM (the option that causes the program to set a short page length) are stripped after the printer codes have been sent.
Note: This program allows you to include just one printer setup instruction in your R/LIST statement. If you want to set both page length and font, you must create another option that sends the appropriate escape sequence.
Examples
Figure One
EQU SPACE$ TO CHAR(32) ;* The space character. EQU ESC$ TO CHAR(27) ;* The escape character. * First, turn on the printer * PRINTER ON * Now, parse @SENTENCE looking for the second word. That * word tells us which setup codes to use. * Note: This program assumes Epson codes. SENT = TRIM(@SENTENCE) SETUP = FIELD(SENT, SPACE$, 2) BEGIN CASE CASE SETUP = "COMPRESSED" * The escape sequence to print compressed characters * should be printed here. PRINT ESC$:CHAR(15) CASE SETUP = "LONGFORM" * The escape sequence to set the page length goes here. PRINT ESC$:CHAR(67):CHAR(0):CHAR(11) CASE SETUP = "SHORTFORM" * The escape sequence to set the short form page length * goes here PRINT ESC$:CHAR(67):CHAR(0):CHAR(4) CASE 1 * This is the default case. Use it to reset the printer * to it's "normal" mode. PRINT ESC$:CHAR(64) END CASE * Remove the first two words from the sentence. * POS = INDEX(SENT, SPACE$, 2) SENT[1,POS] = "" * * Now execute the R/LIST sentence. PERFORM SENT * Reset the printer. * PRINT ESC$:CHAR(64) PRINTER OFF STOP