NullSearch Utility

The NullSearch utility identifies null-value fields in custom record classes passed to Enterprise Server at runtime. Null-value fields are invalid, preventing the runtime from executing.

Scenario for using NullSearch

If even one null-value field in a custom record mapping is passed to Enterprise Server, the run-time returns the following generic error message:

Sorry cannot have a null as value. Run the NullSearch utility.

The NullSearch utility identifies which fields have a null value, and can be especially helpful when your custom record mapping contains a large number of fields. For example, suppose customer record A has an inner class B that contains an array of 1000 elements of type String. One of those String elements has a value of null, triggering the above-referenced error message at run time. Without the NullSearch utility, you would have to manually identify the offending field.

To use the NullSearch utility

We provide the NullSearch utility as a Java .jar file named nullSearch.jar, which is called from a Java program. nullSearch.jar is located by default in your %ProgramFiles(x86)%\Micro Focus\Visual COBOL for Visual Studio 2013\javaee directory.

To use nullSearch.jar:

  1. Add nullSearch.jar to your system classpath environment variable, and depending on which class is extended by the custom record you want to search, also add the appropriate .jar file as cited below in addition to nullSearch.jar:
    Extended Class .jar File
    com.microfocus.cobol.connector.cci.CustomRecord mfejblib.jar
    com.microfocus.cobol.lang.CustomRecord mfcobolpure.jar
  2. In a Java program, create a com.microfocus.tools.NullSearch object that calls the parseFields method. In the following example Java program, custom_record is the name of your custom record:
    public class testSearch {
    	    public static void main(String[] args){
    		        custom_record field = new custom_record();
            		Object[] params = field.getParameters();
    	        	com.microfocus.tools.NullSearch search = new com.mf.NullSearch();
            		search.parseFields(params);	
        	}
    }
  3. Execute the java program.
  4. Search the output for the keyword null.
    The output is organized as a list of enumerated fields identified by class. In the following example, the null field 1.0.2 is identified as the second field in class classA$classE, subclass [LclassF$classG$classH;:
    Field 0 is: classA$classB
    Field 0.20 is: classA$classB$classC
    Field 0.24 is: classA$classB$classD
    Field 1 is: classA$classE
    Field 1.0 is: [LclassF$classG$classH;
    Field 1.0.2 is null