Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

HASH-VALUE( ) Encrypt expression as integer value

&pagelevel(3)&pagelevel

Domain: Conversion functions

The HASH-VALUE( ) function converts a string expression to an integer value; the algorithm which is used to do this has a high probability of returning different output values for different input strings.

Format

HASH-VALUE( )

STRING = string_expression

Result type

INTEGER (<integer -231..231-1>)

Input parameters

STRING = string_expression_1..256
Designates the input string.

Result

Integer

Error message

SDP0455  INVALID LENGTH OF INPUT STRING (ALLOWED : 1..256)

Example

/RANDOM = HASH-VALUE(TIME( )) MOD 60           "BETWEEN 0 AND 59"
/HOUR = INTEGER(SUBSTRING(TIME(),START=1,LENGTH=2))
/MINUTE = INTEGER(SUBSTRING(TIME( ),START=4,LENGTH=2))
/MINUTE = MINUTE + RANDOM
/IF (MINUTE > 59)
/      MINUTE = MINUTE - 60
/      HOUR = HOUR + 1
/       IF (HOUR > 23)
/             HOUR = 0
/       END-IF
/END-IF
/WRITE-TEXT 'In &RANDOM. minute(s) it will be
    &HOUR.:&(FILL(STRING=STRING(MINUTE),LENGTH=2,SIDE=*LEFT,FILL-BYTE='0'))'
In 32 minute(s) it will be    10:00