Skip to Main Content
IBM Z Software


This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Delivered
Categories EGL Language
Created by Guest
Created on Oct 14, 2009

Batching update and insert statements

Batching insert and update statements is a technique available in Java for reducing the number of database calls. Unfortunately, this technique is not available in EGL.
java.sql.PreparedStatement's addBatch() method adds a set of parameters to a batch. Subsequently, the batch is submitted to the database by invoking the executeBatch() method on the prepared statement object. The protocol is illustrated by the implementation of the following EGL external type:
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.ibm.javart.JavartException;
import com.ibm.javart.resources.Program;

public class DntPreparedStatement extends PreparedStatementWrapper {

private PreparedStatement pstmt;

public DntPreparedStatement(){
}

public DntPreparedStatement(Program prog){
try {
ezeProgram = prog;
Connection con = com.ibm.javart.sql.Sql.begin(ezeProgram,
"EXECUTE", null).getConnection();
pstmt = con
.prepareStatement(
"insert into BCDB.TB_BCDB_DNT (ID_BCDB_DTH,CNT,DNM,OPERATOR_I,CPN_ID)values"
+ "(?,?,?,?,?)");
} catch (JavartException e) {
e.printStackTrace();
System.exit(-1);
} catch (SQLException e) {
e.printStackTrace();
System.exit(-1);
}
}

public void addDnt(BigInteger dth_id, BigDecimal cnt, String dnm,
String op, String cpn_id) {

try {
BigDecimal dnm_bd = null;
BigDecimal user_Cd = null;
BigDecimal cpn = null;
try {
dnm_bd = new BigDecimal(dnm);
} catch (Exception e) {
}
try {
user_Cd = new BigDecimal(op);
} catch (Exception e) {
}
try {
cpn = new BigDecimal(cpn_id);
} catch (Exception e) {
}
pstmt.setBigDecimal(1, new BigDecimal(dth_id));
pstmt.setBigDecimal(2, cnt);
pstmt.setBigDecimal(3, dnm_bd);
pstmt.setBigDecimal(4, user_Cd);
pstmt.setBigDecimal(5, cpn);
pstmt.addBatch();
} catch (SQLException e) {
e.printStackTrace();
System.exit(-1);
}

}

public void do_it(){
try {
pstmt.executeBatch();
int count = pstmt.getUpdateCount();
com.ibm.javart.sql.Sql.end( ezeProgram,
"EXECUTE",
null,
count,
pstmt,
true,
true,
false,
false
);
} catch (JavartException e) {
e.printStackTrace();
System.exit(-1);
} catch (SQLException e) {
e.printStackTrace();
System.exit(-1);
}
}

}
Error handling is certainly not production-grade, but suffices for my performance tests.
The EGL code makes use of DntPreparedStatement as follows:

ExternalType Dnt extends Serializable type JavaObject
{
packageName="com.kbc.n01.ftn.pvt",
javaName="DntPreparedStatement"
}

constructor();

function addDnt(
id num(20) in,
cnt num(15,2) in,
dnt_Id unicode(10) in,
user_Cd unicode(10) in,
cpn_Cst_No unicode(10) in);

function do_it();
end
?

function b020_Str_Dnts()
//--------------------------

dnt Dnt = new Dnt();

for (wn0f49.wix.dnt_Lst_Idx from 1 to in0f49.ipt_Zn.data.dnt_Lst.getSize())
if (in0f49.ipt_Zn.data.dnt_Lst[wn0f49.wix.dnt_Lst_Idx].cnt > 0)
if (in0f49.ipt_Zn.data.dnt_Lst[wn0f49.wix.dnt_Lst_Idx].dnt_Id > " ")
cnt decimal(15,2) =
in0f49.ipt_Zn.data.dnt_Lst[wn0f49.wix.dnt_Lst_Idx].cnt;
dnt.addDnt(
wn0f49.wwv.dth_Id,
cnt,
in0f49.ipt_Zn.data.dnt_Lst[wn0f49.wix.dnt_Lst_Idx].dnt_Id,
in0f49.ipt_Zn.hdr.user_Cd,
in0f49.ipt_Zn.hdr.cpn_Cst_No);
else
z120_Add_Am_Ext();
end
end
end

dnt.do_it();
end

Idea priority Medium
  • Guest
    Reply
    |
    Sep 14, 2015

    Due to processing by IBM, this request was reassigned to have the following updated attributes:
    Brand - Servers and Systems Software
    Product family - Programming Languages
    Product - Business Developer

    For recording keeping, the previous attributes were:
    Brand - Rational
    Product family - Design & development
    Product - Business Developer

  • Guest
    Reply
    |
    Sep 25, 2013

    The feature has been implemented in 9.0

  • Guest
    Reply
    |
    Jul 24, 2013

    shipped in RBD 9.0

  • Guest
    Reply
    |
    Oct 22, 2009

    Thank you for this suggestion. We agree that this would improve runtime performance. This is a candidate for implementation in our next release.