    Program g01ajfe

!     G01AJF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: g01ajf, nag_wp, x04abf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: iset = 1, nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: xmax, xmin, xstep
      Integer                          :: ifail, ispace, itype, multy, n, n1,  &
                                          nstepx, nstepy, outchn
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: x(:)
!     .. Executable Statements ..
      Write (nout,*) 'G01AJF Example Program Results'
      Write (nout,*)
      Flush (nout)

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

!     Read in the problem size
      Read (nin,*) n, nstepx, nstepy

      Allocate (x(n))

!     Read in data
      Read (nin,*) x(1:n)

!     Set advisory channel
      outchn = nout
      Call x04abf(iset,outchn)

!     Display histogram
      itype = 0

!     Indent 10 spaces
      ispace = 10

!     Display all the data
      xmin = 0.0E0_nag_wp
      xmax = 0.0E0_nag_wp

!     Produce the plot
      ifail = 0
      Call g01ajf(x,n,nstepx,nstepy,itype,ispace,xmin,xmax,xstep,n1,multy, &
        ifail)

      Write (nout,*)
      Write (nout,*)
      Write (nout,*)
      Flush (nout)

!     Display cumulative histogram
      itype = 1

!     Don't indent
      ispace = 0

!     Display only data between -10 and 5
      xmin = -10.0E0_nag_wp
      xmax = 5.0E0_nag_wp

!     Produce the plot
      ifail = 0
      Call g01ajf(x,n,nstepx,nstepy,itype,ispace,xmin,xmax,xstep,n1,multy, &
        ifail)

    End Program g01ajfe
