Command SET ALTERNATE Foundation

Writes screen output to a text file.

Syntax
SET ALTERNATE TO [<cFileName> [ADDITIVE] ]
SET ALTERNATE on | OFF | <lToggle>
Scope
process-wide
Parameters
<cFilename>
<cFilename> specifies the name of the ASCII file where screen output is recorded. The name must contain the drive and path. The file name can be specified either as a literal file name or as a character expression in parentheses. When the file name is specified without a file extension, the extension ".TXT" is used by default.
ADDITIVE
The option ADDITIVE adds the screen output to the current contents of the file <cFileName>. Without this option, the contents of the file are deleted if the file already exists. If a file with the name <cFileName> does not exist, it is created.
<lToggle>
<lToggle> is a logical expression which must appear in parentheses. Instead of the logical expression, the option ON can be specified for the value .T. (true) or OFF for the value .F. (false). When .T. or ON is specified, screen output is recorded in the file <cFileName>.
Description

The command SET ALTERNATE opens an ASCII file to record screen output. Only screen output performed using commands like ? or LIST and functions like QOut() and QQOut() is written into the file. Commands containing the option TO FILE work like SET ALTERNATE. Screen output performed using @...SAY is not written into a file by SET ALTERNATE. To accomplish this, the output device must be defined by SET DEVICE TO PRINTER and the print output directed to a file using SET PRINTER TO <cFileName>.

The alternate file (the ASCII file <cFileName>) is not tied to a single work area, but can be used from all work areas. Output to the file is turned on or off by the options ON | OFF or the logical value of <lToggle>. An alternate file is defined by including a file name in the command SET ALTERNATE. When SET ALTERNATE TO is called without a specified file name, the currently open alternate file is closed and recording screen output to a file is no longer possible. The alternate file is also closed by the commands CLOSE ALTERNATE and CLOSE ALL.

Examples
SET ALTERNATE
// In the example, names of customers in a file are listed 
// using ?. Only those customers who have not paid an invoice 
// are listed. The invoice file is linked with the customer 
// file using the command SET RELATION. 

PROCEDURE Main 
   USE Customer   ALIAS Cust NEW EXCLUSIVE 
   INDEX ON CustNo TO CustA 

   USE Invoice ALIAS Inv NEW 
   SET RELATION TO CustNo INTO CUST 
   GO TOP 

   SET ALTERNATE TO "Notices" 
   SET ALTERNATE ON 

   DO WHILE .NOT. Eof() 
      IF Inv->Payment == 0 
         ? Cust->LName, Cust->FName, Cust->CustNo, Inv->InvNo 
      ENDIF 
      SKIP 
   ENDDO 

   SET ALTERNATE TO 
   CLOSE ALL 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.