get_next_non_blank_character_this_record Subroutine

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

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: unit
character(kind=CK,len=1), intent(out) :: ch
integer, intent(out) :: iostat
character(kind=CK,len=*), intent(inout) :: iomsg

Called by

proc~~get_next_non_blank_character_this_record~2~~CalledByGraph proc~get_next_non_blank_character_this_record~2 get_next_non_blank_character_this_record proc~get_next_non_blank_character_any_record~2 get_next_non_blank_character_any_record proc~get_next_non_blank_character_any_record~2->proc~get_next_non_blank_character_this_record~2 proc~read_formatted~2 read_formatted proc~read_formatted~2->proc~get_next_non_blank_character_any_record~2

Contents


Source Code

   subroutine get_next_non_blank_character_this_record(unit, ch, iostat, iomsg)
   !< Get the next non-blank character in the current record.
   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.

   do
      ! we spcify non-advancing, just in case we want this callable outside the context of a child input statement
      ! the PAD specifier simply saves the need for the READ statement to define ch if EOR is hit
      ! read(unit, "(A)", iostat=iostat, iomsg=iomsg, advance='NO') ch
      ! ...but that causes ifort to blow up at runtime
      read(unit, "(A)", iostat=iostat, iomsg=iomsg, pad='NO') ch
      if (iostat /= 0) return
      if (ch /= '') exit
   enddo
   endsubroutine get_next_non_blank_character_this_record