    PROGRAM g01ajfe

!      G01AJF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. 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
