# PxIOExecuteDirection

> Source: https://manual.pvxplus.com/pxio-library/library-functions/miscellaneous-file-functions/pxioexecutedirection

## Description

Sets the direction that the PxIORead command will use to read records

## Format

**int** **PxIOExecuteDirection(PxIOFileHandle handle, int direction);**

***Where:***

|  |  |
| --- | --- |
| **handle** | The handle of an open file |
| **direction** | Number of records forwards (a positive value) or backwards (a negative value) that the PxIORead function should automatically move the next time it is called *(Default value: 1)* |

## Return Value

If the function succeeds, a value of PXIO_SUCCESS_STATUS is returned; otherwise, an error value is returned. More information on the nature of the error can be found by calling **[PxIOGetError](https://manual.pvxplus.com/pxio-library/library-functions/error-functions/pxiogeterror)**.

Note:  
To emulate some legacy systems, it is necessary to change the auto-increment value that the [PxIORead](https://manual.pvxplus.com/pxio-library/library-functions/file-read-functions/pxioread) function uses to determine the next record to be read. This function implements that option and is equivalent to the PxPlus DIR= option in the [READ](https://manual.pvxplus.com/directives/read) directive. This function's effect is limited in that it only has effect until the next Read function is executed. Hence, it must be repeatedly called after each Read function call to fully emulate the legacy system.
