Use the OUTPUT command to direct messages and results of commands to a file, printer, screen, or a combination of destinations.
Options
ANSI
Converts all UTF8 characters to ANSI, to use the output in programs that do not understand UTF8 characters, but does handle the ANSI characters with code values above 127. ANSI and UTF8 would not be used simultaneously.
APPEND
Appends data to the end of an existing file without overwriting the file. If you specify APPEND when the specified file does not exist, R:BASE creates the file with that name. APPEND and CHECK would not be used simultaneously.
BOTH
Refers to PRINTER and SCREEN.
CHECK
Checks for file existence and prompts the user for confirmation before writing to it. APPEND and CHECK would not be used simultaneously.
ENCRYPT
A 512-bit encryption method is used to obscure any output information, making it unreadable without R:BASE and your decryption password. Immediately after using the ENCRYPT parameter in your OUTPUT command, you will be prompted for a password. The password is limited to 32 characters. When running encrypted files with R:BASE, you would RUN the file followed by the password. When opening an encrypted file, you will be prompted for the password.
filespec
Indicates the output device. Specify a file name, with or without an extension. You can also specify a drive and/or path.
FONTNAME font
Specifies a custom font for the printer output. The default font is Courier New.
FONTSIZE nn
Specifies a custom font size for the printer output. The default font size 10.
password
Specifies the password for the encrypted file. If the password is not specified, a prompt to enter the password will be displayed.
Creates the output as a PDF file. The filespec parameter should use the PDF file extension.
The PDF output uses Courier as the default font. The PDF output will use the Default Printer Font settings with the following PROPERTY command:
PROPERTY APPLICATION OUTPUT_PDF_USE_PRINTER_FONT ON
The PDF output can also be configured to use default printer's paper size with the following PROPERTY command:
PROPERTY APPLICATION OUTPUT_PDF_USE_PRINTER_DEF_PAPER ON
PRINTER/Printer
Indicates the output device. Printer is either the word PRINTER or a valid output port, such as LPT1 or COM1. An output port is treated as a file that is automatically copied to the printer device when an OUTPUT SCREEN command is issued.
SCREEN
Indicates the output device is the screen.
UTF8
Adds a UTF8 BOM to the front of the output file. ANSI and UTF8 would not be used simultaneously.
About the OUTPUT Command
The default output device is the screen. After sending data to a printer or file, change the output device to the screen. When using the OUTPUT filespec command, you might lose the data in the file if you exit from R:BASE without sending an OUTPUT SCREEN command to close the file.
You cannot combine two filespec designations such as OUTPUT filespec WITH filespec.
R:BASE cannot tell that the argument LPT1 or COM1 is not the name of a file. For example, if you use the command OUTPUT LPT1, R:BASE creates a file named LPT1. Because R:BASE thinks LPT1 is a file, R:BASE does not print the last buffer of output until you redirect output to the screen.
Sending Data to a Printer
Printer refers to the system default printer. In Windows, to change a printer, use the PRNSETUP command or the Windows Control Panel. In DOS, Printer refers to the printer that is attached to LPT1.
If you are using R:BASE on a local area network, you can direct output to any printer to which you have network access. A common method is to enter the OUTPUT command followed by either the network name of the printer or the printer port on the server.
Sending Data to the Screen
The SET LINES command determines how many lines display on a screen. If a file contains more lines than are designated to display on a screen, R:BASE pauses after each screen display. When displaying a report on a screen, the number of lines specified in the report are displayed.
If the primary output device is a file or a printer and the secondary output device is the screen, R:BASE pauses after each screen display.
Backing Up with OUTPUT
The OUTPUT command can be used with the BACKUP or UNLOAD commands to backup your database to a file. If some part of the command is incorrect-for example, if you fail to specify the correct user identifier for the database-the resulting file contains only the error message produced by the incorrect entry. Use the TYPE or DISPLAY command to display the contents of the file and view the results.
Using SET ECHO ON
To send both your commands and the results of the commands to an output device, enter the command SET ECHO ON before beginning the OUTPUT session. The SET ECHO OFF command only sends command results to an output device.
Examples
Example 01:
The OUTPUT command sends data and messages to the printer and simultaneously displays the data and messages on screen with pauses between screens, if needed.
OUTPUT PRINTER WITH SCREEN
Example 02:
The OUTPUT command directs output to the BACKUP.DAT file on drive A:\. The UNLOAD command sends the data stored in the TransMaster table to the file. The second OUTPUT command closes the file and redirects output to the screen.
OUTPUT a:\backup.dat
UNLOAD DATA FOR TransMaster
OUTPUT SCREEN
Example 03:
The command sends data and messages to the printer, designated as COM1. COM1 is treated as a file that is automatically copied to a printer device when the OUTPUT SCREEN command is issued.
OUTPUT COM1
Example 04:
The commands send data from the Customer table to the printer using a larger font size.
OUTPUT PRINTER FONTSIZE 12
SELECT Company, CustCity, CustState FROM Customer
OUTPUT SCREEN
Example 05:
The commands send data from the Customer table to the printer using the Arial 7 font.
OUTPUT PRINTER FONTNAME Arial FONTSIZE 7
SELECT Company, CustCity, CustState FROM Customer
OUTPUT SCREEN
Example 06:
The commands send data from the Customer table to a PDF file, and open the file with the LAUNCH command.
OUTPUT CustomerList.PDF PDF
SELECT Company FROM Customer ORDER BY Company
OUTPUT SCREEN
LAUNCH CustomerList.PDF
Example 07:
The commands unload the structure and data from the database into an encrypted file, and checks that the file does not already exist
OUTPUT DB_ALL_BACKUP.ALL ENCRYPT pw1234 CHECK
UNLOAD ALL
OUTPUT SCREEN
Example 08:
The commands unload the data from the Customer table with ANSI file encoding
OUTPUT Customer.dat ANSI
UNLOAD DATA FOR Customer
OUTPUT SCREEN