|
The only possibility I can think of is that the C code is expecting a null
terminated string. i.e. one ending in x'00'.
Add Options(*String) to the proto of the 70 char field and the pass
%TrimR(PW_BUFF) as the parm.
OK - I won't nag about free form declarations but MOVE ?
On May 22, 2020, at 5:34 AM, Patrik Schindler <poc@xxxxxxxxxx> wrote:PASE!), for easy generation of random characters. and calling the resulting
Hello,
I've ported https://github.com/tytso/pwgen to the CL environment (not
*PGM runs fine.
(binding) all (necessary) *MODULE objects from pwgen together with the
There's one function (pw_rand) I want to call from RPG, by linking
RPGLE module containing the mainline to one *PGM. I'm *not* talking about a
service program.
code, stating I want to create a 64 char password with the password flags
The C prototype is: void pw_rand(char *buf, int size, int pw_flags);
What I expect it to do: I pass a struct predetermined by the existing C
3. The password buffer is apparently preallocated by RPG (see debug output
below), since it's filled with *BLANKs. The function runs and places a
(most likely zero-teminated) string into the buffer: 64 bytes password, 1
byte '00'X. I made the buffer a bit larger to be on the safe side. I also
looked up proper field sizes in IBM documentation and that seems correct.
crashes with MCH 3601 (Pointer not set for location referenced.). I read
That's what I did in positional RPG:
DPW_BUF S 70A
DPW_SIZE S 10I 0
DPW_FLAGS S 10I 0
*
DPW_RAND PR EXTPROC('pw_rand')
D PW_BUF 70A
D PW_SIZE 10I 0 VALUE
D PW_FLAGS 10I 0 VALUE
*----------------
C MOVE 64 PW_SIZE
C MOVE 3 PW_FLAGS
C CALLP PW_RAND ( PW_BUF : PW_SIZE : PW_FLAGS )
( I hope, my MUA will not mess up with the formatting.)
Compiles and links fine, but when I try to run the call, the application
some articles in the net about it but I can't find out where or what I do
wrong.
'
Debug:
PW_BUF CHAR(70) '
VALUE IN HEX'40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
41'404040404040404040404040404040404040404040404040404040404040'X
PW_FLAGS ZONED(1,0) 3. 'F3'Xbecause I don't want to open yet another task on my already big stack.
PW_SIZE ZONED(2,0) 64. 'F6F4'X
Help greatly appreciated! Please refrain from "do it with RPG free",
(Learning free is on my list, for a later point in time.)
related questions.
:wq! PoC
PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
link: https://amazon.midrange.com
Help support midrange.com by shopping at amazon.com with our affiliate
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
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.