Library /sys$common/syshlp/helplib.hlb  —  FORTRAN  Intrinsic Procedures, PACK
  PACK (array, mask [,vector])

  Class:  Transformational function - Generic

  Takes elements from an array and packs them into a rank-one array
  under the control of a mask.

  The "mask" must be of logical type and conformable with "array".
  The "vector" must be a rank-one array with the same type and type
  parameters as "array".  Its size must be at least t, where "t" is
  the number of true elements in "mask".  If "mask" is a scalar with
  value true, "vector" must have at least as many elements as there
  are in "array".

  Elements in "vector" are used to fill out the result array if there
  are not enough elements selected by "mask."

  The result is a rank-one array with the same type and type
  parameters as "array".  If "vector" is present, the size of the
  result is that of "vector".  Otherwise, the size of the result is
  the number of true elements in "mask", or the number of elements in
  "array" (if "mask" is a scalar with value true).

  Elements in "array" are processed in array element order to form
  the result array.  Element i of the result is the element of
  "array" that corresponds to the ith true element of "mask".

  If "vector" is present and has more elements than there are true
  values in "mask", any result elements that are empty (because they
  were not true according to "mask") are set to the corresponding
  values in "vector".

  Examples:

  Consider that N is the array |0 8 0|.
                               |0 0 0|
                               |7 0 0|

  PACK (N, MASK=N .NE.  0, VECTOR= (/1, 3, 5, 9, 11, 13/) produces
  the result (7, 8, 5, 9, 11, 13).

  PACK (N, MASK=N .NE.  0) produces the result (7, 8).
Close Help