0

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.

agad
  • 2,192
  • 1
  • 20
  • 32

1 Answers1

3

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);
    }

}
}
Buck Calabro
  • 7,558
  • 22
  • 25
  • There is nothing interesting among those messages :-(. 2 last are: 11 CPF5C61 4 Client request - run program QSYS/QWCRTVCA. 12 CPF5C61 4 Client request - run program QGY/QGYOLJBL. – agad Dec 13 '13 at 07:34
  • It's sort of like a stack trace. There's a lot of stuff there, but not all of it bears directly on your problem. Look specifically for the CPF5035. The 'help' text should have the details of the failing field. – Buck Calabro Dec 13 '13 at 12:45
  • ...and remember that there are multiple server jobs waiting for JT400 connections. I'm pretty sure that every ' = new AS400()' connects to a different server job. So I'm emphasizing that you need to explore the job log of the same process that's failing. If the job log messages seem like too much, give the job name to an IBM i admin and she can look at the job log for you from the green screen side of the house. – Buck Calabro Dec 13 '13 at 12:53
  • I have `JobLog jobLog = new JobLog(as400)` in a `catch` clause and `as400` is the system I'm connected to. But nobody hasn't found anything about the error in related logs :-( The suspicion falls on date fields; but i write dates to other tables in the same program and it works well. – agad Dec 13 '13 at 13:14
  • The problem was really with a date field: one of them had `3=NOT NULL WITH DEFAULT` nulls and was not set. – agad Dec 13 '13 at 14:16