Example description
    Program f08qtfe

!     F08QTF Example Program Text

!     Mark 27.0 Release. NAG Copyright 2019.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, x04dbf, ztrexc
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, ifst, ilst, info, ldq,     &
                                          ldt, n
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: q(:,:), t(:,:)
      Character (1)                    :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout,*) 'F08QTF Example Program Results'
      Write (nout,*)
      Flush (nout)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n
      ldq = 1
      ldt = n
      Allocate (q(ldq,1),t(ldt,n))

!     Read T from data file

      Read (nin,*)(t(i,1:n),i=1,n)

!     Read the row indices

      Read (nin,*) ifst, ilst

!     Reorder the Schur factor T

!     The NAG name equivalent of ztrexc is f08qtf
      Call ztrexc('No update',n,t,ldt,q,ldq,ifst,ilst,info)
      If (info/=0) Then
        Write (nout,99999) info, ilst
        Write (nout,*)
        Flush (nout)
      End If

!     Print reordered Schur form

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call x04dbf('General',' ',n,n,t,ldt,'Bracketed','F7.4',                  &
        'Reordered Schur form','Integer',rlabs,'Integer',clabs,80,0,ifail)

99999 Format (' Reordering could not be completed. INFO = ',I3,' ILST = ',I5)
    End Program f08qtfe