3 General overview of the NDG_ system

As a broad outline, applications use the NDG_ package as follows:

(1)
A call is made to NDG_ASSOC which causes the user to be prompted for a single parameter. This parameter can be of any type. The user replies with a “group expression” (see SUN/150), which contains the names of a group of existing NDFs to be used as inputs by the application1. For instance, the group expression may be
  m51_b[23]s1_ds,m51_b[23]s2_ds,m51_b[23]s2?_ds,^files.lis

This is a complicated example, probably more complicated than would be used in practice, but it highlights the facilities of the GRP and NDG packages, e.g. wild cards (“?”, “” or “[..]” ), lists of files, or indirection through a text file (“^”).

The NDG_ASSOC routine produces a list of explicit NDF names, which are stored internally within the GRP system.

(2)
What happens next depends on the application, but a common example may be the initiation of a DO loop to loop through the input NDFs (NDG_ASSOC returns the total number of NDF names in the group).
(3)
To access a particular NDF, the application calls routine NDG_NDFAS supplying an index, n, within the group (i.e n is an integer in the range 1 to the group size returned by NDG_ASSOC). NDG_NDFAS returns an NDF identifier to the nth NDF in the group. This identifier can then be used to access the NDF in the normal manner using the NDF_ routines (SUN/33). The identifier should be annulled when it is no longer needed using NDF_ANNUL in the normal way.
(4)
Once the application has finished processing the group of NDFs, it calls GRP_DELET which deletes the group, releasing all resources reserved by the group.
(5)
Routine NDG_ASSOC can also be used to append a list of NDF names obtained from the environment, to a previously defined group.

The routine NDG_CREAT produces a group containing the names of NDFs which are to be created by the application. The routine NDG_NDFCR will create a new NDF with a name given by a group member, and returns an NDF identifier to it. Routine NDG_NDFPR creates a new NDF by propagation from a previously existing NDF, in a similar manner to the NDF routine NDF_PROP (see SUN/33).

The names of output NDFs given by users usually relate to the input NDF names. When NDG_CREAT is called, it creates a group of NDF names either by modifying all the names in a specified input group using a “modification element” (see SUN/150), or by getting a list of new names from the user.

(6)
Applications which produce a group of output NDFs could also produce a text file holding the names of the output NDFs. Such a file can be used as input to the next application, using the indirection facility. A text file listing of all the NDFs in a group can be produced by routine GRP_LIST (or GRP_LISTF).

See the detailed descriptions of NDG_ASSOC and NDG_CREAT below for details of the processing of existing and new NDF names.

1The routine NDG_ASEXP performs the same function but does not use the parameter system - it expects the group expression to be supplied by the calling routine.