Create DBEntry using AL5 URI with path parameterΒΆ

This example focuses on creating DBEntry using explicit path.

!!! For a simplicity we use hardcoded locations for all files.
subroutine create_db_entry_uri_with_path
    use ids_routines
    implicit none

    character (len=1024), parameter :: uriMDS   = 'imas:mdsplus?path=./testdb_mdsplus'
    character (len=1024), parameter :: uriHDF5  = 'imas:hdf5?path=./testdb_hdf5'
    character (len=1024), parameter :: uriASCII = 'imas:ascii?path=./testdb_ascii'
    integer                      :: idx                                   ! index of opened input file
    integer                      :: status                                ! error code of the operation
    character(:), allocatable    :: errmsg                                ! optional returned error message 

    call imas_open(trim(uriMDS), FORCE_CREATE_PULSE, idx, status, errmsg)
    if (status.ne.0) then
        write(*,*)  'Error! Issue while creating MDS+ file: '//errmsg
    end if
    ! Content of ./testdb_mdsplus directory: ['ids_001.characteristics', 'ids_001.datafile', 'ids_001.tree']
    ! Structure of this directory does not depends on entry content. All IDS data are stored in printed files
    call imas_close(idx, status)

    call imas_open(trim(uriHDF5), FORCE_CREATE_PULSE, idx, status, errmsg)
    if (status.ne.0) then
        write(*,*)  'Error! Issue while creating HDF5 file: '//errmsg
    end if
    ! Content of ./testdb_hdf5 directory: ['master.h5']
    ! Structure of this directory depends on entry content. Every IDS with data will be stored in <ids_name>.h5 file
    call imas_close(idx, status)

    call imas_open(trim(uriASCII), FORCE_CREATE_PULSE, idx, status, errmsg)
    if (status.ne.0) then
        write(*,*)  'Error! Issue while creating ASCII file: '//errmsg
    end if
    ! Content of ./testdb_ascii directory: []
    ! Structure of this directory depends on entry content. Every IDS with data will be stored in <ids_name>.ids file
    call imas_close(idx, status)

end subroutine create_db_entry_uri_with_path