Are you running your REXX on an z/OS system? If so you can generate unique numbers using the STCKE
STORE CLOCK EXTENDED
instruction which will be unique for thousands of years when generated on the same system or sysplex with synchronized clocks.
You'll need to crack open the assembler to write an external REXX function.
STCKE RSECT
STCKE AMODE 31
STCKE RMODE ANY
SAVE (14,12)
LR R12,R15
USING STCKE,R12
USING EFPL,R1 REXX external function parameter list
L R4,EFPLEVAL
L R4,0(R4) REXX evaluation block
USING EVALBLOCK,R4
STCKE EVALBLOCK_EVDATA Store STCKE in the function result area
MVC EVALBLOCK_EVLEN,=F'16' length of result (STCKE)
LA R15,0 RC=0
RETURN (14,12),RC=(15)
YREGS
IRXEFPL
IRXEVALB
END
And make sure you set numeric digits
in the REXX code as STCKF
is a 16 byte huge number!
/* REXX */
numeric digits 64
do 10
raw = stcke()
hex = c2x(raw)
num = x2d(hex)
say hex num
end