next up previous contents index
Next: MZINQS - inquiry Up: MZ routines for Previous: MZCOPY - copy

MZNEED - calculate free space in division

This routine measures the free space available in a particular division, either the space available immediately or the space after garbage collection.

CALL MZNEED (IXDIV, NEED, chOPT)

with

      IXDIV     index of the division

      NEED      number of words needed, trigger garbage collection
                if G option selected and less than NEED words available

      chOPT     character string of options:

                G  execute garbage collection
                   if less than NEED words available

On return /QUEST/IQUEST(100) contains the following information
about the division IXDIV:

   IQUEST(11)   NEX, the number of free words beyond NEED,
                negative if less than NEED words available,
                ie. the total available is NEED+IQUEST(11);

   IQUEST(12)   the space occupied by the banks, including dead banks
                if any, of the division;

   IQUEST(13)   the maximum space allowed for this division,
                as given to MZDIV.

Example:

Suppose IXDIV is a forward division, and the user wants to take all its space into one single maximum size bank, which will be filled by a variable amount of data, but less than NEED words; when the filling is complete the bank will be reduced to its true size:

      NEED = 8000
      CALL MZNEED (IXDIV, NEED, 'G')
      IF (IQUEST(11).LT.0)              GO TO no luck

      ND = NEED + IQUEST(11) - 19       (7 links, 12 system words)
      CALL MZBOOK (IXDIV,L,LSUP,JB, 'name',7,2,ND,2, -1)

      fill words IQ(L+1) TO IQ(L+NU)

      CALL MZPUSH (IXDIV,L,0, NU-ND, 'R')


Janne Saarela
Mon May 15 08:34:47 METDST 1995