|
On Oct 22, 2025, at 9:33 PM, smith5646midrange@xxxxxxxxx wrote:
I need some help with some RPGLE EIM programming. The code is below. When
I run this the first dsply displays 0 and the RtvErr displays Succcess. The
second dsply displays 3021 but the RtvErr displays Success. The docs say
that rtcd should be 0 for success so that means the eimConnect failed but
the error message is Success. That doesn't make sense to me. Also, when I
run a C version of this program with the same values (at least I think they
have the same values), eimConnect does return a 0. I am horrible at C so I
was trying to write it in RPGLE. I have not gone any further with my code
to see if the eimConnect really was successful and it just has a screwy
rtcd.
Does anybody have any experience with EIM coding and would you be willing to
help me out?
ctl-opt
dftactgrp(*no);
dcl-pr eimCreateHandle int(10) extproc('eimCreateHandle');
handle likeds(EIMANDLE);
connectInfo pointer value;
eimrc like(eimrc);
end-pr;
dcl-pr eimConnect int(10) extproc('eimConnect');
handle likeds(EIMANDLE);
connectInfo likeds(eimci);
eimrc like(eimrc);
end-pr;
dcl-s rtcd int(10);
dcl-ds handle likeds(EIMANDLE);
dcl-s bindDn char(80) inz('cn=administrator');
dcl-s bindPw char(80) inz('myPassword');
dcl-c null x'00';
dcl-s errMsg@ pointer;
dcl-s errMsg char(256) based(errMsg@);
dcl-s rtnMsg char(52);
dcl-pr eimErr2String pointer extproc('eimErr2String');
eimrc like(eimrc);
end-pr;
/include qsysinc/qrpglesrc,eim
eimmpbc = %size(eimrc);
rtcd = eimCreateHandle(handle
:*null
:eimrc);
dsply rtcd; <== rtcd = 0
RtvErr(); <== RtvErr displays Success
bindDn = %trim(bindDn) + null;
bindPw = %trim(bindPw) + null;
eimtype = *zero;
eimotect00 = *zero;
eimotect = *zero;
eimbd00 = %addr(bindDn);
eimbp00 = %addr(bindPw);
rtcd = eimConnect(handle:eimci:eimrc);
dsply rtcd; <== rtcd = 3021
RtvErr(); <== RtvErr displays Success
*inlr = *on;
/////////////////////////////////////////////////////////////////////////
dcl-proc RtvErr;
errmsg@ = eimErr2String(eimrc);
RtnMsg = %str(errMsg@:%size(errMsg));
dsply rtnmsg;
end-proc;
--
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.