× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Scott,

Am 22.05.2020 um 20:53 schrieb Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>:

So what you're doing here is correct -- except that you will need to call %STR afterwards to remove the null from the result. For example:

Dresult s 64a varying
.
.
C MOVE 64 PW_SIZE
C MOVE 3 PW_FLAGS
C CALLP PW_RAND ( PW_BUF: PW_SIZE: PW_FLAGS: *null )
C
C eval result = %str(%addr(PW_BUF))


Thank you *very* much!

I need "result" to be a fixed length string, so I can MOVE it into a DSPF field defined as 64A in the DSPF itself. Until now, I did not learn about how to properly handle conversion of VARLEN (database) fields to fixed-length DSPF fields and vice versa. If this is making any difference at all, because the string is supposed to be strictly 64 characters long, all the time.

So, if I need to convert "result" again, is it possible to do it in one go, from PW_BUF directly to the destination field (ID)?

This result is consistent with the original problem of calling the routine but not providing the 4th parameter.

My older source definitely didn't have a fourth parameter.

When you leave the parameter off of the parameter list, the system uses whatever "by chance" happens to be in memory at that spot in the parameter list. So if it happens to be a valid null pointer, the program would work as expected. If it does not, it'd crash with MCH3601.

Sounds reasonable. So, a MCH3601 is somewhat comparable to a program catching a SIGSEGV in Unix, maybe?

You say that your version does not have this parameter, which seems unlikely to me as the 'pw_rand.c' source on GitHub was last changed on Aug 6, 2017. That's almost 3 years old.


Please see other mail to Jon. I'm not entirely sure where the source came from but it floated around on my 150 for quite a time. (I was trying to port it, had success and immediately afterwards had to learn that V4R5 does not offer a /dev/random file for acquiring entropy.)

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.