# 6.8.3 USE GROUP

Part of: [6 Language](6-language.md) › [6.8 Data Miscellaneous Language (DMISCL)](6-8-data-miscellaneous-language-dmiscl.md)

### Syntax

**USE** **GROUP** _group_name_

### Description

Use (i.e. open) an HDF5 group named _group_name_ for subsequent operations. This will change the current working group to _group_name_, thus avoiding the need to explicitly provide the path of this group when working within it (i.e. subsequent operations are performed relative to this group, unless otherwise specified). If _group_name_ was not found or could not be opened (due to unknown/unexpected reasons), an error is raised. Upon using (i.e. opening) an HDF5 file, the group currently in use is “/” (i.e. the root of the HDF5 file).

### Parameter(s)

_group_name_ – mandatory string that specifies the name of the HDF5 group to use (i.e. open) for subsequent operations. Besides the name of the group to be used for subsequent operations, _group_name_ may be composed of special tokens (that are not part of the name of the group itself). These are:

- “/” to separate multiple groups. Example: “_USE GROUP my_group/my_subgroup/my_subsubgroup_”.
- “.” to refer to the group currently in use. Example: “_USE GROUP ._”.
- “..” to go up one level from the group currently in use. Example: “_USE GROUP .._”.

### Return

Nothing

### Example(s)

```hdfql
# set group currently in use to "/" (i.e. the root of the HDF5 file) 
USE GROUP /

# create two HDF5 groups named "my_group0" and "my_group1" (both groups will be created in group "/")
CREATE GROUP my_group0, my_group1

# create an HDF5 dataset named "my_dataset0" of data type double (it will be created in group "/")
CREATE DATASET my_dataset0 AS DOUBLE

# set group currently in use to "my_group0" (more precisely "/my_group0") 
USE GROUP my_group0

# create an HDF5 dataset named "my_dataset1" of data type double (it will be created in group "/my_group0")
CREATE DATASET my_dataset1 AS DOUBLE 

# create an HDF5 group named "my_subgroup0" (it will be created in group "/my_group0") 
CREATE GROUP my_subgroup0

# create an HDF5 dataset named "my_dataset2" of data type variable-length double (it will be created in group "/my_group0/my_subgroup0")
CREATE DATASET my_subgroup0/my_dataset2 AS VARDOUBLE 

# create an HDF5 attribute named "my_attribute0" of data type float (it will be created in group "/")
CREATE ATTRIBUTE ../my_attribute0 AS FLOAT 

# set group currently in use to "my_subgroup0" (more precisely "/my_group0/my_subgroup0") 
USE GROUP my_subgroup0

# create an HDF5 attribute named "my_attribute1" of data type char (it will be created in group "/my_group1")
CREATE ATTRIBUTE ../../my_group1/my_attribute1 AS CHAR 

# create an HDF5 attribute named "my_attribute2" of data type variable-length char (it will be created in group "/")
CREATE ATTRIBUTE /my_attribute2 AS VARCHAR 

# set group currently in use to "." (the group currently in use will not change (i.e. it remains "/my_group0/my_subgroup0") as "." refers to the current working group itself)
USE GROUP .

# create an HDF5 attribute named "my_attribute3" of data type int (it will be created in group "/my_group0/my_subgroup0")
CREATE ATTRIBUTE my_attribute3 AS INT 

# set group currently in use one level up (should return "/my_group0") 
USE GROUP ..

# create an HDF5 attribute named "my_attribute4" of data type short (it will be created in group "/my_group0")
CREATE ATTRIBUTE my_attribute4 AS SMALLINT
```
