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 lpara = NumRu::DCL.glpget(cp)

      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 NumRu::DCL.glpset(cp,rpara)

      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

lpara = NumRu::DCL.glpget(cp)

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.