next up previous
Next: Arrays of Values between Limits
Up: Extended Routines
Previous: Extended Routines

Scalar Values between Limits  

  A parameter value may be forced to lie within a range using a call to the generic routine PAR_GDR0x. The name is derived from Get with a Default and Range. For example,

          CALL PAR_GDR0R( 'SCALE', 1.0, 0.0, 2.0, .FALSE., SCAFAC, STATUS )

gets the value for the real parameter SCALE using a dynamic default of 1.0, stores the value in the variable SCAFAC, and ensures that the value lies in the range 0.0-2.0. If a supplied value is out of this range, PAR_GDR0R reports the acceptable limits and prompts the user for another value. (This applies to all the routines with constraints described in Section [*].) Thus the user would see something like the following.

    SCALE - Scale factor /1.0/ > 3.5
    !! SUBPAR: 3.5 is greater than the MAXIMUM value 2.
    SCALE - Scale factor /1.0/ >

The fifth argument (NULL) will normally be false. When it is true, it instructs the PAR routine to return the dynamic-default value whenever a null value is supplied, and then to annul the error status. If the MSG filtering level is set to `verbose', an informational message will be output.

In the above case if NULL were made .TRUE., and the user entered the null symbol whilst in `verbose' mode, the dialogue would be as follows:

    SCALE - Scale factor /1.0/ > !
    !! A value of 1 has been adopted for parameter SCALE.

NULL should only be set true when the dynamic default will always give reasonable behaviour in the application.

For all but the last example in Section [*], the null flag is set to .FALSE., and will not be mentioned again until then.

Swapping the limits lets you exclude values in the range. Therefore,

          CALL PAR_GDR0R( 'SCALE', 1.0, 2.0, 0.0, .FALSE., SCAFAC, STATUS )

would permit a value of 3.5, unlike before, as well as 0.0 and 2.0. However, 1.5 would not now be acceptable.

    SCALE - Scale factor > 1.5
    !! SUBPAR: 1.5 is in the excluded MIN/MAX range between 0 and 2.
    SCALE - Scale factor >

Notice that the suggested default has disappeared.[*] This occurred because 1.0 violates the range constraint, and it is a feature of the PAR_ extended routines. If you do not want a dynamic default, set the dynamic-default argument to a value that violates the constraints. The range-exclusion feature is present in all the PAR_ extended routines that have a range constraint.

Not surprisingly, there are only versions of the range-constraint routines for integer, real, or double-precision parameters. These have the usual I, R, and D suffices respectively. The range limits have the same data type as the value.



next up previous
Next: Arrays of Values between Limits
Up: Extended Routines
Previous: Extended Routines

PAR Interface to the ADAM Parameter System
Starlink User Note 114
Malcolm J. Currie
Alan J. Chipperfield
1999 September 24
E-mail:ussc@star.rl.ac.uk