On 28 Sep 2007, Marshal Dunbar wrote:
My guess is you've got CCSID conversion issues.
According to the javadocs, the constructor AS400Text(int) is deprecated.
You should use AS400Text(int, AS400). That constructor will use the
CCSID
of the AS/400 system you are connected to.
That was one of my experiments. I created an AS400 object, then used the
method getCcsid to get the CCSID of the server job, and then used the
AS400Text constructor taking a CCSID value as one of its parameters. Same
result as before. I did the same thing with method getJobCCSIDEncoding,
and the constructor taking an encoding as one of its parameters. Same
result as before. In response to your suggestion, I also did a test with
the constructor AS400Text(int, AS400). You guess, same result as before.
I repeat some part of the code:
public boolean login() throws LoginException {
ServiceProgramCall sPGMCall = null;
AS400 system = null;
AS400Text txtCnv = null;
AS400Bin4 bin4 = new AS400Bin4();
try {
system = new AS400(auth_server, user, password);
txtCnv = new AS400Text(10, system);
ProgramParameter[] parameterList = new
ProgramParameter[1];
byte[] input = txtCnv.toBytes(check_program);
for (int i=0; i < input.length; i++)
System.out.println("Position " + i + ": " +
Byte.toString(input[i]));
[....]
When I examine the entries in the byte array one by one, with parameter
value SHP78E, the result is as follows:
Position 0: -30
Position 1: -56
Position 2: -41
Position 3: -9
Position 4: -8
Position 5: -59
Position 6: 64
Position 7: 64
Position 8: 64
Position 9: 64
I wonder what the output should look like, if everything would be fine.
What should be the byte value for - for example - a character S converted
to a format that is understandable by the AS400?
Still struggling, looking for a clue...
Ewout
As an Amazon Associate we earn from qualifying purchases.