1.5.4 Structure of GLpGET/GLpSET

The GLpGET/GLpSET of the SYSLIB, the "bulletin board of parameters" of DCL, is a library that has used to the fullest extent the previously introduced technique of hiding parameters that do not have to be specified each time. The GLpGET/GLpSET only hands over parameters to other programs, and does nothing else. It has the following structure (it is simplified from the actual source). 

(Note: In the DCL ver. 5, it is possible to intervene on internal variables using runtime parameters, so internally, the GLpGET/GLpSET calls a subroutine. The following explanation uses the of the DCL ver. 4. The structure of the subroutines for ver. 5 is basically the same as the GLpGET/GLpSET of ver. 4.) 

*-----------------------------------------------

*     GLPGET / GLPSET

*-----------------------------------------------

      SUBROUTINE GLPGET(CP,IPARA)

      CHARACTER CP*(*)

      PARAMETER (NPARA=17)

      INTEGER   IX(NPARA)

      REAL      RX(NPARA)

      LOGICAL   LX(NPARA)

      CHARACTER CPARA(NPARA)*8

      EQUIVALENCE (IX,RX,LX)

      SAVE

      DATA CPARA( 1)/'NBITSPW '/, IX( 1)/32/

      ........ 

      DATA CPARA(12)/'LMISS   '/, LX(12)/.FALSE./

      DATA CPARA(13)/'IMISS   '/, IX(13)/999/

      DATA CPARA(14)/'RMISS   '/, RX(14)/999.0/

      ........

      DO 10 N=1,NPARA

        IF (CP.EQ.CPARA(N)) THEN

          IPARA=IX(N)

          RETURN

        END IF

   10 CONTINUE

      Error handling

      STOP

*-----------------------------------------------

      ENTRY GLPSET(CP,IPARA)

      DO 15 N=1,NPARA

        IF (CP.EQ.CPARA(N)) THEN

          IX(N)=IPARA

          RETURN

        END IF

   15 CONTINUE

      Error handling

      STOP

      END

      

Here, a parameter name is registered to the character variable CPARA, and values corresponding to the parameter name are assigned to the variables IX, RX, LX . (These 3 variables are coupled by the EQUIVALENCE statement, so they actually occupy only a single memory area.)

The function IMAX of IFALIB is used to find the maximum value excluding the missing value. IMAX acquires the integer value representing the missing value from the argument, and in turn, executes the statement

CALL GLPGET('IMISS', IMISS)

Then, the  GLPGET searches for the name 'IMISS' from CPARA (lines 24-29), and returns the value corresponding to the name as the IMISS value. The returned value is specified by the DATA statement, but when necessary, this value can be  changed in advance by GLISET.

The reason why this method is better compared to the method introduced in the previous Section 1.5.3 (where each program has its own ENTRY statement for setting IMISS ) is because the information held by GLPGET can be inquired from multiple subroutines. For example, the initial value of all missing values is given as 999, but in the case where 999 falls within the range of possible data, this value must be changed. With this method, the GLPSET  only has to be called once to control the operation of all subroutines that handles missing values.