$ECHO

$ECHO

Top  Previous  Next

 

The $ECHO directive inserted in a paragraph enables or disabled paragraph tracing.

 

 

Format

 

$ECHO {ON}

$ECHO OFF

 

 

The $ECHO directive (optionally with a qualifier of ON) enables paragraph tracing. When this mode is active, the command processor displays the paragraph name, line number and sentence for each line executed.

 

The $ECHO OFF directive disables paragraph tracing.

 

$ECHO is not a command, but a control directive for the paragraph interpreter. Consequently it cannot be entered at the command line and it cannot be executed from a QMBasic program.

 

$ECHO {ON} if not followed by $ECHO OFF in the same paragraph, turns on echo mode for all subsequent paragraphs, whether or not they also contain $ECHO directives. If placed in the LOGIN paragraph, it will turn on echo mode for all paragraphs throughout the account. This can be done selectively by, for example, testing the login name of the user. In this way, echo mode can be limited to developers who need it for debugging purposes.

 

IF @LOGNAME # 'TESTER' THEN GO FINISH

$ECHO ON

FINISH:

 

This fragment of paragraph logic turns echo on for user TESTER only. A developer who has a need to see paragraph commands echoed will log in with that user name. All other users will see paragraphs acting as usual.

 

 

Example

 

The following paragraph might be used to delete all items in the BP.OUT file for which there is no corresponding source record in the BP file.

 

VOC CLEAN.BP

1: PA

2: $ECHO

3: SELECT BP.OUT

4: NSELECT BP

5: IF @SELECTED = 0 THEN STOP

6: DELETE BP.OUT

7: DATA Y

 

Running this with the $ECHO on line 2 shows are trace of each command prior to execution:

:CLEAN.BP

CLEAN.BP 3: SELECT BP.OUT

223 record(s) selected to list 0

CLEAN.BP 4: NSELECT BP

17 record(s) selected to select list 0

CLEAN.BP 5: IF @SELECTED = 0 THEN STOP

CLEAN.BP 6: DELETE BP.OUT

Use active select list (First item 'J7')? Y

17 record(s) deleted