Execute Using SQL EX and SQL CPJAVA EX

How to:

Using SQL EX or SQL CPJAVA EX is similar to using EXEC, the difference is that the output from SQL EX is stored into a HOLD file called SQLOUT. The resulting SQLOUT file can then be processed with additional SELECT or TABLE statements which may (or may not) contain additional selection criteria, and possibly return less fields or create a virtual field that is derived from the data.

You can invoke a user-written JAVA class with the EX command if SET EXORDER is also used when considering external programs for execution.


Top of page

x
Syntax: How to Use SQL EX to Execute a JAVA Class
SET SQLENGINE=CPJAVA
SQL EX classparameter1,, parameter2, ... ;
TABLE FILE SQLOUT
PRINT * [ON TABLE [PC]HOLD]
SET SQLENGINE=OFF

where:

java.class

Is the full name of the class to be invoked and must be preceded by the prefix java.

parameter1, parameter2, ...

Are the parameters which must be passed to the JAVA class according to the rules described in Passing Parameters.


Top of page

x
Syntax: How to Use SQL CPJAVA EX to Execute a JAVA Class
SET CPJAVA EX classparameter1,parameter2, , ... ;
TABLE FILE SQLOUT
PRINT * [ON TABLE [PC]HOLD]
END

where:

java.class

Is the full name of the class to be invoked and must be preceded by the prefix java.

parameter1, parameter2, ...

Are the parameters which must be passed to the JAVA class according to the rules described in Passing Parameters.

The trailing semi-colon is required syntax. Either syntax is valid and one may be stylistically better for any given application.



Example: Calling ibi.cjsamples.cjsamp Using SQL CPJAVA EX
SQL CPJAVA EX java.ibi.cjsamples.cjsamp parameter1,
   “subparm1=val1, subparm2=val2”, simple parameter3;
TABLE FILE SQLOUT
PRINT *
END

iWay Software