Prototyping C in RPG

5 pts.
Tags:
RPG RPGLE RPGfree
Hello; So the people above my head ask me work on this project, something I never work with/on, never did anything with C or much with pointers on AS400/RPG Trying to create RPG program to mimic C on AS400 to call API for tax software, so looking for any help that anyone might have: Here is the C prototype: PREFIX tVstConnHdl POSTFIX VstCreateConnHdl (void);                                                                                 typedef tVstConnHdl (POSTFIX *tVstCreateConnHdl) (void);                                                                            /* Establish a connection to a specified Quantum database. */     PREFIX tVstDbRetCd POSTFIX VstOpenDb (tVstConnHdl     pConnHdl,                                         tVstDbType      pDbType,                                          char           *pDataSource,                                       char           *pServerName,                                            char           *pUserID,                                                char           *pPwd,                                                   tVstAccessMode  pAccessMode,                                            char           *pRetCode,                                               char           *pRetCodeDetail);  So now I'm trying to recreate this in RPG and call these 2 function to Create Handle and Open DB connection - but not understanding this too much Here is what I got so far in RPG: (keep in mind that never done that and just put something to be able to compile it) ******************************************************************************* D NULL            C                    CONST(x'00')                                                                                                           d lConHnd         s               *                                            D T1_ConnHnd      pr              *   extproc(*cwiden:'VstCreateConnHdl')                                                                                     d T2_OpenDB       PR              *   extproc(*cwiden:'VstOpenDb')             d  ConnHnd                            like(lconhnd)                            d  DBtype                       20u 0                                          d  Data_src                       *   Value Options(*STRING)                   d  Server_name                    *   Value Options(*STRING)                   d  User_ID                        *   Value Options(*STRING)                   d  Password                       *   Value Options(*STRING)                   d  AccessMod                    20u 0                                          d  Ret_Code                       *   VALUE OPTIONS(*STRING)                   D  Ret_CodeDet                    *   value options(*String)                   d parm1           s             20u 0                 d parm2           s             20u 0                 d parm3           s               *                   d parm4           s               *                   d parm5           s               *                   d parm6           s               *                   d parm7           s             20u 0                 d parm8           s               *                   d parm9           s               *                                                                         d var3            s              6a   Inz('VERERQ')   d var4            s             10a   Inz('I5SAP')    d var5            s             10a   Inz(null)       d var6            s             10a   Inz(null)       d var8            s             10a   Inz(null)       d var9            s             10a   Inz(null)                                                              /free                                                     lconhnd = T1_ConnHnd();                               parm3 = %addr(var3);        parm4 = %addr(var4);        parm5 = %addr(var5);        parm6 = %addr(var6);        parm8 = %addr(var8);        parm9 = %addr(var9);                                    T2_OpenDb(lconhnd:                    Parm2:                      parm3:                      parm4:                      parm5:                      parm6:                      Parm7:                      Parm8:                      parm9);                                     *InLR = *On;                Return;                   /end-free                                                                                no some of the parm's (2 & 7) I just made it unsigned long  just to make it work... anyways the first call to create the handle I guess is working since its not blowing up on it, its on the second one since I can't figure out what to do or how to define parm 2 & 7                                                                     
ASKED: February 25, 2010  5:32 PM
UPDATED: October 1, 2011  1:19 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Both tVstDbType and tVstAccessMode will have a typedef somewhere. Without seeing that, there is no way to know how RPG should define them. Different platforms may have different definitions. A typedef is made available for the C compiler so it knows how to compile that 'type' of data on the current system. It might be that one or both of those will be a data structure. In RPG, an equivalent DS would be defined and probably populated with data before calling the T2_OpenDb() procedure. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following