3 General overview of the CTG_ system
As a broad outline, applications use the CTG_ package as follows:
- 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
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 (“
[..]” ), lists of files, or indirection through a text file (“
”). The braces indicate the second
The CTG_ASSOC routine produces a list of explicit catalogue names, which are stored internally
within the GRP system.
- 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).
- To access a particular catalogue, the application calls routine CTG_CATAS supplying an index,
, within the
group (i.e is
an integer in the range 1 to the group size returned by CTG_ASSOC). CTG_CATAS returns a CAT identifier
to the 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
- 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.
- 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.
- 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.
Copyright © 2009 Science and Technology Facilities Council.