    Program f16jtfe

!     F16JTF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: blas_zamin_val, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: r
      Integer                          :: i, incx, k, n
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: x(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: abs
!     .. Executable Statements ..
      Write (nout,*) 'F16JTF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

      Read (nin,*) n, incx
      Allocate (x(1+(n-1)*abs(incx)))

      Read (nin,*)(x(i),i=1,1+(n-1)*abs(incx),incx)

!     Find K = ARGMIN(ABS(Re(X))+ABS(Im(X))) and
!           R = MIN(ABS(Re(X))+ABS(Im(X))).

      Call blas_zamin_val(n,x,incx,k,r)

      Write (nout,*)
      Write (nout,99999) k
      Write (nout,99998) r

99999 Format (1X,'Index of absolutely smallest component of X is',I3)
99998 Format (1X,'Absolutely smallest value is',F12.5)
    End Program f16jtfe
