NAG Library Manual, Mark 29.1
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program s18defe

!     S18DEF Example Program Text

!     Mark 29.1 Release. NAG Copyright 2023.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s18def
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: n = 2, nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: z
      Real (Kind=nag_wp)               :: fnu
      Integer                          :: ifail, ioerr, nz
      Character (1)                    :: scal
!     .. Local Arrays ..
      Complex (Kind=nag_wp)            :: cy(n)
!     .. Executable Statements ..
      Write (nout,*) 'S18DEF Example Program Results'

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

      Write (nout,*)
      Write (nout,99999) 'Calling with N =', n
      Write (nout,*)
      Write (nout,*)                                                           &
        '   FNU            Z        SCAL       CY(1)              CY(2)',      &
        '        NZ'
      Write (nout,*)

data: Do
        Read (nin,*,Iostat=ioerr) fnu, z, scal

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s18def(fnu,z,n,scal,cy,nz,ifail)

        Write (nout,99998) fnu, z, scal, cy(1), cy(2), nz
      End Do data

99999 Format (1X,A,I2)
99998 Format (1X,F7.4,'  (',F7.3,',',F7.3,')   ',A,2('  (',F7.3,',',F7.3,')'), &
        I4)
    End Program s18defe