# 5.2.1 hdfql_execute

Part of: [5 Application Programming Interface](5-application-programming-interface.md) › [5.2 Functions](5-2-functions.md)

### Syntax

int hdfql_execute(const char \*_script_)

### Description

Execute a script named _script_. A script can be composed of one or more operations – in the case of multiple operations, these can either be separated with a semicolon (;) or an end-of-line (EOL) terminator. In HDFql, operations are case insensitive, meaning that, for example, the operation “SHOW DATASET” is equivalent to “show dataset” or any other case variation. If a certain operation raises an error, any subsequent operations within _script_ are not executed. Please refer to [Table 6.2](6-language.md#table-6-2) for a complete enumeration of HDFql operations.

### Parameter(s)

_script_ – string containing one or more operations to execute. Multiple operations are either separated with a semicolon (;) or an end-of-line (EOL) terminator.

### Return

int – depending on the success in executing _script_, it can be [HDFQL_SUCCESS](5-1-constants.md#hdfql_success), [HDFQL_ERROR_PARSE](5-1-constants.md#hdfql_error_parse), [HDFQL_ERROR_NOT_SPECIFIED](5-1-constants.md#hdfql_error_not_specified), [HDFQL_ERROR_NOT_FOUND](5-1-constants.md#hdfql_error_not_found), [HDFQL_ERROR_NO_ACCESS](5-1-constants.md#hdfql_error_no_access), [HDFQL_ERROR_NOT_OPEN](5-1-constants.md#hdfql_error_not_open), [HDFQL_ERROR_TEMPORARILY_UNAVAILABLE](5-1-constants.md#hdfql_error_temporarily_unavailable), [HDFQL_ERROR_INVALID_NAME](5-1-constants.md#hdfql_error_invalid_name), [HDFQL_ERROR_INVALID_FILE](5-1-constants.md#hdfql_error_invalid_file), [HDFQL_ERROR_NOT_SUPPORTED](5-1-constants.md#hdfql_error_not_supported), [HDFQL_ERROR_NOT_ENOUGH_SPACE](5-1-constants.md#hdfql_error_not_enough_space), [HDFQL_ERROR_NOT_ENOUGH_MEMORY](5-1-constants.md#hdfql_error_not_enough_memory), [HDFQL_ERROR_ALREADY_EXISTS](5-1-constants.md#hdfql_error_already_exists), [HDFQL_ERROR_EMPTY](5-1-constants.md#hdfql_error_empty), [HDFQL_ERROR_FULL](5-1-constants.md#hdfql_error_full), [HDFQL_ERROR_BEFORE_FIRST](5-1-constants.md#hdfql_error_before_first), [HDFQL_ERROR_AFTER_LAST](5-1-constants.md#hdfql_error_after_last), [HDFQL_ERROR_OUTSIDE_LIMIT](5-1-constants.md#hdfql_error_outside_limit), [HDFQL_ERROR_NO_ADDRESS](5-1-constants.md#hdfql_error_no_address), [HDFQL_ERROR_UNEXPECTED_TYPE](5-1-constants.md#hdfql_error_unexpected_type), [HDFQL_ERROR_UNEXPECTED_DATA_TYPE](5-1-constants.md#hdfql_error_unexpected_data_type), [HDFQL_ERROR_UNEXPECTED_STORAGE_TYPE](5-1-constants.md#hdfql_error_unexpected_storage_type), [HDFQL_ERROR_DANGLING_LINK](5-1-constants.md#hdfql_error_dangling_link), [HDFQL_ERROR_NOT_REGISTERED](5-1-constants.md#hdfql_error_not_registered), [HDFQL_ERROR_INVALID_OPERATION](5-1-constants.md#hdfql_error_invalid_operation), [HDFQL_ERROR_INVALID_REGULAR_EXPRESSION](5-1-constants.md#hdfql_error_invalid_regular_expression), [HDFQL_ERROR_INVALID_SELECTION](5-1-constants.md#hdfql_error_invalid_selection), or [HDFQL_ERROR_UNKNOWN](5-1-constants.md#hdfql_error_unknown).

### Example(s)

```c
// declare variable 
int status;

// execute script (composed of only one operation (i.e. SHOW USE FILE)) 
status = hdfql_execute("SHOW USE FILE");

// display message about the status of executed script (i.e. successful or not) 
if (status == HDFQL_SUCCESS)
    printf("Execution was successful\n");
else
    printf("Execution was not successful and returned status is %d\n", status);
```

```c
// execute script (composed of two operations (i.e. USE FILE my_file.h5 and SHOW)) 
hdfql_execute("USE FILE my_file.h5 ; SHOW");
```
