random value

5 pts.
Tags:
Random Number Generator
RPG
RPG/400
i would like to apply a random value into a RPG/400 or RPG/II.But I can't find how to do it in official guide. Is there any expert to help me?
ASKED: July 2, 2008  4:03 AM
UPDATED: May 3, 2010  5:40 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

Back in the days of RPG2 on the S/36 we used to use the seconds as a basis for a (kind of) random number. I found a link on google for this :-

<a href=”http://www-1.ibm.com/support/docview.wss?uid=nas1f23d225573c211a186256a240067a3da”>Generating Random Numbers in ILE RPG</a>

Hope this helps.

Regards,

Martin Gilbert.

================================================================

There is no information in the official guide because no ‘random’ function exists for RPG/400 or RPG II. You will need to write a program to create a ‘random’ number. You might call a REXX procedure to use its RANDOM function.

If you use RPG IV, though, (or almost any ILE language including ILE CL), you could simply call the C rand() API.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following