- How to declare a constant value in PICK/UniVerse database?
- How to pass an argument to a function by constant reference?
There is some information in the IBM's manual for UniVerse database about constants, but nothing in particular.
Please note that:
DEFINE statement value
is not what i'm looking for because it substitutes the statement with value at compile time and doesn't provide real constness of the value.
Does anyone know how to declare those?
Thanks.
It is the same statement as in UniData (UniVerse's sister database; both are collectively referred to as U2), which is:
EQU
andEQUATE
For example:
EQU statement TO value
I'm not entirely sure what you mean by point 2, but I'll give it a dig. By default, all parameters are 'pass by reference', but there is no form of const argument. It will still allow you to change the parameter value internally in the function/subroutine, but the results will not affect the values of the equates back in the calling program/function/subroutine.
Side note: If you want to ensure a subroutine/function does not change the value of an actual variable you pass (pass by value), you can either assign it to a temp variable and pass that, or surround it with parenthesis
For example:
CALL MySub(PassByRef, (PassByValue))
what the
()
does is create an temporary copy ofPassByValue
then pass the temp copy by reference. This stops the changes propagating back intoPassByValue