### 3 General overview of the CTG_ system

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

(1)
A call is made to CTG_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 catalogues to be used as inputs by the application For instance, the group expression may be
coma_b[1-3].fits,coma_r[45]s.txt,coma_b[23]?{2}.fit,^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 CTG packages, e.g. wild cards (“?”, “$\ast$” or “[..]” ), lists of files, or indirection through a text file (“^”). The braces indicate the second FITS extension.

The CTG_ASSOC routine produces a list of explicit catalogue 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 catalogues (CTG_ASSOC returns the total number of catalogue names in the group).
(3)
To access a particular catalogue, the application calls routine CTG_CATAS supplying an index, $n$, within the group (i.e $n$ is an integer in the range 1 to the group size returned by CTG_ASSOC). CTG_CATAS returns a CAT identifier to the $n$th catalogue in the group. This identifier can then be used to access the catalogue in the normal manner using the CAT_ routines (SUN/181). The identifier should be released when it is no longer needed, and freeing resoures using CAT_TRLSE in the normal way.
(4)
Once the application has finished processing the group of catalogues, it calls GRP_DELET which deletes the group, releasing all resources reserved by the group.
(5)
Routine CTG_ASSOC can also be used to append a list of catalogue names obtained from the environment, to a previously defined group.

The routine CTG_CREAT produces a group containing the names of catalogues that are to be created by the application. The routine CTG_CATCR will create a new catalogue with a name given by a group member, and returns a CAT identifier to it.

The names of output catalogues given by users usually relate to the input catalogue names. When CTG_CREAT is called, it creates a group of catalogue 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 catalogues could also produce a text file holding the names of the output catalogues. Such a file can be used as input to the next application, using the indirection facility. A text file listing of all the catalogues in a group can be produced by routine GRP_LIST (or GRP_LISTF).

See the detailed descriptions of CTG_ASSOC and CTG_CREAT below for details of the processing of existing and new catalogue names.