jt400 write record throws "CPF5035 Data mapping error"

1k views Asked by At

I have a table with many, many fields. When trying to insert data with jt400 (flei00.write(newrec);) I get error CPF5035 Data mapping error on member FLEI00.. Even when trying to insert empty or nearly empty record, the error message is the same. Is there a way to get know, which field is causing the problem? I've been fighting with it a whole day and have no more idea what to check :-(. Any help (e.g. where to look for more info) will be appreciated.

1

There are 1 answers

5
Buck Calabro On

On IBM i, the job log is THE place to find details about errors occurring in a given job. In the case of JT400 jobs, the JT400 app connects via sockets to a server job. Typically, there are a bunch of these jobs 'prestarted', waiting for a connection. This can be difficult to navigate if you're not accustomed to the 5250 interface.

Here's a JT400 program that gets the job log messages for you. If you run this in the same session that you are getting the error in you should see the details about what field is causing the issue.

import java.util.*;
import com.ibm.as400.access.*;

public class TestJobLog {
    public static void main(String[] args) {

   int i = 0;

try {
    AS400 system = new AS400();

   JobLog jobLog = new JobLog(system);

   // what attributes?
   jobLog.clearAttributesToRetrieve();
   jobLog.addAttributeToRetrieve(JobLog.MESSAGE_WITH_REPLACEMENT_DATA);
   jobLog.addAttributeToRetrieve(JobLog.MESSAGE_HELP_WITH_REPLACEMENT_DATA);

   // load the messages
   jobLog.load();

    // Create a list and subset it
    Enumeration list = jobLog.getMessages();

   System.out.println("There are " + Integer.toString(jobLog.getLength()) + " messages.");

    while (list.hasMoreElements())  {
      i++;
      QueuedMessage message = (QueuedMessage) list.nextElement();
        String text = message.getID() +
                    " " + message.getType() +
                    " " + message.getText() + "\n" +
                    " " + message.getMessageHelpReplacement() + "\n";
        System.out.println(Integer.toString(i) + " " + text);
        }

   jobLog.close();

    System.exit(0);

    } catch (Exception e) {
        System.out.println(e);
    }

}
}