UUID4

The UUID4 function returns a 36-character alphanumeric string that is a version 4 universally unique identifier(UUID).

The function type is alphanumeric.

Format

Read syntax diagramSkip visual syntax diagramFunction UUID4
Version 4 UUID is generated based on random numbers. It produces unique identifiers from separate applications without the coordination of a centralized agent or process. To maintain a high degree of randomness, the generation might take up processing time. The performance can be improved1 by leveraging the random number generation facility in the IBM Z® hardware when it is available.
Note:
  1. This performance improvement requires Message-Security-Assist Extension (MSA 7) that is supported in IBM z14® and higher architectures. The intrinsic function will automatically detect the availability of the facility and use it.

Example

The following COBOL program fragment produces output like 'UUID4: 4ed161b5-0d3c-4f06-8381-5f14678e13da', with subsequent executions producing different UUID values.

DISPLAY "UUID4: " FUNCTION UUID4