Input and Output Sets

To obtain the GDS input and output set and subsets, a task normally does not call the basic user input routines directly, but calls one or more routines from a collection of specialized routines. These routines interface to both the user interface routines and the GDS routines. Before they return a result to the calling task, a number of checks are done. Most user errors are handled internally by these routines.

There is example task code which illustrates the use of these routines.

Input Set and Subsets

The function GDSINP is used to obtain an input set and subsets, i.e. where the task gets its data from. It decodes the character string given by the user (e.g. SET=AURORA FREQ 1:10) and checks whether the set (in this case AURORA) exists. It also checks whether the subsets (in this case there are 10 subsets with defined coordinates along the FREQ axis) do exist. GDSINP also checks whether the dimension of the subsets is what the calling task expects. If GDSINP detects an error, it will inform the user and prompt again.
GDSINP can handle input for both class 1 and class 2 programs.

Relating Input and Output Set

Before the function to obtain the output set and subsets (GDSOUT) can be called, it is necessary to relate the input set to the output set. To facilitate this, GDSINP keeps the relevant coordinate information of the input set. The information stored is associated with the keyword used in GDSINP. If a task produces an output set, the coordinate system of the input set must be transferred correctly to the output set. Therefore GDSOUT needs to know where to copy the coordinate system from. This is done by assigning the internally stored coordinate information to an internal buffer for GDSOUT. This is done with subroutine GDSASN, which must be called before any of the other routines described below.

Modifying the size of the output subsets

If is is necessary to modify the size of the output subsets, subroutine GDSCSS can be called.

Changing the coordinate system

Subroutines GDSCPA and GDSCSA can be called to change the output set's coordinate system. Class 2 applications like mean use these routines to create an extra `PARAM' axis; class 1 applications like REPROJ use it to change the coordinate system of the subsets.

Changing the subset axis selection

Subroutine GDSCAS can be called to change the subset axis selection. This is done by tasks which are essentially class 2 but leave the names of the operation axes intact. VELSMO (velsmo.shl) is an example program which demonstrates this.

Output Set and Subsets

Function GDSOUT is used to obtain the output set and subsets, i.e. where the task will write its results. GDSOUT performs the same checks as GDSINP, except that if the specified output set does not exist it will create a new one. If it does exist, it checks whether the input subset does exactly fit in the already existing output set. If it does fit in, GDSOUT will ask the user permission to overwrite the old data.

For class 1 tasks GDSOUT checks whether the number of input subsets is equal to the number of output subsets. Independent of the class of the application, GDSOUT will assume the same subset dimensions as was input to the associated GDSINP call.

Programming GIPSY