I've created a stored procedure written in java which has a varchar(100) OUT parameter. When I call the stored procedure from another java program, the returned string from the stored procedure is padded to 100 characters long even though it was registered in java via Types.VARCHAR. According to IBM's Applications Development Concepts manual, under "Improving Stored Procedure Perfomance", it mentioned using varchar instead of char so the parameters don't get padded, although it seems it's written for IN parameters. Is this suppose to be? (I'm using DB2 v7.2 fixpack 8). Here's a snippet of the calling java code.

...
CallableStatement callStmt = con.prepareCall("CALL cryptlib.encrypt(?,?,?,?)");

// register IN parameter
callStmt.setString(1,"encryptme");
callStmt.setString(2,iv);
callStmt.setString(3,key);

// register OUT parameter
callStmt.registerOutParameter(4,Types.VARCHAR);
callStmt.execute();

// s is padded to length 100...is this right?
String s = callStmt.getString(4);
System.out.println(s);

...