# '\*X' Program to Call on CLOSE

> Source: https://manual.pvxplus.com/mnemonics/tilde-x

**Definition**

## Format

MNEMONIC (*chan*)'\*X'=" *prog_name*\[;*entry*\]\[;*params*\]"

***Where:***

|  |  |
| --- | --- |
| *chan* | Channel or logical file number for which the mnemonic is defined. |
| *entry* | Name of starting statement label to use as entry point in the program. Optional. If included, add to the *prog_name* string expression (e.g. RUN "PROG;STARTING_LABEL"). |
| *params* | Parameters (if any) needed in your **CALL**ed program. |
| *prog_name* | Name of the program. String expression. |

## Description

**'\*X'** (*asterisk X*) contains the pathname of a program to **CALL** on the closing of a channel. When a file is closed, PxPlus issues a **CALL** to the program/entry point specified by the contents of **'\*X'**. This takes place just prior the file being actually being closed, allowing the program to alter the contents of the file if desired.

To retrieve the parameter list, the **CALL**ed program should reference PGM(-3), which contains the complete string contained in the **'\*X'** mnemonic definition.

For additional information regarding the use of special mnemonics (i.e. **'@@'**, **'\*C'**, **'\*I'**, **'\*O'**, **'\*R'**, **'\*X'**, **'AT'**, **'GD'**, **'WX'**) when creating a device driver, see **[Dynamic Information in Mnemonics](https://manual.pvxplus.com/mnemonics/dynamic-information-in-mnemonics)** or **[Device Drivers](https://manual.pvxplus.com/pxplus-user-guide/appendix-of-miscellaneous-topics/device-drivers/overview)**.

## Example

```
load "TSTX"
list
0010 LBL:
0020 msgbox "HELLO--"+sep+"FIL="+str(lfa)+sep+"MNM="+mnm('*X',lfa)
0030 end
open (1)"\JUNK.TXT"
mnemonic (1)'*X'="TSTX;LBL;My backspace key is orange"
close (1)
```
