|
I am able to solve my issue by inserting an integer value in the Rand
function.
I converted the current time into a 10I 0 field, then executed.
CurrentTime = %Dec(%Time():*ISO);
Exec SQL Select Dec(Rand(:CurrentTime)*10000000000,10,0)
Into :RandomNumber
From SYSIBM/SYSDUMMY1;
But I question why....????
Michael Schutte/Bob Evans wrote on 05/05/2008 10:53:34 AM:
I know that there's been a big discussion about this before... but I
have an issue that I couldn't find in the archives.
If I run this statement interactively (in STRSQL). I get a
different value everytime...
select dec((rand()* 10000000000),10,0) from sysibm/sysdummy1
But when I put it in the SQLRPGLE program (which so happens to be a
DEV2 web program), I get the same value.
select dec((rand()* 10000000000),10,0) into :RandomNumber from
sysibm/sysdummy1
RandomNumber always equals 5138706625
If I put a number in the Rand Function, Rand(somenumber). I get a
different value than above but it doesn't change on repeated calls.
The activation group is *NEW and the Rand function is non-
deterministic. So I don't follow why I'm getting the same value.
I've even tried doing Values(...) into :RandomNumber;
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.