Using SQLRPGLE to return array of SELECT results

Discussion in 'RPG' started by Chuk, Apr 24, 2015.

  1. Chuk

    Chuk Software Developer

    I don't really know my way around RPG, but this is my attempt at returning an array of results from an SQL SELECT statement:

    Code (Text):
    H Debug DatEdit(*MDY/) Option(*SrcStmt:*noDebugIO) Extbinint(*yes)
                                                                     
    D ary             DS                  qualified based(Template)  
    D  id                           10i 0                            
    D  name                         50                              
    D  address                      75                              
                                                                     
    D index           S              5i 0 inz(0)                    
                                                                     
    D id              S             10i 0                            
    D name            S             50                              
    D address         S             75                              
                                                                     
    D errcd           S             10i 0                            
    D errmsg          S             70                              
                                                                     
    D aryout          DS                  likeds(ary) dim(99999)      
                                                                     
    C     *entry        plist                                        
    C                   parm                    aryout                
    C                   parm                    errcd                
    C                   parm                    errmsg                
                                                                     
    /free                                                            
      exec sql declare @c1 cursor for                                
        select id, name, address from testlib/customers for fetch only;
                                                                     
      exec sql                                                        
      open @c1;                                                      
                                                                     
      index = 0;                                                      
                                                                     
    DoW index < 9999;                                          
                                                               
         exec sql                                              
         fetch @c1 into :id, :name, :address;                  
                                                               
         if SQLSTT <> '00000';                                  
             leave;                                            
         endif;                                                
                                                               
         index += 1;                                            
                                                               
         aryout(index).id = id;                                
         aryout(index).name = name;                            
         aryout(index).address = address;                      
                                                               
    EndDo;                                                    
                                               
    exec sql                                  
    close @c1;                                
                                               
    if SQLCod <> 0;                          
       errcd = sqlcode;                        
       errmsg = sqlerrmc;                      
    endif;                                    
                                               
    *inlr = *on;                              
    Return;                                    
    I'm getting a "Pointer or parameter" error at the aryout(index).id = id; line. That leads me to think my syntax is wrong. Does it look okay? When I debug id is equal to 8 and index is equal to 1.
     
  2. Alan

    Alan Administrator Staff Member

  3. Chuk

    Chuk Software Developer

    Still troubleshooting. Thats for a reminder about the D-Spec Tool. Currently parameters are being passed to the CL program. I'm now not capping the workload? Here's my toolkit call and the debug log:

    PHP:

    public function fetchAll($params = array())
    {
        $row_t[] = $this->toolkit->AddParameterInt32("both","id","id",0);
        $row_t[] = $this->toolkit->AddParameterChar("both",50,"name","name","");
        $row_t[] = $this->toolkit->AddParameterChar("both",75,"address","address","");
        $param[] = $this->toolkit->AddDataStruct($row_t,"row");

        $param[] = $this->toolkit->AddParameterPackDec("both",5,0,"index","index",0.0); // index (S)
        $param[] = $this->toolkit->AddParameterInt32("both","id","id",0); // id (S)
        $param[] = $this->toolkit->AddParameterChar("both",50,"name","name",""); // name (S)
        $param[] = $this->toolkit->AddParameterChar("both",75,"address","address",""); // address (S)
        $param[] = $this->toolkit->AddParameterInt32("both","errcd","errcd",0); // errcd (S)
        $param[] = $this->toolkit->AddParameterChar("both",70,"errmsg","errmsg",""); // errmsg (S)

        $aryout = [];
        $param[] = $this->toolkit->AddDataStruct($aryout,"aryout",9999);

        $result = $this->toolkit->PgmCall('CUSTFCHAC', 'TESTLIB', $param, null, null);
        var_dump($result);

        if ($result['errorCode'] !== 200)
        {
            return $this->createErrorResponse($result['errorCode']);
        }

        $response = $result['result'];

        return $response;
    }
     
  4. Chuk

    Chuk Software Developer

    Code (Text):

    Exec start: 2015-04-27 11:04:55
    Version of toolkit front end: 1.5.0
    IPC: ''. Control key: *cdata *here
    Stmt: call ZENDSVR6/iPLUG15M(?,?,?,?) with transport: ibm_db2
    Input XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
    <script>
    <pgm name='CUSTFCHAC' lib='TESTLIB'>
    <parm comment=''><ds var='row'>
    <data var='id' type='10i0'>0</data><data var='name' type='50A' /><data var='address' type='75A' /></ds>
    </parm>
    <parm comment='index'><data var='index' type='5p0'>0</data></parm>
    <parm comment='id'><data var='id' type='10i0'>0</data></parm>
    <parm comment='name'><data var='name' type='50A' /></parm>
    <parm comment='address'><data var='address' type='75A' /></parm>
    <parm comment='errcd'><data var='errcd' type='10i0'>0</data></parm>
    <parm comment='errmsg'><data var='errmsg' type='70A' /></parm>
    <parm comment=''>

    <ds var='aryout' comment='Multi-occur container' array='on'>
    <ds dim='9999'>
    </ds>

    </ds></parm>
    </pgm>
    </script>
    Output XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
    <report>
    <version>XML Toolkit 1.8.3</version>
    <error>
    <errnoile>3025</errnoile>
    <errnoilemsg><![CDATA[No such path or directory.]]></errnoilemsg>
    <errnoxml>1100004</errnoxml>
    <xmlerrmsg><![CDATA[XML run loop failed]]></xmlerrmsg>
    <xmlhint><![CDATA[p(54) <pgm name='CUSTFCHAC' lib='TESTLIB']]></xmlhint>
    </error>
    <error>
    <errnoile>3025</errnoile>
    <errnoilemsg><![CDATA[No such path or directory.]]></errnoilemsg>
    <errnoxml>1000006</errnoxml>
    <xmlerrmsg><![CDATA[PGMCALL failed]]></xmlerrmsg>
    <xmlhint><![CDATA[CUSTFCHAC]]></xmlhint>
    </error>
    <error>
    <errnoile>3025</errnoile>
    <errnoilemsg><![CDATA[No such path or directory.]]></errnoilemsg>
    <errnoxml>1100016</errnoxml>
    <xmlerrmsg><![CDATA[XML run pgm failed]]></xmlerrmsg>
    <xmlhint><![CDATA[<pgm name='CUSTFCHAC' lib='TESTLIB'>
    <parm comment=''><ds v]]></xmlhint>
    </error>
    <error>
    <errnoile>3025</errnoile>
    <errnoilemsg><![CDATA[No such path or directory.]]></errnoilemsg>
    <errnoxml>1100004</errnoxml>
    <xmlerrmsg><![CDATA[XML run loop failed]]></xmlerrmsg>
    <xmlhint><![CDATA[p(54) <pgm name='CUSTFCHAC' lib='TESTLIB']]></xmlhint>
    </error>
    <xmloutput><![CDATA[<?xml version="1.0" encoding="ISO-8859-1" ?>
    <script>
    <pgm name='CUSTFCHAC' lib='TESTLIB'>
    </pgm>
    ]]></xmloutput>
    <jobinfo>
    <jobipc></jobipc>
    <jobipcskey>FFFFFFFF</jobipcskey>
    <jobname>QSQSRVR</jobname>
    <jobuser>QUSER</jobuser>
    <jobnbr>546141</jobnbr>
    <jobsts>*ACTIVE</jobsts>
    <curuser>ADAM</curuser>
    <ccsid>37</ccsid>
    <dftccsid>37</dftccsid>
    <paseccsid>0</paseccsid>
    <langid>ENU</langid>
    <cntryid>US</cntryid>
    <sbsname>QSYSWRK</sbsname>
    <sbslib>QSYS</sbslib>
    <curlib>TESTLIB</curlib>
    <syslibl>QSYS QSYS2 QHLPSYS QUSRSYS</syslibl>
    <usrlibl>TESTLIB</usrlibl>
    <jobcpffind>see log scan, not error list</jobcpffind>
    </jobinfo>
    <joblogscan>
    <joblogrec>
    <jobcpf>CPF1124</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[Job 546141/QUSER/QSQSRVR started on 04/27/15 at 10:51:03]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CPF102A</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM Workload capping group *NONE not found.]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>*NONE</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM QSQSRVR QSQSRVR 7977 QSQSRVR QSQSRVR 7977 User Profile = ADAM]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CPF9898</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM QSQSRVR QSQSRVR 8069 QSQSRVR QSQSRVR 8069 SERVER MODE CONNECTING JOB IS 532550/QTMHHTTP/ZENDSVR6.]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CPF9872</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM CUSTFCHAC CUSTFCHAC 1100 Program or service program QCLRTNE in library QSYS ended.]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CPF9999</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM CUSTFCHAC CUSTFCHAC 1100 Function check. CPF9872 unmonitored by CUSTFCHAC at An escape exception message was sent to a prog]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>MCH2603</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM CUSTFCHAC QCL_Function_Check_Exception_Handler *N Invalid unlock request 1 requests not unlocked for one of the following r]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CEE3201</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM QLEDEH Q LE leDefaultEh 73 CUSTFCHAC QCL_Function_Check_Exception_Handler *N Exception recursion detected.]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CEE9901</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM QLETOOL Q LE AWIRaise 178 QP2API runpase_common__FiPvT2 2 Application error.  *N unmonitored by *N at statement *N,]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>MCH3601</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM RmslUnlockSpaceLoc Pointer not set for location referenced.]]></jobtext>
    </joblogrec>
    <joblogrec>
    <jobcpf>CPF9999</jobcpf>
    <jobtime><![CDATA[04/27/15  11:04:55.418102]]></jobtime>
    <jobtext><![CDATA[ADAM Function check. MCH3601 unmonitored by QCLCLNUP at An escape exception message was sent to a program which See the low leve]]></jobtext>
    </joblogrec>
    </joblogscan>
    <joblog job='QSQSRVR' user='QUSER' nbr='546141'>
     
    ...
     
  5. Chuk

    Chuk Software Developer

    Code (Text):

    <![CDATA[5761SS1 V6R1M0 080215                        Display Job Log                        SABEL    04/27/15 11:04:55          Page    1
      Job name . . . . . . . . . . :   QSQSRVR         User  . . . . . . :   QUSER        Number . . . . . . . . . . . :   546141
      Job description  . . . . . . :   QDFTSVR         Library . . . . . :   QGPL
    MSGID      TYPE                    SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY     INST
    CPF1124    Information             00   04/27/15  10:51:03.541709  QWTPIIPP     QSYS        04C0     *EXT                    *N
                                         Message . . . . :   Job 546141/QUSER/QSQSRVR started on 04/27/15 at 10:51:03
                                           in subsystem QSYSWRK in QSYS. Job entered system on 04/27/15 at 10:51:03.
    CPF102A    Diagnostic              40   04/27/15  11:04:14.370823  QWTCHGJB     QSYS        2E69     QWCJOBSR    QSYS        0836
                                         From user . . . . . . . . . :   ADAM
                                         Message . . . . :   Workload capping group *NONE not found.
                                         Recovery  . . . :   Correct the workload capping group name (WLCGRP
                                           parameter).  Then try the request again.
    *NONE      Completion                   04/27/15  11:04:55.256729  QSQSRVR      QSYS        *STMT    QSQSRVR     QSYS        *STMT
                                         From user . . . . . . . . . :   ADAM
                                         From module . . . . . . . . :   QSQSRVR
                                         From procedure  . . . . . . :   QSQSRVR
                                         Statement . . . . . . . . . :   7977
                                         To module . . . . . . . . . :   QSQSRVR
                                         To procedure  . . . . . . . :   QSQSRVR
                                         Statement . . . . . . . . . :   7977
                                         Message . . . . :   User Profile = ADAM
    CPF9898    Completion              40   04/27/15  11:04:55.256864  QSQSRVR      QSYS        *STMT    QSQSRVR     QSYS        *STMT
                                         From user . . . . . . . . . :   ADAM
                                         From module . . . . . . . . :   QSQSRVR
                                         From procedure  . . . . . . :   QSQSRVR
                                         Statement . . . . . . . . . :   8069
                                         To module . . . . . . . . . :   QSQSRVR
                                         To procedure  . . . . . . . :   QSQSRVR
                                         Statement . . . . . . . . . :   8069
                                         Message . . . . :   SERVER MODE CONNECTING JOB IS 532550/QTMHHTTP/ZENDSVR6.
                                         Cause . . . . . :   This message is used by application programs as a general
                                           escape message.
    CPC2198    Completion              00   04/27/15  11:04:55.267839  QLICHLIB     QSYS        00B8     QSQRUN4     QSYS        *STMT
                                         From user . . . . . . . . . :   ADAM
                                         To module . . . . . . . . . :   QSQCALLSP
                                         To procedure  . . . . . . . :   CALLPROGRAM
                                         Statement . . . . . . . . . :   31780
                                         Message . . . . :   Current library changed to TESTLIB.
                                         Cause . . . . . :   The current library in the library list was changed to
                                           TESTLIB.
    CPC2101    Completion              00   04/27/15  11:04:55.267850  QLICHLIB     QSYS        00CF     QSQRUN4     QSYS        *STMT
                                         From user . . . . . . . . . :   ADAM
                                         To module . . . . . . . . . :   QSQCALLSP
                                         To procedure  . . . . . . . :   CALLPROGRAM
                                         Statement . . . . . . . . . :   31780
                                         Message . . . . :   Library list changed.
                                         Cause . . . . . :   The user library list was replaced by the specified list
                                           of libraries.
    CPF9872    Escape                  40   04/27/15  11:04:55.414528  QSYSMPVE     QSYS        0012     CUSTFCHAC   TESTLIB     *STMT
                                         From user . . . . . . . . . :   ADAM
                                         To module . . . . . . . . . :   CUSTFCHAC
                                         To procedure  . . . . . . . :   CUSTFCHAC
                                         Statement . . . . . . . . . :   1100
                                         Message . . . . :   Program or service program QCLRTNE in library QSYS ended.
                                           Reason code 2.
                                         Cause . . . . . :   The specified program or service program was ended due to
     
     
  6. Chuk

    Chuk Software Developer

    Code (Text):

    5761SS1 V6R1M0 080215                        Display Job Log                        SABEL    04/27/15 11:04:55          Page    2
      Job name . . . . . . . . . . :   QSQSRVR         User  . . . . . . :   QUSER        Number . . . . . . . . . . . :   546141
      Job description  . . . . . . :   QDFTSVR         Library . . . . . :   QGPL
    MSGID      TYPE                    SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY     INST
                                           one of the following: 1 -- A pointer was used that is not available for use
                                           while running in the current program state. 2 -- A pointer was used, either
                                           directly or as a basing pointer, that has not been set to an address. 3 -- A
                                           pointer type was not valid for the requested operation. 4 -- An error was
                                           found while checking parameter structure. 5 -- The caller is not allowed to
                                           use this interface. Recovery  . . . :   Correct the parameter list passed to
                                           the program or service program and try the request again. If the reason code
                                           is 5, you will need to use a different interface.
    CPF9999    Escape                  40   04/27/15  11:04:55.414644  QMHUNMSG                 *N       CUSTFCHAC   TESTLIB     *STMT
                                         From user . . . . . . . . . :   ADAM
                                         To module . . . . . . . . . :   CUSTFCHAC
                                         To procedure  . . . . . . . :   CUSTFCHAC
                                         Statement . . . . . . . . . :   1100
                                         Message . . . . :   Function check. CPF9872 unmonitored by CUSTFCHAC at
                                           statement 0000001100, instruction X'0000'.
                                         Cause . . . . . :   An escape exception message was sent to a program which
                                           did not monitor for that message. The full name of the program to which the
                                           unmonitored message was sent is CUSTFCHAC CUSTFCHAC CUSTFCHAC. At the time
                                           the message was sent the program was stopped at higher level language
                                           statement number(s) 0000001100. If more than one statement number is shown,
                                           the program was a bound program. Optimization does not allow a single
                                           statement number to be determined. If *N is shown as a value, it means the
                                           actual value was not available. Recovery  . . . :   See the low level
                                           messages previously listed to locate the cause of the function check.
                                           Correct any errors, and then try the request again.
    MCH2603    Escape                  40   04/27/15  11:04:55.414743  ExSndPm                  000000   CUSTFCHAC   TESTLIB     *STMT
                                         From user . . . . . . . . . :   ADAM
                                         To module . . . . . . . . . :   CUSTFCHAC
                                         To procedure  . . . . . . . :   QCL_Function_Check_Exception_Handler
                                         Statement . . . . . . . . . :   *N
                                         Message . . . . :   Invalid unlock request
                                         Cause . . . . . :   1 requests not unlocked for one of the following reasons:
                                           The locks were not held by the current process (for process-scoped locks) or
                                           by the current thread (for thread-scoped locks). An attempt was made to
                                           unlock a lock state not held by the transaction control structure attached
                                           to the current thread. An attempt was made to unlock a teraspace storage
                                           location that is not mapped or allocated. An attempt was made to unlock a
                                           teraspace storage location lock not held by the current requesting thread.
    CEE3201    Diagnostic              10   04/27/15  11:04:55.414901  QLEAWI       QSYS        *STMT    CUSTFCHAC   TESTLIB     *STMT
                                         From user . . . . . . . . . :   ADAM
                                         From module . . . . . . . . :   QLEDEH
                                         From procedure  . . . . . . :   Q LE leDefaultEh
                                         Statement . . . . . . . . . :   73
                                         To module . . . . . . . . . :   CUSTFCHAC
                                         To procedure  . . . . . . . :   QCL_Function_Check_Exception_Handler
                                         Statement . . . . . . . . . :   *N
                                         Message . . . . :   Exception recursion detected.
                                         Cause . . . . . :   An unhandled exception occurred in an exception handler.
                                           Recovery  . . . :   Do not let an exception that occurs in your exception
                                           handler go unhandled.
     
     
  7. Chuk

    Chuk Software Developer

    Code (Text):

    CEE9901    Escape                  30   04/27/15  11:04:55.414951  QLEAWI       QSYS        *STMT    QP2USER2    QSYS        *STMT
                                         From user . . . . . . . . . :   ADAM
    5761SS1 V6R1M0 080215                        Display Job Log                        SABEL    04/27/15 11:04:55          Page    3
      Job name . . . . . . . . . . :   QSQSRVR         User  . . . . . . :   QUSER        Number . . . . . . . . . . . :   546141
      Job description  . . . . . . :   QDFTSVR         Library . . . . . :   QGPL
    MSGID      TYPE                    SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY     INST
                                         From module . . . . . . . . :   QLETOOL
                                         From procedure  . . . . . . :   Q LE AWIRaise
                                         Statement . . . . . . . . . :   178
                                         To module . . . . . . . . . :   QP2API
                                         To procedure  . . . . . . . :   runpase_common__FiPvT2
                                         Statement . . . . . . . . . :   2
                                         Message . . . . :   Application error.  *N unmonitored by *N at statement *N,
                                           instruction X'4000'.
                                         Cause . . . . . :   The application ended abnormally because an exception
                                           occurred and was not handled.  The name of the program to which the
                                           unhandled exception is sent is *N *N . The program was stopped at the
                                           high-level language statement number(s) *N at the time the message was sent.
                                            If more than one statement number is shown, the program is an optimized ILE
                                           program.  Optimization does not allow a single statement number to be
                                           determined.  If *N is shown as a value, it means the real value was not
                                           available. Recovery  . . . :   See the low level messages previously listed
                                           to locate the cause of the exception.  Correct any errors, and then try the
                                           request again.
    MCH3601    Escape                  40   04/27/15  11:04:55.415039  < ckSpaceLoc             0000D4   QCLCLNUP    QSYS        00FD
                                         From user . . . . . . . . . :   ADAM
                                         From Program  . . . . . . . :   RmslUnlockSpaceLoc
                                         Message . . . . :   Pointer not set for location referenced.
                                         Cause . . . . . :   A pointer was used, either directly or as a basing
                                           pointer, that has not been set to an address.
    CPF9999    Escape                  40   04/27/15  11:04:55.418102  QMHUNMSG                 *N       QCLCLNUP    QSYS        00FD
                                         From user . . . . . . . . . :   ADAM
                                         Message . . . . :   Function check. MCH3601 unmonitored by QCLCLNUP at
                                           statement *N, instruction X'00FD'.
                                         Cause . . . . . :   An escape exception message was sent to a program which
                                           did not monitor for that message. The full name of the program to which the
                                           unmonitored message was sent is QCLCLNUP  . At the time the message was sent
                                           the program was stopped at higher level language statement number(s) *N. If
                                           more than one statement number is shown, the program was a bound program.
                                           Optimization does not allow a single statement number to be determined. If
                                           *N is shown as a value, it means the actual value was not available.
                                           Recovery  . . . :   See the low level messages previously listed to locate
                                           the cause of the function check.  Correct any errors, and then try the
                                           request again.
    ]]>
    </joblog>
    </report>

    Exec end: 2015-04-27 11:04:55. Seconds to execute: 0.6440281867981.
     
     
  8. Alan

    Alan Administrator Staff Member

    Is $aryout supposed to be a data structure? Is it supposed to contain subfields? You used a blank array. I don't get that. The other example you showed me here at COMMON was good with a data structure on which you ran ->setParamDimension(9999).
     
  9. Chuk

    Chuk Software Developer

    Yes. This code generating the parameters was from the D-spec conversion tool. What I'm looking for is to return an array of customers. If I'm understanding correctly then data structures are arrays. So I'm looking for the equivalent of a PHP array that looks like the following:

    PHP:
    $myArray = [
        0 => [
            'id' => 1,
            'name' => 'Test Name',
            'address' => 'Test Address'
        ],
        1 => [
             'id' => 2,
             'name' => 'Tst name 2',
             'address' => 'Tst addr 2'
        ]
        //...
    ];
    My problem is probably coming from my ignorance on how RPG handles arrays. I'm probably defining the RPG params incorrectly which produces the wrong toolkit parameter construction code.
     
    Amit Garg likes this.
  10. Amit Garg

    Amit Garg New Member

    Hi Chuck, Was you able to get out values from table. I am facing the same issue.
     
  11. Chuk

    Chuk Software Developer

    Hi Amit. Which issue are you facing? Having trouble getting data from the database table? Or are you using the toolkit and not able use it to get the data from RPG?
     
  12. Amit Garg

    Amit Garg New Member

    Thanks for your response. I am able to get data by using toolkit.
    There is a program which has table as an out parameter. I am not able to get that out table data.
    Is it not possible to get out %table data with the help of toolkit?

    My Code is given below:
    $conn = \ToolkitService::getInstance('*LOCAL', 'USER', '*****');
    $param[]=$conn->AddParameterChar('in',8,'LICNS','LICNS',trim($LICNS));
    $dsparam[]=$conn->AddParameterPackDec('both',8,0, 'DLDOB', 'DLDOB','0');
    $dsparam[]=$conn->AddParameterChar('both',20, 'DLNAMEF', 'DLNAMEF','');
    $dsparam[]=$conn->AddParameterChar('both',20, 'DLNAMEM', 'DLNAMEM','');
    $dsparam[]=$conn->AddParameterChar('both',20, 'DLNAMEL', 'DLNAMEL','');
    $dsparam[]=$conn->AddParameterChar('both',8, 'DLLIC', 'DLLIC','');
    $dsparam[]=$conn->AddParameterChar('both',65, 'Address', 'Address','');
    $dsparam[]=$conn->AddParameterChar('both',33, 'City', 'City','');
    $dsparam[]=$conn->AddParameterChar('both',9, 'Zip', 'Zip','');

    $param[]=$conn->AddDataStruct($dsparam, 'tblPolicies',8,65,false,100);

    $result=$conn->PgmCall('MYPROGRAM','MYLIB',$param,null, null);
     
  13. Alan

    Alan Administrator Staff Member

    How is your data defined in RPG? Is it an array, a data structure, something else? Show us, please.
     

Share This Page