com.microfocus.cobol
Class RuntimeSystem

java.lang.Object
  extended bycom.microfocus.cobol.RuntimeSystem
Direct Known Subclasses:
runtime, RuntimeObject

public class RuntimeSystem
extends Object

Main class for COBOL/Java interoperability

Copyright: Copyright (c) 2002-2003
Company: Micro Focus International Ltd

Since:
Net Express 4.0, Server Express 4.0
Version:
3.40, 12/23/04

Field Summary
static short A_BLINK
          Screen attribute flag
static short A_BOLD
          Screen attribute flag
static short A_DIM
          Screen attribute flag
static short A_NORMAL
          Screen attribute flag
static short A_REVERSE
          Screen attribute flag
static short A_UNDER
          Screen attribute flag
static int BY_CONTENT
          BY_CONTENT is used in non-OO calls to COBOL in the usageDescription array.
static int BY_REFERENCE
          BY_REFERENCE is used in non-OO calls to COBOL in the usageDescription array.
static int BY_VALUE
          BY_VALUE is used in non-OO calls to COBOL in the usageDescription array.
protected static long cblClassHandle
          COBOL proxy class handle, if one exists
protected  long cblInstanceHandle
          COBOL proxy instance handle, if one exists
protected static boolean isWindows
          Running under Windows operating system
protected static String osName
          Operating system name
static int SRV_CTL_ERRORHAND
          SRV_CTL_ERRORHAND causes server error handling to be in effect
static int SRV_CTL_ERRORHAND_ALL
          SRV_CTL_ERRORHAND_ALL causes server error handling to be in effect all errors are handled regardless of type
static int SRV_CTL_NOCANCEL
          SRV_CTL_NOCANCEL prevents cancel being called by user code in this thread
static int SRV_CTL_NONE
          SRV_CTL_NONE no server control functions
static int SRV_CTL_NOSTOPRUN
          SRV_CTL_NOSTOPRUN prevents the called program from executing a real stop run, STOP RUN will cause direct return to Java
static int SRV_CTL_NOTHREAD
          SRV_CTL_NOTHREAD prevents the called program from creating threads
static int SRV_CTL_THREADTIDY
          SRV_CTL_THREADTIDY causes the thread to be tidied after this call completes, the next call on this thread will have new THREAD-LOCAL data.
 
Constructor Summary
RuntimeSystem()
           
 
Method Summary
static void ccall(Object retCode, String program, Object[] array, int[] usageDescription)
          Calls a C function with a set of parameters which returns an object as a parameter
static int ccall(String program, Object[] array, int[] usageDescription)
          Calls a c function with a set of parameters which returns an object as a parameter
static void cobaddstr(int attribute, String name)
          Displays the specified string on the screen at the virutal cursor's current position.
static void cobaddstr(String name)
          Displays the specified string on the screen at the virutal cursor's current position.
static void cobassocclass(String fileName, Class javaClass)
          Associates a Java class and COBOL class
static void cobassocclass(String fileName, String javaClass)
          Associates a Java class and COBOL class
static boolean cobcall_boolean(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a boolean
static Boolean cobcall_Boolean(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a Boolean
static byte cobcall_byte(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a String
static Byte cobcall_Byte(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a Byte
static float cobcall_float(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a float
static Float cobcall_Float(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a Float
static int cobcall_int(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a int
static Integer cobcall_Integer(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a Integer
static void cobcall_Object(Object retValue, String program, Object[] array)
          Calls a COBOL program with a set of parameters, then it updates the retCode object with return-code.
static short cobcall_short(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a short
static Short cobcall_Short(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a Short
static String cobcall_String(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a String
static void cobcall(Object retCode, String program, Object[] array, int[] usageDescription)
          Calls a COBOL program with a set of parameters which returns an object * as a parameter
static void cobcall(Object retCode, String program, Object[] array, int[] usageDescription, boolean passJNIEnv_and_self)
          Calls a COBOL program with a set of parameters which returns an object * as a parameter
static void cobcall(Object retCode, String program, Object[] array, int[] usageDescription, boolean passJNIEnv_and_self, int srvControl)
          Calls a COBOL program with a set of parameters which returns an object * as a parameter
static void cobcall(Object retCode, String program, ParameterList parameters)
          Calls a COBOL program with a specifed ParameterList and updates a return-code object.
static int cobcall(String program)
          Calls a COBOL program with no parameters.
static int cobcall(String program, Object[] array)
          Calls a COBOL program with a set of parameters which returns a int
static int cobcall(String program, ParameterList parameters)
          Calls a COBOL program with a specifed ParameterList
static void cobcancel(String program)
          Causes the Runtime to CANCEL the program specified.
static void cobclear()
          Clears the screen and positions the cursor at line 0, column 0 strings.
static int cobcols()
          Returns the number of columns on the screen
static void cobfinalize(Object o)
          Destroys a COBOL proxy object
static char cobgetch()
          Gets a character from the keyboard
static String cobgetenv(String name)
          Allows you to find a COBOL/System environment variable
 boolean cobinvoke_boolean(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a boolean
 byte cobinvoke_byte(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a byte
 char cobinvoke_char(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a char
 double cobinvoke_double(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a double
 float cobinvoke_float(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a float
 int cobinvoke_int(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning an int
 long cobinvoke_long(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a long
 Object cobinvoke_object(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning an object
 short cobinvoke_short(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters returning a short
 void cobinvoke_void(String methodName, Object[] params)
          Invokes a COBOL instance with a set of parameters
static boolean cobinvokestatic_boolean(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a boolean
static byte cobinvokestatic_byte(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a byte
static char cobinvokestatic_char(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a char
static double cobinvokestatic_double(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a double
static float cobinvokestatic_float(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a float
static int cobinvokestatic_int(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning an int
static long cobinvokestatic_long(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a long
static Object cobinvokestatic_object(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning an object
static short cobinvokestatic_short(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters returning a short
static void cobinvokestatic_void(Class classObject, String methodName, Object[] params)
          Invokes a COBOL class with a set of parameters
static int coblines()
          Returns the number of lines on the screen
static int cobload(String libName)
          Loads a COBOL library and makes visable any entry-points in the program
Note: Using a platform specific name/extension will cause portability issues
static int cobloadclass(String libName, String fileName)
          Loads a COBOL library and/or a class within that library.
static int cobloadclass(String libName, String fileName, Class javaClass)
          Loads a COBOL library and/or a class within that library and associates it with a particular Java class.
static int cobloadclass(String libName, String fileName, String javaClassname)
          Loads a COBOL library and/or a class within that library and associates it with a particular Java class of a given name.
static void cobmove(int y, int x)
          Move to the row, column on the screen
static int cobputenv(String name)
          Allows you to dynamically change the COBOL environment a Runtime
static void cobrcall(Object retCode, String program, ParameterList parameters)
          Calls a COBOL program with a set of parameters, then updates the retCode object with return-code

NB: This method allows the user to call legacy COBOL programs without requiring changes

static void cobrcall(Object retCode, String program, ParameterList parameters, int srvCtl)
          Calls a COBOL program with a set of parameters and server control flags, then updates the retCode object with return-code

NB: This method allows the user to call legacy COBOL programs without requiring changes

NB: Server control flags modify behaviour of runtime system to allow execution in context of a Java app server

static int cobrescanenv()
          Causes the Runtime to rescan the environment for COBOL environment strings.
static int cobthreadtidy()
          Causes the COBOL thread associated with the currently running Java thread to be cleanly finalized.
static void cobtidy()
          Causes the Runtime to tidy itself up.
protected static String getCobolRuntimeSupportLibraryName()
          Internal use
static int getSrvCtlDefault()
          Gets the default SRV_CTL_ attributes for calls to COBOL programs
static void main(String[] args)
          Run this class in order to obtain the COBJVM environment variable for the current Java installation
Setup CLASSPATH to include com.microfocus.cobol.jar and use:
java -Dcom.microfocus.cobol.getcobjvmenv=off com.microfocus.cobol.Runtime
static void setSrvCtlDefault(int srvCtlDefault)
          Sets the default SRV_CTL_ attributes for calls to COBOL programs
protected  void updateParameters(Object[] old, Object[] update)
          Method declaration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BY_VALUE

public static final int BY_VALUE
BY_VALUE is used in non-OO calls to COBOL in the usageDescription array. BY_REFERENCE is the default if usageDescription is not used

See Also:
cobcall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(String program, Object[] array, int[] usageDescription), Constant Field Values

BY_REFERENCE

public static final int BY_REFERENCE
BY_REFERENCE is used in non-OO calls to COBOL in the usageDescription array. BY_REFERENCE is the default if usageDescription is not used

See Also:
cobcall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(String program, Object[] array, int[] usageDescription), Constant Field Values

BY_CONTENT

public static final int BY_CONTENT
BY_CONTENT is used in non-OO calls to COBOL in the usageDescription array. BY_REFERENCE is the default if usageDescription is not used

See Also:
cobcall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(Object retCode, String program, Object[] array, int[] usageDescription), ccall(String program, Object[] array, int[] usageDescription), Constant Field Values

SRV_CTL_NONE

public static final int SRV_CTL_NONE
SRV_CTL_NONE no server control functions

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_NOTHREAD

public static final int SRV_CTL_NOTHREAD
SRV_CTL_NOTHREAD prevents the called program from creating threads

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_NOSTOPRUN

public static final int SRV_CTL_NOSTOPRUN
SRV_CTL_NOSTOPRUN prevents the called program from executing a real stop run, STOP RUN will cause direct return to Java

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_NOCANCEL

public static final int SRV_CTL_NOCANCEL
SRV_CTL_NOCANCEL prevents cancel being called by user code in this thread

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_ERRORHAND

public static final int SRV_CTL_ERRORHAND
SRV_CTL_ERRORHAND causes server error handling to be in effect

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_ERRORHAND_ALL

public static final int SRV_CTL_ERRORHAND_ALL
SRV_CTL_ERRORHAND_ALL causes server error handling to be in effect all errors are handled regardless of type

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

SRV_CTL_THREADTIDY

public static final int SRV_CTL_THREADTIDY
SRV_CTL_THREADTIDY causes the thread to be tidied after this call completes, the next call on this thread will have new THREAD-LOCAL data.

See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvControl), Constant Field Values

A_NORMAL

public static final short A_NORMAL
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

A_BOLD

public static final short A_BOLD
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

A_UNDER

public static final short A_UNDER
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

A_REVERSE

public static final short A_REVERSE
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

A_BLINK

public static final short A_BLINK
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

A_DIM

public static final short A_DIM
Screen attribute flag

See Also:
cobaddstr(int attribute,String name), Constant Field Values

isWindows

protected static boolean isWindows
Running under Windows operating system


osName

protected static final String osName
Operating system name


cblClassHandle

protected static final long cblClassHandle
COBOL proxy class handle, if one exists

See Also:
Constant Field Values

cblInstanceHandle

protected final long cblInstanceHandle
COBOL proxy instance handle, if one exists

See Also:
Constant Field Values
Constructor Detail

RuntimeSystem

public RuntimeSystem()
Method Detail

main

public static void main(String[] args)
Run this class in order to obtain the COBJVM environment variable for the current Java installation
Setup CLASSPATH to include com.microfocus.cobol.jar and use:
java -Dcom.microfocus.cobol.getcobjvmenv=off com.microfocus.cobol.Runtime

Parameters:
args - command line arguments to com.microfocus.cobol.RuntimeSystem

setSrvCtlDefault

public static void setSrvCtlDefault(int srvCtlDefault)
Sets the default SRV_CTL_ attributes for calls to COBOL programs

Parameters:
srvCtlDefault - an bitwise-or of SRV_CTL_ values
See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvCtl)

getSrvCtlDefault

public static int getSrvCtlDefault()
Gets the default SRV_CTL_ attributes for calls to COBOL programs

Returns:
the bitwise-or of SRV_CTL_ values
See Also:
cobrcall(Object retCode, String program, ParameterList parameters, int srvCtl)

cobcall

public static void cobcall(Object retCode,
                           String program,
                           Object[] array,
                           int[] usageDescription,
                           boolean passJNIEnv_and_self)
                    throws CobolException,
                           Exception
Calls a COBOL program with a set of parameters which returns an object * as a parameter

Parameters:
retCode - an Object that contains the return-code
program - a string
array - array of objects
usageDescription - array of usageDescriptions for array of objects
passJNIEnv_and_self - - pass JNIENv *, jclass self to COBOL program
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example:
To call a COBOL program called "myfunc" with one integer parameter passed in "by reference".

Java Example
 Integer myOneInt    = new Integer(41);
 Object myParms[] = { myOneInt };
 int usageUpdate[] = { RuntimeSystem.BY_REFERENCE } ;

 System.out.println("By Reference test");
 RuntimeSystem.cobcall(null,"myfunc",myParms,usageUpdate,false);
 System.out.println("myfunc returned "+myOneInt);

 

COBOL Example (myfunc.cbl)
 working-storage section.
 copy "javatypes.cpy".
 linkage section.
 01 a usage jint.
 procedure division using a.
 add 1 to a
 exit program returning 0.

 

cobcall

public static void cobcall(Object retCode,
                           String program,
                           Object[] array,
                           int[] usageDescription,
                           boolean passJNIEnv_and_self,
                           int srvControl)
                    throws CobolException,
                           Exception
Calls a COBOL program with a set of parameters which returns an object * as a parameter

Parameters:
retCode - an Object that contains the return-code
program - a string
array - array of objects
usageDescription - array of usageDescriptions for array of objects
passJNIEnv_and_self - - pass JNIENv *, jclass self to COBOL program
srvControl - an bitwise-or of SRV_CTL_ values
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example:
To call a COBOL program called "myfunc" with one integer parameter passed in "by reference".

Java Example
 Integer myOneInt    = new Integer(41);
 Object myParms[] = { myOneInt };
 int usageUpdate[] = { RuntimeSystem.BY_REFERENCE } ;

 System.out.println("By Reference test");
 RuntimeSystem.cobcall(null,"myfunc",myParms,usageUpdate,false);
 System.out.println("myfunc returned "+myOneInt);

 

COBOL Example (myfunc.cbl)
 working-storage section.
 copy "javatypes.cpy".
 linkage section.
 01 a usage jint.
 procedure division using a.
 add 1 to a
 exit program returning 0.

 

cobcall

public static void cobcall(Object retCode,
                           String program,
                           Object[] array,
                           int[] usageDescription)
                    throws CobolException,
                           Exception
Calls a COBOL program with a set of parameters which returns an object * as a parameter

Parameters:
retCode - an Object that contains the return-code
program - a string
array - array of objects
usageDescription - array of usageDescriptions for array of objects
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall

public static int cobcall(String program,
                          ParameterList parameters)
                   throws CobolException,
                          Exception
Calls a COBOL program with a specifed ParameterList

Parameters:
program - a string
parameters - a ParameterList
Returns:
a integer return-code
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall

public static void cobcall(Object retCode,
                           String program,
                           ParameterList parameters)
                    throws CobolException,
                           Exception
Calls a COBOL program with a specifed ParameterList and updates a return-code object.

Parameters:
retCode - an Object that contains the return-code
program - a string
parameters - a array of parameters
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall

public static int cobcall(String program)
                   throws CobolException,
                          Exception
Calls a COBOL program with no parameters.

Parameters:
program - to call
Returns:
a integer return-code
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

ccall

public static void ccall(Object retCode,
                         String program,
                         Object[] array,
                         int[] usageDescription)
                  throws CobolException,
                         Exception
Calls a C function with a set of parameters which returns an object as a parameter

Parameters:
retCode - an Object that contains the return-code
program - a string
array - array of objects
usageDescription - array of usageDescriptions for array of objects
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

ccall

public static int ccall(String program,
                        Object[] array,
                        int[] usageDescription)
                 throws CobolException,
                        Exception
Calls a c function with a set of parameters which returns an object as a parameter

Parameters:
program - a string
array - array of objects
usageDescription - array of usageDescriptions for array of objects
Returns:
return-code
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobrcall

public static void cobrcall(Object retCode,
                            String program,
                            ParameterList parameters)
                     throws CobolException,
                            Exception
Calls a COBOL program with a set of parameters, then updates the retCode object with return-code

NB: This method allows the user to call legacy COBOL programs without requiring changes

Parameters:
retCode - an Object that contains the return-code
program - a string specifying the program name
parameters - a Parameter List
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

Example:
To call a COBOL program called "test" which accepts a single 30 byte record as input:
 Integer       rv   = new Integer();
 byte[]        arg1 = new byte[30];
 ParameterList pl   = new ParameterList().add(arg1);

 RuntimeSystem.cobrcall(rv, "test", args);
 


cobrcall

public static void cobrcall(Object retCode,
                            String program,
                            ParameterList parameters,
                            int srvCtl)
                     throws CobolException,
                            Exception
Calls a COBOL program with a set of parameters and server control flags, then updates the retCode object with return-code

NB: This method allows the user to call legacy COBOL programs without requiring changes

NB: Server control flags modify behaviour of runtime system to allow execution in context of a Java app server

Parameters:
retCode - an Object that contains the return-code
program - a string specifying the program name
parameters - a Parameter List
srvCtl - an bitwise-or of SRV_CTL_ values
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

Example:
To call a COBOL program called "test" which accepts a single 30 byte record as input:
 Integer       rv   = new Integer();
 byte[]        arg1 = new byte[30];
 ParameterList pl   = new ParameterList().add(arg1);

 RuntimeSystem.cobrcall(rv, "test", args, RuntimeSystem.getSrvCtlDefault());
 


cobcall_Object

public static void cobcall_Object(Object retValue,
                                  String program,
                                  Object[] array)
                           throws CobolException,
                                  Exception
Calls a COBOL program with a set of parameters, then it updates the retCode object with return-code.

Parameters:
retValue - an Object that contains the return-code
program - a string
array - array of objects
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobgetenv

public static String cobgetenv(String name)
                        throws CobolException,
                               Exception
Allows you to find a COBOL/System environment variable

Parameters:
name - A name specifying the environment variable to be searched for and returned.
Returns:
String
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: System.out.println("PATH is "+RuntimeSystem.cobgetenv("PATH"));

cobputenv

public static int cobputenv(String name)
                     throws CobolException,
                            Exception
Allows you to dynamically change the COBOL environment a Runtime

Parameters:
name - A string to placed into the environment, with the format NAME=VALUE
Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example:
RuntimeSystem.cobputenv("MYVAR=Hi");
System.out.println("MYVAR is "+RuntimeSystem.cobgetenv("MYVAR"));

cobclear

public static void cobclear()
                     throws CobolException,
                            Exception
Clears the screen and positions the cursor at line 0, column 0 strings.

Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: RuntimeSystem.cobclear();

cobaddstr

public static void cobaddstr(String name)
                      throws CobolException,
                             Exception
Displays the specified string on the screen at the virutal cursor's current position.

Parameters:
name - text to be displayed on the screen
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
xample: RuntimeSystem.cobaddstr("Hello world\n");

cobaddstr

public static void cobaddstr(int attribute,
                             String name)
                      throws CobolException,
                             Exception
Displays the specified string on the screen at the virutal cursor's current position.

Parameters:
attribute - screen attribute to display the text in
name - text to be displayed on the screen
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: RuntimeSystem.cobaddstr( RuntimeSystem.A_REVERSE, "Text in A_REVERSE");

cobgetch

public static char cobgetch()
                     throws CobolException,
                            Exception
Gets a character from the keyboard

Returns:
char
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example:To get a single character from the keyboard
char a=RuntimeSystem.cobgetch();

cobcols

public static int cobcols()
                   throws CobolException,
                          Exception
Returns the number of columns on the screen

Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: int cols=RuntimeSystem.cobcols();

coblines

public static int coblines()
                    throws CobolException,
                           Exception
Returns the number of lines on the screen

Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: int lines=RuntimeSystem.coblines();

cobmove

public static void cobmove(int y,
                           int x)
                    throws CobolException,
                           Exception
Move to the row, column on the screen

Parameters:
y - row
x - column
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: RuntimeSystem.cobmove(10,10);

cobrescanenv

public static int cobrescanenv()
                        throws CobolException,
                               Exception
Causes the Runtime to rescan the environment for COBOL environment strings.

Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcancel

public static void cobcancel(String program)
                      throws CobolException,
                             Exception
Causes the Runtime to CANCEL the program specified.

Parameters:
program - name of program to be CANCEL'ed
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception WARNING: Use with caution in a multi-threaded program.
Example: RuntimeSystem.cobcancel("myprog");

cobtidy

public static void cobtidy()
                    throws CobolException,
                           Exception
Causes the Runtime to tidy itself up. WARNING: No COBOL code should be called after the use of this method.

Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception
Example: RuntimeSystem.cobtidy(); System.exit(100);

cobthreadtidy

public static int cobthreadtidy()
                         throws CobolException,
                                Exception
Causes the COBOL thread associated with the currently running Java thread to be cleanly finalized.
NOTES:
The thread does NOT terminate, it's COBOL specific data areas are simply cleaned up.
If the Java thread can re-enters the COBOL runtime, these COBOL specific data areas will be reallocated.

Returns:
-1 for failure, 0 for success
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_int

public static int cobcall_int(String program,
                              Object[] array)
                       throws CobolException,
                              Exception
Calls a COBOL program with a set of parameters which returns a int

Parameters:
program - a string
array - array of objects
Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall

public static int cobcall(String program,
                          Object[] array)
                   throws CobolException,
                          Exception
Calls a COBOL program with a set of parameters which returns a int

Parameters:
program - a string
array - array of objects
Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_byte

public static byte cobcall_byte(String program,
                                Object[] array)
                         throws CobolException,
                                Exception
Calls a COBOL program with a set of parameters which returns a String

Parameters:
program - a string
array - array of objects
Returns:
byte return-code
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_boolean

public static boolean cobcall_boolean(String program,
                                      Object[] array)
                               throws CobolException,
                                      Exception
Calls a COBOL program with a set of parameters which returns a boolean

Parameters:
program - a string
array - array of objects
Returns:
boolean return-code
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_short

public static short cobcall_short(String program,
                                  Object[] array)
                           throws CobolException,
                                  Exception
Calls a COBOL program with a set of parameters which returns a short

Parameters:
program - a string
array - array of objects
Returns:
short
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_float

public static float cobcall_float(String program,
                                  Object[] array)
                           throws CobolException,
                                  Exception
Calls a COBOL program with a set of parameters which returns a float

Parameters:
program - a string
array - array of objects
Returns:
float
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_Integer

public static Integer cobcall_Integer(String program,
                                      Object[] array)
                               throws Exception,
                                      CobolException
Calls a COBOL program with a set of parameters which returns a Integer

Parameters:
program - a string
array - array of objects
Returns:
String
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_Byte

public static Byte cobcall_Byte(String program,
                                Object[] array)
                         throws Exception,
                                CobolException
Calls a COBOL program with a set of parameters which returns a Byte

Parameters:
program - a string
array - array of objects
Returns:
Boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_Boolean

public static Boolean cobcall_Boolean(String program,
                                      Object[] array)
                               throws Exception,
                                      CobolException
Calls a COBOL program with a set of parameters which returns a Boolean

Parameters:
program - a string
array - array of objects
Returns:
Boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_Short

public static Short cobcall_Short(String program,
                                  Object[] array)
                           throws Exception,
                                  CobolException
Calls a COBOL program with a set of parameters which returns a Short

Parameters:
program - a string
array - array of objects
Returns:
Short
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_Float

public static Float cobcall_Float(String program,
                                  Object[] array)
                           throws Exception,
                                  CobolException
Calls a COBOL program with a set of parameters which returns a Float

Parameters:
program - a string
array - array of objects
Returns:
Float
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobcall_String

public static String cobcall_String(String program,
                                    Object[] array)
                             throws Exception,
                                    CobolException
Calls a COBOL program with a set of parameters which returns a String

Parameters:
program - a string
array - array of objects
Returns:
String
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

updateParameters

protected void updateParameters(Object[] old,
                                Object[] update)
                         throws CobolException,
                                Exception
Method declaration

Parameters:
old -
update -
Throws:
CobolException
Exception

getCobolRuntimeSupportLibraryName

protected static String getCobolRuntimeSupportLibraryName()
Internal use

Returns:
filename to shared object/DLL name of native library to load.

cobassocclass

public static void cobassocclass(String fileName,
                                 Class javaClass)
Associates a Java class and COBOL class

Parameters:
fileName - file name of COBOL class
javaClass - Java class

cobassocclass

public static void cobassocclass(String fileName,
                                 String javaClass)
Associates a Java class and COBOL class

Parameters:
fileName - file name of COBOL class
javaClass - full name of Java class

cobloadclass

public static int cobloadclass(String libName,
                               String fileName)
Loads a COBOL library and/or a class within that library. Called in the static initializer for any class that inherits from RuntimeSystem. Used only if the full Java class name is identical to the COBOL file name

Example:
 static {
 cobloadclass("DllName", "MyCOBOLClass");
 }
 

Parameters:
libName - library name, if required
fileName - file name of COBOL class
Returns:
int - success value (0 for success)
See Also:
cobloadclass(String libName, String fileName, Class javaClass), cobloadclass(String libName, String fileName, String javaClassname)

cobloadclass

public static int cobloadclass(String libName,
                               String fileName,
                               Class javaClass)
Loads a COBOL library and/or a class within that library and associates it with a particular Java class. Called in the static initializer for any class that inherits from RuntimeSystem. Used when a non-default class loader loads the class.

Example:
 static {
 cobloadclass("DllName", "MyCOBOLClass", MyPackage.MyJavaClass.class));
 }
 

Parameters:
libName - library name, if required
fileName - file name of COBOL class
javaClass - Java class
Returns:
int - success value (0 for success)
See Also:
cobloadclass(String libName, String fileName), cobloadclass(String libName, String fileName, String javaClassname)

cobloadclass

public static int cobloadclass(String libName,
                               String fileName,
                               String javaClassname)
Loads a COBOL library and/or a class within that library and associates it with a particular Java class of a given name. Called in the static initializer for any class that inherits from RuntimeSystem.

Example:
 static {
 cobloadclass("DllName", "MyCOBOLClass", "MyPackage.MyJavaClass");
 }
 

Parameters:
libName - library name, if required
fileName - file name of COBOL class
javaClassname - full name of Java class
Returns:
int - success value (0 for success)
See Also:
cobloadclass(String libName, String fileName), cobloadclass(String libName, String fileName, Class javaClass)

cobload

public static int cobload(String libName)
Loads a COBOL library and makes visable any entry-points in the program
Note: Using a platform specific name/extension will cause portability issues

Parameters:
libName - library name of lbr/sl/so/int/gnt
Returns:
return-code

cobinvoke_boolean

public boolean cobinvoke_boolean(String methodName,
                                 Object[] params)
                          throws CobolException,
                                 Exception
Invokes a COBOL instance with a set of parameters returning a boolean

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_byte

public byte cobinvoke_byte(String methodName,
                           Object[] params)
                    throws CobolException,
                           Exception
Invokes a COBOL instance with a set of parameters returning a byte

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
byte
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_char

public char cobinvoke_char(String methodName,
                           Object[] params)
                    throws CobolException,
                           Exception
Invokes a COBOL instance with a set of parameters returning a char

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
char
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_short

public short cobinvoke_short(String methodName,
                             Object[] params)
                      throws CobolException,
                             Exception
Invokes a COBOL instance with a set of parameters returning a short

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
short
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_int

public int cobinvoke_int(String methodName,
                         Object[] params)
                  throws CobolException,
                         Exception
Invokes a COBOL instance with a set of parameters returning an int

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_long

public long cobinvoke_long(String methodName,
                           Object[] params)
                    throws CobolException,
                           Exception
Invokes a COBOL instance with a set of parameters returning a long

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
long
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_float

public float cobinvoke_float(String methodName,
                             Object[] params)
                      throws CobolException,
                             Exception
Invokes a COBOL instance with a set of parameters returning a float

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
float
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_double

public double cobinvoke_double(String methodName,
                               Object[] params)
                        throws CobolException,
                               Exception
Invokes a COBOL instance with a set of parameters returning a double

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_void

public void cobinvoke_void(String methodName,
                           Object[] params)
                    throws CobolException,
                           Exception
Invokes a COBOL instance with a set of parameters

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvoke_object

public Object cobinvoke_object(String methodName,
                               Object[] params)
                        throws CobolException,
                               Exception
Invokes a COBOL instance with a set of parameters returning an object

Parameters:
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
Object
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_boolean

public static boolean cobinvokestatic_boolean(Class classObject,
                                              String methodName,
                                              Object[] params)
                                       throws CobolException,
                                              Exception
Invokes a COBOL class with a set of parameters returning a boolean

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_byte

public static byte cobinvokestatic_byte(Class classObject,
                                        String methodName,
                                        Object[] params)
                                 throws CobolException,
                                        Exception
Invokes a COBOL class with a set of parameters returning a byte

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
byte
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_char

public static char cobinvokestatic_char(Class classObject,
                                        String methodName,
                                        Object[] params)
                                 throws CobolException,
                                        Exception
Invokes a COBOL class with a set of parameters returning a char

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
char
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_short

public static short cobinvokestatic_short(Class classObject,
                                          String methodName,
                                          Object[] params)
                                   throws CobolException,
                                          Exception
Invokes a COBOL class with a set of parameters returning a short

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
short
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_int

public static int cobinvokestatic_int(Class classObject,
                                      String methodName,
                                      Object[] params)
                               throws CobolException,
                                      Exception
Invokes a COBOL class with a set of parameters returning an int

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
int
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_long

public static long cobinvokestatic_long(Class classObject,
                                        String methodName,
                                        Object[] params)
                                 throws CobolException,
                                        Exception
Invokes a COBOL class with a set of parameters returning a long

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
long
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_float

public static float cobinvokestatic_float(Class classObject,
                                          String methodName,
                                          Object[] params)
                                   throws CobolException,
                                          Exception
Invokes a COBOL class with a set of parameters returning a float

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
float
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_double

public static double cobinvokestatic_double(Class classObject,
                                            String methodName,
                                            Object[] params)
                                     throws CobolException,
                                            Exception
Invokes a COBOL class with a set of parameters returning a double

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
boolean
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_void

public static void cobinvokestatic_void(Class classObject,
                                        String methodName,
                                        Object[] params)
                                 throws CobolException,
                                        Exception
Invokes a COBOL class with a set of parameters

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobinvokestatic_object

public static Object cobinvokestatic_object(Class classObject,
                                            String methodName,
                                            Object[] params)
                                     throws CobolException,
                                            Exception
Invokes a COBOL class with a set of parameters returning an object

Parameters:
classObject - the Java class
methodName - the method to invoke
params - an array of objects containg the method parameters
Returns:
Object
Throws:
CobolException - - COBOL Exception
Exception - - NON COBOL Exception

cobfinalize

public static void cobfinalize(Object o)
                        throws Throwable
Destroys a COBOL proxy object

Parameters:
o - an object which has a COBOL proxy associated with it
Throws:
Throwable - - throwable



Copyright © 2000 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.