get_next_non_blank_character_any_record Subroutine

private subroutine get_next_non_blank_character_any_record(unit, ch, iostat, iomsg)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: unit

Logical unit.

character(kind=CK,len=1), intent(out) :: ch

The non-blank character read. Not valid if IOSTAT is non-zero.

integer, intent(out) :: iostat

IO status code.

character(kind=CK,len=*), intent(inout) :: iomsg

IO status message.

Description

Get the next non-blank character, advancing records if necessary.

Calls

proc~~get_next_non_blank_character_any_record~~CallsGraph proc~get_next_non_blank_character_any_record get_next_non_blank_character_any_record proc~get_next_non_blank_character_this_record get_next_non_blank_character_this_record proc~get_next_non_blank_character_any_record->proc~get_next_non_blank_character_this_record
Help

Called By

proc~~get_next_non_blank_character_any_record~~CalledByGraph proc~get_next_non_blank_character_any_record get_next_non_blank_character_any_record proc~read_formatted read_formatted proc~read_formatted->proc~get_next_non_blank_character_any_record
Help

Variables

TypeVisibility AttributesNameInitial
character(len=len(iomsg)), public :: local_iomsg

Local variant of iomsg, so it doesn't get inappropriately redefined.


Source Code

  subroutine get_next_non_blank_character_any_record(unit, ch, iostat, iomsg)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Get the next non-blank character, advancing records if necessary.
  !---------------------------------------------------------------------------------------------------------------------------------
  integer,                   intent(in)    :: unit        !< Logical unit.
  character(kind=CK, len=1), intent(out)   :: ch          !< The non-blank character read. Not valid if IOSTAT is non-zero.
  integer,                   intent(out)   :: iostat      !< IO status code.
  character(kind=CK, len=*), intent(inout) :: iomsg       !< IO status message.
  character(len(iomsg))                    :: local_iomsg !< Local variant of iomsg, so it doesn't get inappropriately redefined.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  do
    call get_next_non_blank_character_this_record(unit=unit, ch=ch, iostat=iostat, iomsg=local_iomsg)
    if (is_iostat_eor(iostat)) then
      ! try again on the next record
      read (unit, "(/)", iostat=iostat, iomsg=iomsg)
      if (iostat /= 0) return
    elseif (iostat /= 0) then
      ! some sort of problem
      iomsg = local_iomsg
      return
    else
      ! got it
      exit
    endif
  enddo
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine get_next_non_blank_character_any_record