Just a point of reference. If the API declaration is only used inside
the procedure, you do not have to declare globally. You can just declare
locally.

d randPwd pr 10a

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* ... generate random password ... *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
p randPwd b
d pi 10a

d RandomApi...
d pr ExtProc('CEERAN0')
d 10u 0
d 8f
d 12 Options(*Omit)

d seed s 10u 0 Inz(0)
d floater s 8f
d fc s 12a
d pwd s 10a
d $I s 3s 0
d alpha s 26a Inz('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/free
For $I = 1 to 10;
RandomApi( seed: floater : fc );
%SubSt( pwd : $I : 1 ) =
%SubSt( alpha : %Int(floater * 26 + 1) : 1 );
EndFor;
Return pwd;
/end-free
p e


<snip>
d randPwd pr 10a
d random pr ExtProc('CEERAN0')
d 10u 0
d 8f
d 12 Options(*Omit)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* ... generate random password ... *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
p randPwd b
d pi 10a
d seed s 10u 0 Inz(0)
d floater s 8f
d fc s 12a
d pwd s 10a
d $I s 3s 0
d alpha s 26a Inz('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/free
For $I = 1 to 10;
random( seed: floater : fc );
%SubSt( pwd : $I : 1 ) =
%SubSt( alpha : %Int(floater * 26 + 1) : 1 );
EndFor;
Return pwd;
/end-free
p randPwd e
</snip>

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.