EIM calls in RPGLE not working as expected

[email protected]
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
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: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.