错误CEE9001从java调用外部存储过程(RPGLE / AS400)

时间:2014-09-08 17:03:14

标签: java stored-procedures db2-400 rpgle

当我从java调用一个简单的RPGLE程序运行存储过程时出错 如果我从DB2运行SP(系统I导航器)成功或者如果我运行rpgle程序是as400返回ok但是当从java运行SP时第一次执行是正常的,第二次执行返回错误(CEE9901 - 应用程序错误。* N在语句* IN中不受* N监视。指令X'4000) 我不知道为什么! 有人可以帮助我吗?

这是我的代码 SP

CREATE PROCEDURE WOOLB3.SP806012 (  
IN TRAMA CHAR(62) , 
INOUT RPTA CHAR(1) , 
INOUT VALOR CHAR(15) ) 
LANGUAGE RPGLE 
SPECIFIC WOOLB3.SP806012 
NOT DETERMINISTIC 
MODIFIES SQL DATA 
CALLED ON NULL INPUT 
EXTERNAL NAME 'WOOLB3/IR806012' 
PARAMETER STYLE GENERAL ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC PROCEDURE WOOLB3.SP806012 
TO GRPAYP ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC PROCEDURE WOOLB3.SP806012 
TO GRPCAL ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC PROCEDURE WOOLB3.SP806012 
TO PUBLIC ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC PROCEDURE WOOLB3.SP806012 
TO QPGMR ;

JAVA

Connection conn = null;
CallableStatement cs = null;
StringBuffer sbSQL = new StringBuffer();
String valor = "";

try {
    log.info("Inicio-->SP806012"); 
    conn = ResourceManager.getConnection(JNDIContext.JNDI_DATASOURCE_MCD);
    String esquema = FrameworkParameters.getValue(MCDConstant.ESQUEMA_RPG);
    sbSQL.append("{CALL ").append(esquema);
    sbSQL.append(".").append(MCDConstant.SP_OBTIENE_VALOR_CUOTA).append("(?,?,?)}");
    cs = conn.prepareCall(sbSQL.toString());            
    System.out.println(trama);
    cs.setString(1, trama);     
    cs.setString(2, MCDConstant.VACIO);
    cs.setString(3, MCDConstant.VACIO);
    cs.registerOutParameter(2, java.sql.Types.VARCHAR);
    cs.registerOutParameter(3, java.sql.Types.VARCHAR);

    cs.execute();

    if (cs.getString(2).equals(MCDConstant.STRING_UNO)){
        valor = (String)cs.getString(3).trim();
    }                   

    log.info("Fin-->SP806012");

} catch (SQLException e) {
    e.printStackTrace();
    throw new DAOException(e.getMessage(), e);
} catch (Exception e) {
    e.printStackTrace();
    throw new DAOException(e);  
} finally{
    ResourceManager.callableStatementClose(cs);
    cs = null;
    ResourceManager.connectionClose(conn);
    conn = null;
}
return valor;

RPGLE

            z-add     *zeros        v_cuota          11 2           
            z-add     *zeros        v_mdiferi         1 0           
            move      '0'           v_mdiferi         1             
            move      *blanks       p_fecvcto         8             
            eval      ds_tarjeta = %trim(p_tarjeta)                 

 k_cs01p       chain     cs01pr                             70         
 70            eval      socic = ''                                    
               EXSR      sr_ObtRelDif                                  
               eval      p_fecvcto = fePROXVENC1(ds_tarjeta:v_mdiferi) 
               eval      v_cuota   = fegetcuota(p_ncuota:p_fcompra:    
                      p_fecvcto:p_capital:p_tea:socic)              

 v_cuota       ifgt      *zeros                                        
            movel     '1'           p_rpta                          
            endif                                                   
            move      v_cuota       p_valor                         

1 个答案:

答案 0 :(得分:0)


Seríamuyútilquepegarasacáeljoblog completo del trabajo。 Para buscar que trabajo es puedes hacer WRKOBJLCK USUARIO_DE_JAVA * USRPRF,revisa el trabajo ysiaúnnoentiendes el error,pegalocoáparaayudarte。的SLD。