      SUBROUTINE CRETSP(DVALUE,DLINK,AVAIL)
C
C**********************************************************************
C
C   NAME- CRETSP
C
C   LANGUAGE- VS FORTRAN  TYPE- SUBROUTINE      COMPUTER- NAS 9000
C
C   VERSION- 1.0    DATE- 08/22/89   PROGRAMMER- G. RAJASHEKAR (SMSRC)
C   VERSION -2.0    DATE- 04/29/96   PROGRAMMER- FRANK TILLEY (SMSRC)
C      FOR REHOSTING TO CRAY: CHANGED I*4 TO INT.
C
C   FUNCTION - THIS SUBROUTINE CREATES A LINKED LIST STORAGE POOL
C              AND RETURNS THE STORAGE POOL WITH THE FIRST NODE
C              THAT IS AVAILABLE TO STORE DATA.
C
C   CALLING SEQUENCE PARAMETERS-
C
C   NAME     TYPE    I/O     DESCRIPTION
C   ----     ----    ---     -----------
C
C   DVALUE   INT     I/O     VALUE ARRAY OF DIMENSION MPNOD TO HOLD
C                            ALL THE VALUES OF THE LINKED LIST.
C
C   DLINK    INT     I/O     INTEGER LINK ARRAY OF DIMENSION MPNOD
C                            TO HOLD ALL POINTERS OF THE LINKED LIST.
C
C   AVAIL    INT      O      THE FIRST NODE AVAILABLE IN
C                            THE STORAGE POOL.
C
      INCLUDE 'LLPARM'
C
      INTEGER   DVALUE(MPNOD),DLINK(MPNOD),AVAIL
C
C   LOCAL PARAMETERS-
C
C   VARIABLE                 TYPE  FUNCTION
C   --------                 ----  --------
C   I                        I*4   DO LOOP INDEX
C
      INTEGER     I
C
C   SUBROUTINES CALLED : NONE
C
C   FUNCTIONS USED : NONE
C
C   EXIT STATE : NONE
C
C**********************************************************************
C
C*** THIS WILL INITIALIZE ALL LINK NODES IN THE LINKED LIST STORAGE
C    POOL WITH THE NEXT CORRESPONDING NODE. THE VALUE NODES ARE
C    INITIALIZED TO ZERO.
C
      DO 10 I = 1,MPNOD - 1
         DVALUE(I) = 0
         DLINK(I) = I + 1
  10  CONTINUE
C
C*** THE FIRST AVAILABLE NODE IS SET TO 1. THE LAST NODE IS SET TO
C    A NEGATIVE VALUE TO SPECIFY THE END OF AVAILABILITY OF NODES
C    IN THE STORAGE POOL.
C
      AVAIL = 1
      DLINK(MPNOD) = -1
C
      RETURN
      END
