_TEXT System Variable

Directs output from the \ | \\ and TEXT ... ENDTEXT text merge commands to a low-level file.

_TEXT = nFileHandle

Parameters

  • nFileHandle
    Specifies a numeric value that determines the low-level file to which output is directed.

Remarks

\ | \\ and TEXT ... ENDTEXT facilitate the merging of text with the contents of tables, memory variables, and the results of functions and expressions. Output generated by these text merge commands can be directed to the screen or a window or to a low-level file. The _TEXT system memory variable lets you direct text merge output from these commands to a low-level file.

To send output from the \ and \\ and TEXT ... ENDTEXT text merge commands to a low-level file, include the TO FileName clause in SET TEXTMERGE. The file handle of FileName is stored to _TEXT. If the file handle of another low-level file was previously stored in _TEXT, that low-level file is closed.

FCREATE( ) creates and opens low-level files and FOPEN( ) opens existing files. These functions return a positive file handle if the file is successfully created or opened. Storing this file handle to _TEXT directs any subsequent output from the \, \\ and TEXT ... ENDTEXT text merge commands to the file. Use STORE or = to store a file handle to _TEXT. You must open a low-level file with write privileges in order for it to accept output from the text merge commands.

You can close low-level files with FCLOSE( ) or CLOSE ALL. You can also use SET TEXTMERGE TO without a file name to close the low-level file whose handle is stored in _TEXT.

The startup default value of _TEXT is –1. If you are directing text merge output to a file whose file handle is stored in _TEXT, you can turn off the output to that file without closing the file by storing –1 to _TEXT. By storing different file handles and –1 to _TEXT, you can direct text merge output to alternate files.

Example

The following program demonstrates how to direct text merge output to alternate files:

SET TALK OFF
SET TEXTMERGE ON NOSHOW      && Enable text merge, no output to screen
SET TEXTMERGE DELIMITERS TO   && Default text merge delimiters <<,>>
SET TEXTMERGE TO date.txt   && Create and send output to date.txt
STORE _TEXT TO gcDateHandle   && Save date.txt's file handle
STORE -1 TO _TEXT         && Output off to date.txt; keep it open
SET TEXTMERGE TO time.txt   && Create and send output to time.txt
STORE _TEXT TO gcTimeHandle   && Save time.txt's file handle

** Send the following text to time.txt ** \The time is: STORE gcDateHandle TO _TEXT && Now direct output to date.txt ** Send the following text to date.txt ** \Today's date is: STORE gcTimeHandle TO _TEXT && Now direct output to time.txt ** Output the time on the same line ** \ <<TIME( )>> STORE gcDateHandle TO _TEXT && Now direct output to date.txt ** Output the date on the same line ** \ <<DATE( )>> CLOSE ALL && Close all files TYPE date.txt && See what's in this file... WAIT WINDOW && Pause TYPE time.txt && ...and what's in this file ERASE date.txt ERASE time.txt

See Also

\ | \\ | FOPEN( ) | FCLOSE( ) | FCREATE( ) | _PRETEXT | SET TEXTMERGE | SET TEXTMERGE DELIMITERS | System Variables A-Z | System Variables Overview