USAGE

Using the USAGE option, you can choose different semantics for selected built-in functions.

Read syntax diagramSkip visual syntax diagram
             .-+---+--------------------------.      
             | '-,-'                          |      
             V           .-SIZE--------.      |      
>>-USAGE--(----+-HEX--(--+-CURRENTSIZE-+--)-+-+--)-------------><
               |           .-RESET---.      |        
               +-REGEX--(--+-NORESET-+--)---+        
               |           .-IBM-.          |        
               +-ROUND--(--+-ANS-+--)-------+        
               |            .-STRICT-.      |        
               +-SUBSTR--(--+-LOOSE--+--)---+        
               |            .-IBM-.         |        
               '-UNSPEC--(--+-ANS-+--)------'        

HEX( SIZE | CURRENTSIZE )
Under the HEX(SIZE) suboption, when HEX is applied to a VARYING or VARYINGZ string, it will a return a hex string that represents the maximum amount of storage used by the string.

Under the HEX(CURRENTSIZE) suboption, when HEX is applied to a VARYING or VARYINGZ string, it will a return a hex string that represents the current amount of storage used by the string.

Start of changeREGEX( RESET | NORESET )End of change
Start of changeUnder the REGEX (RESET) suboption, with each invocation of the REGEX built-in function, if the codepage argument to the REGEX function is different than the codepage corresponding to the current locale, then that locale value will be saved and restored before exiting the REGEX function. It can cause a significant drop in performance if the REGEX function is invoked repeatedly with a codepage that does not correspond to the current locale.

Under the REGEX (NORESET) suboption, if the locale needs to be changed to match the codepage argument, then the local value will not be saved and restored. It can be much better for performance, but it also means that if you have other code that depends on that original locale setting, then that code might not work as expected.

End of change
ROUND( IBM | ANS )
Under the ROUND(IBM) suboption, the second argument to the ROUND built-in function is ignored if the first argument has the FLOAT attribute.

Under the ROUND(ANS) suboption, the ROUND built-in function is implemented as described in the PL/I Language Reference.

SUBSTR( STRICT | LOOSE )
Under the SUBSTR(STRICT) suboption, if x has CHARACTER type, you are giving the compiler permission to assign a length of MIN( z, MAXLENGTH(x) ) or a length of z to a SUBSTR(x,y,z) built-in function reference.

Under the SUBSTR(LOOSE) suboption, the same reference will return a string whose length is z.

The SUBSTR(LOOSE) suboption might be useful for those who have SUBSTR(x,y,z) references where x is a CHAR(1) BASED variable.

If STRINGRANGE is enabled, then under either setting of this option, STRINGRANGE will be raised when z > MAXLENGTH(x).

UNSPEC( IBM | ANS )
Under the UNSPEC(IBM) suboption, UNSPEC cannot be applied to a structure, and if applied to an array, returns an array of bit strings.

Under the UNSPEC(ANS) suboption, UNSPEC can be applied to structures, and when applied to a structure or an array, UNSPEC returns a single bit string.

Default: USAGE( HEX(SIZE) Start of changeREGEX(RESET)End of change ROUND(IBM) SUBSTR(STRICT) UNSPEC(IBM) )






Published: 23 December 2018