Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Wink Unanswered: DB2 Call Level Interface with DB2

    Hello
    I have a problem.
    I need to recovery a resulset in iSeries (SQLRPGLE).
    The pgm (SQLRPGLE) is called from Java (JDBC)

    I need to do call from JAVA to SQLRPGLE and the resulset recovery in iSeries ambien, and proces in this ambien.

    Example:
    PGM1 (Java Win)

    -> PGM2 SQLRPGLE (This PGM recovery and process a resulset)

    -> PGM3 SQLRPGLE (This PGM built the resulset)

    The resulset I don't need in java win ambient, only need in iSERIES plataform, but I need first call from java win.

    when I call the PGM2 in iSeries ambien (from de console iSERIES), the resulset is OK (I can recovery an process good) bud when the PGM2 is called from JAVA WIN don't work correctly.

    The store procedure is correctly created.

    I don't understand. I can recovery in JAVA WIN the resulset but the PGM2 not.

    The source of de PGM2

    H BNDDIR('QC2LE') OPTION(*SRCSTMT:*NODEBUGIO)
    H DECEDIT('0,') DATEDIT(*YMD/) FIXNBR(*ZONED)
    H DFTACTGRP(*NO)
    D*
    D Env S LIKE(SQLHENV)
    D Conn S LIKE(SQLHDBC)
    D Stmt S LIKE(SQLHSTMT)
    D*
    D*
    D/COPY ITBPGLIB/QRPGSRC,SQLCLI_H
    D*
    D*....Parametros de Entrada (PR)
    D Principal PR EXTPROC('NFNPR216RX')
    D*
    D* Standar (Drv_Canal,Drv_PGM,Drv_IP,Drv_User,Drv_Ref)
    D 10A
    D 40A
    D 50A
    D 10A
    D 20A
    D*
    D* Servicio (Srv_NroCliente,Srv_CodRtn)
    D 10A
    D 5A
    D 100A
    D*
    D* Adicional plataforma iSeries -> iSeries
    D*....Parametros de Entrada (PI)
    D Principal PI
    D Drv_Canal 10A
    D Drv_Pgm 40A
    D Drv_IP 50A
    D Drv_User 10A
    D Drv_Ref 20A
    D Drv_Ref 20A
    D*
    D Srv_NroCliente 10A
    D Srv_CodRtn 5A
    D XX 100A
    D*
    D*..Variables
    D*
    D NroCliente S 10A
    D CodRtn S 5A
    D I S 3S 0
    D XVALOR S 10A
    D*
    D*..Variables Resul set
    D RS_PrsSID S 3s 0
    D RS_PrsNro S 11s 0
    D*
    D*
    /FREE
    DSPLY 'resulset' 'EDUARDOD';
    DSPLY srv_Nrocliente 'EDUARDOD';

    NroCliente = Srv_NroCliente ;
    CodRtn = '00000';

    SQLAllocEnv(env);
    SQLAllocConnect(env: conn);
    SQLSetConnectAttrI( conn
    : SQL_ATTR_DBC_SYS_NAMING
    : SQL_TRUE
    : %size(SQLINTEGER) );

    SQLConnect( conn
    : '*LOCAL'

    : SQL_NTS
    : *NULL
    : SQL_NTS
    : *NULL
    : SQL_NTS );

    SQLAllocStmt( conn : Stmt );
    SQLBindParam ( Stmt
    : 1
    : SQL_CHAR
    : SQL_CHAR
    : 10
    : 0
    : %ADDR(Drv_Canal)
    : *OMIT );
    SQLBindParam ( Stmt
    : 2
    : SQL_CHAR
    : SQL_CHAR
    : 40
    : 0
    : %ADDR(Drv_Pgm)
    : *OMIT );
    SQLBindParam ( Stmt
    : 3
    : SQL_CHAR
    : SQL_CHAR
    : 50
    : 0
    : %ADDR(Drv_IP)
    : *OMIT );
    SQLBindParam ( stmt
    : 4
    : SQL_CHAR
    : SQL_CHAR
    : 10
    : 0
    : %ADDR(Drv_USer)
    : *OMIT );
    SQLBindParam ( stmt
    : 5
    : SQL_CHAR
    : SQL_CHAR
    : 20
    : 0
    : %ADDR(Drv_Ref)
    : *OMIT );
    SQLBindParam ( stmt
    : 6
    : SQL_CHAR
    : SQL_CHAR
    : 10
    : 0
    : %ADDR(NroCliente)
    : *OMIT );
    SQLBindParam ( stmt
    : 7
    : SQL_CHAR
    : SQL_CHAR
    : 5
    : 0
    : %ADDR(CodRtn)
    : *OMIT ) ;

    SQLExecDirect( stmt
    : 'CALL EDUARDOLIB/NFNPR219 (?,?,?,?,?,?,?)'
    : SQL_NTS );

    SQLBindCol( stmt
    : 1
    : SQL_NUMERIC
    : %ADDR(RS_PrsSID)
    : %SIZE(RS_PrsSID)
    : *OMIT );
    SQLBindCol( stmt
    : 2
    : SQL_NUMERIC
    : %ADDR(RS_PrsNro)
    : %SIZE(RS_PrsNro)
    : *OMIT );
    XVALOR = '999';
    DSPLY 'X VALOR' 'EDUARDOD';
    DSPLY XVALOR 'EDUARDOD';
    XX = '-1';
    Dow SQLFetch( stmt ) = SQL_SUCCESS;
    I = I + 1 ;
    XX = %EditC(I:'X') ;
    Enddo;
    XVALOR = XX ;
    DSPLY 'VALOR XX' 'EDUARDOD';
    DSPLY XVALOR 'EDUARDOD';
    Srv_CodRtn = CodRtn;
    SQLFreeStmt( Stmt : SQL_DROP );
    SQLDisconnect( Conn );
    SQLFreeConnect( Conn );
    SQLFreeEnv( Env );
    *INLR = *ON;
    RETURN;
    /END-FREE

    Sorry my bad english ....

  2. #2
    Join Date
    Jul 2009
    Posts
    3
    Sorry
    The plataform is:
    SO: V5R4 (SF99347)
    BD: DB2 UDB FOR ISERIES (SF99504)

    I only need recovery the resulset in iSeries ambient called from Java Win.
    I don't need the resulset Win plataform but I need to call to SQLRPGLE from JAVA WIN.

  3. #3
    Join Date
    Jul 2009
    Posts
    3
    Hello.
    I found the solution.
    I run the PGM2 whit SUBMITED:
    (SBMJOB CMD(CALL PGM(PGM2))

    Now, the resulset the PGMs can read good.

    Thanks....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •