delete_preconnection Subroutine

private subroutine delete_preconnection(file_name, unit_number)

Remove an entry from the list of preconnected units

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_name
integer :: unit_number

Source Code

   SUBROUTINE delete_preconnection(file_name, unit_number)
      !! Remove an entry from the list of preconnected units

      CHARACTER(LEN=*), INTENT(IN)                       :: file_name
      INTEGER                                            :: unit_number

      INTEGER                                            :: ic, nc

      nc = SIZE(preconnected)

      ! Search for preconnection entry and delete it when found
      DO ic = 1, nc
         IF (TRIM(preconnected(ic)%file_name) == TRIM(file_name)) THEN
            IF (preconnected(ic)%unit_number == unit_number) THEN
               preconnected(ic)%file_name = ""
               preconnected(ic)%unit_number = -1
               EXIT
            ELSE
               CALL print_preconnection_list()
               CALL dbcsr_abort(__LOCATION__, &
                                "Attempt to disconnect the file <"// &
                                TRIM(ADJUSTL(file_name))// &
                                "> from an unlisted unit")
            END IF
         END IF
      END DO

   END SUBROUTINE delete_preconnection