The exit code that runs by default is in the fda7.jar file, which is in com.ibm.etools.egl.java.runtime_version, where version is the product version. The class name is EglDatabaseExits.
The following table lists the methods in that class.
| Method name | Purpose | Type for input and output |
|---|---|---|
| dateExitToDB | Before database input, revise the value that will be assigned to the database from a host variable of type DATE. | String |
| dateExitFromDB | After database output, revise the value that will be placed in a host variable of type DATE. | String |
| timeExitToDB | Before database input, revise the value that will be assigned to the database from a host variable of type TIME. | String |
| timeExitFromDB | After database output, revise the value that will be placed in a host variable of type TIME. | String |
| timestampExitToDB | Before database input, revise the value that will be assigned to the database from a host variable of type TIMESTAMP. | String |
| timestampExitFromDB | After database output, revise the value that will be placed in a host variable of type TIMESTAMP. | String |
package egl.io.sql;
public class EglDatabaseExits
{
/**
* Does custom formatting of a string used as input to a DATE column.
*
* @param input - the value from EGL.
* @return a string in the format which will then be formatted
by StrLib.defaultDateFormat.
*/
public static String dateExitToDB( String input ) { return input; }
/**
* Does custom formatting of a string value fetched from a DATE column.
*
* @param input - the value from the DATE column, formatted
according to StrLib.defaultDateFormat.
* @return a string, will be assigned to an EGL variable.
*/
public static String dateExitFromDB( String output ) { return output; }
/**
* Does custom formatting of a string used as input to a TIME column.
*
* @param input - the value from EGL.
* @return a string in the format that will then be formatted
by StrLib.defaultTimeFormat.
*/
public static String timeExitToDB( String input ) { return input; }
/**
* Does custom formatting of a string value fetched from a TIME column.
*
* @param input - the value from the TIME column, formatted
according to StrLib.defaultTimeFormat.
* @return a string which will be assigned to an EGL variable.
*/
public static String timeExitFromDB( String output ) { return output; }
/**
* Does custom formatting of a string used as input to a TIMESTAMP column.
*
* @param input - the value from EGL.
* @return a string in the format which will then be formatted
by StrLib.defaultTimestampFormat.
*/
public static String timestampExitToDB( String input ) { return input; }
/**
* Does custom formatting of a string value fetched from a TIMESTAMP column.
*
* @param input - the value from the TIMESTAMP column, formatted
according to StrLib.defaultTimestampFormat.
* @return a string, will be assigned to an EGL variable.
*/
public static String timestampExitFromDB( String output ) { return output; }
}
As shown, the masks that you set for date, time, and timestamp have an effect on the data sent to and or received from those exits. You can set those masks in your code by setting the StrLib.defaultDateFormat, StrLib.defaultTimeFormat, and StrLib.defaultTimeStampFormat variables. Those variables can receive default values from Java runtime properties. For details, see the reference topics that are listed at the end of this topic.
get myrec with #sql{
SELECT COL1 FROM TBL WHERE :dateChar1 = '2010-04-01' }
into dateChar2;
To debug or run generated Java code that uses a custom EglDatabaseExits class, place the class in the classpath in a way that precedes fda7.jar, which is the EGL Java runtime jar file. In the EGL Debugger, you can use the classpath preference or the Java Build Path property of the project.
In general, the easiest way to set the classpath of a generated Java batch program in Eclipse is by using Java Build Path property of the project. Outside of Eclipse, use the CLASSPATH environment variable or -classpath command-line argument.
When you compile generated code, you do not need a custom EglDatabaseExits class in the classpath.
To debug or run generated Java code in the Apache Tomcat server or in WebSphere Application Server, place the custom class in the deployment web project, in the WEB-INF/classes folder. Either server searches that folder before searching the WEB-INF/lib folder, where the fda7.jar file is placed for you.