write_xy2_data Subroutine

private subroutine write_xy2_data(data_file_name, n, x, y, y2, ierror)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: data_file_name
integer :: n
real :: x(n)
real :: y(n)
real :: y2(n)
integer :: ierror

Calls

proc~~write_xy2_data~~CallsGraph proc~write_xy2_data write_xy2_data proc~get_unit get_unit proc~write_xy2_data->proc~get_unit

Source Code

subroutine write_xy2_data ( data_file_name, n, x, y, y2, ierror )
!
!*******************************************************************************
  implicit none
!
  integer n
!
  character ( len = * ) data_file_name
  integer file_unit
  integer i
  integer ierror
  integer ios
  real x(n)
  real y(n)
  real y2(n)
!
  ierror = 0

  call get_unit ( file_unit )

  if ( file_unit == 0 ) then
    ierror = 1
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_XY_DATA - Fatal error!'
    write ( *, '(a)' ) '  Could not get a free FORTRAN unit.'
    return
  end if

  open ( unit = file_unit, file = data_file_name, status = 'replace', &
    iostat = ios )

  if ( ios /= 0 ) then
    ierror = 2
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_XY_DATA - Fatal error!'
    write ( *, '(a)' ) '  Could not open the output file.'
    return
  end if

  do i = 1, n
    write ( file_unit, * ) x(i), y(i), y2(i)
  end do

  close ( unit = file_unit )

  return
endsubroutine write_xy2_data