# EXECUTE Execute Basic Instruction

> Source: https://manual.pvxplus.com/directives/execute

## Format

**EXECUTE** *statement$*\[,**ERR**=*stmtref*\]

***Where:***

|  |  |
| --- | --- |
| *statement$* | Character string to be processed by the system ***as if*** entered in Command mode. String expression. |
| *stmtref* | Program line number or statement label to which to transfer control. |

## Description

Use **EXECUTE** to embed Command mode statements directly into a program. A typical use of this directive is to modify the current program dynamically. When used in a compound statement, **EXECUTE** must be the last directive in the line.

Note 1:  
By default, PxPlus changes the current program. If the EXECUTE directive starts with a line number, PxPlus modifies the current program and the line becomes part of the current program, possibly overwriting the existing code. However, if the system parameter ['EX'](https://manual.pvxplus.com/parameters/ex) is *On*, it modifies the program at level 1 (the main level).  
  
Note 2:  
Under WindX, you can use EXECUTE "\[WDX\]..." or EXECUTE "\[LCL\]..." to encapsulate a directive or statement that is not supported across a WindX connection. See [\[WDX\] Direct Action to Client Machine](https://manual.pvxplus.com/command-tags/wdx) and [\[LCL\] Access to Users Local Machine](https://manual.pvxplus.com/command-tags/lcl).

## Example

```
0010 let X$=lst(pgm(tcb(4)+1));execute X$(5),err=*end
0100 if WDX then execute "[WDX]SET_PARAM 'SD' "
```
