CVM Class

CVM is a Java class representing the ACUCOBOL-GT runtime. The CVM class exposes public methods for setting runtime options, calling and cancelling programs, getting object libraries, and much more.

The following table contains a description of each method. Please note that the get method returns the current value of a particular property or string. The set method sets the string or property value. For example, "setErrorsOut" sets the name of the file to which to send error messages, and "getErrorsOut" returns the filename that is currently set for the error log.

Boolean properties like TerminalInit are set to false by default. If you want to set a boolean property to true, then you call the set method for that property. For example, TerminalInit is set to false by default, meaning that terminal initialization is not inhibited. If you want to inhibit terminal initialization, set TerminalInit to true by calling "setTerminalInit" passing in true. Call "getTerminalInit" to see what boolean value is currently set for this property.

Public Method Description
initialize( RT_OPTS options ) Initializes the ACUCOBOL-GT CVM
initialize( String cmdLine ) Initializes the CVM with command-line options
callProgram( String name, Object params[ ], CALL_OPTIONS options )         Calls the named COBOL program using specified parameters and program options
cancelAllPrograms() Cancels all programs
cancelProgram( String name ) Cancels the named program and holds it in memory
unloadAllPrograms() Empties memory of all programs
unloadProgram( String name ) Empties memory of the named program
shutdown() Shuts down the CVM
CVM GET_INSTANCE() Returns the instance of the CVM in this process
CVM GET_INSTANCE( String logPropertiesFile ) Specify a Java String that is the name of the logging properties file. This enables you to use a different file which is not the default Java logging properties file.
CVM GET_INSTANCE( String logPropertiesFile, String libLoc, String ext ) The first String parameter has the same meaning as the previous GET_INSTANCE. The second String parameter is the location of the Acu shared libraries. On windows, this is where the acu dlls are installed ( "c:\Program Files\Acucorp\Acucbl810\AcuGT\bin. The third parameter is the extension of the shared libraries — on Windows the extension is ".dll", on Linux it is ".so", and on some versions of HP-UX it is ".sl".
setLog( Logger log) Overrides the default log with a user-specified log
StatusInfo GetStatusInfo() Checks the status of a called COBOL program that has finished running. Use StatusInfo as follows:
class StatusInfo {
  public long cobol_return_code;
  public int exit_code;
  public int signal_number;
  public int call_error;
  public String exit_msg;};
getCVMError() Gets the last error message of the CVM object class
getLastErrorMsg() Returns the last error message string from the runtime
get/setSwitches() Gets or sets the list of Special Names switches to turn on
get/setConfigFile() Gets or sets an alternate configuration file
get/setErrorsOut() Gets or sets an error messages file
get/setErrorsAppend() Gets or sets a file to append error messages to
get/setKeyFile() Gets or sets a keyboard input file
get/setImport() Gets or sets a variable for importing graphical screens
get/setPlays() Gets or sets a file of input keystroke scripts
get/setDisplayOut() Gets or sets a file for display output
get/setDisplayAppend() Gets or sets a file to append display output
get/setDebugCmds() Gets or sets a file containing debugger commands
get/setTerminalOut() Gets or sets a file to capture terminal output
get/setObjLib() Gets or sets an object file library
get/setEmbeddedLib() Gets or sets a configuration file from a COBOL object library
get/setTerminalInit() Inhibits terminal initialization
get/setCGIWarnings() Suppresses warning messages in CGI programs
get/setIgnoreSignals() Ignores terminal hang-up signals
get/setListConfig() Lists contents of the configuration file
get/setNoSaveDebug() Prevents the debugger from reading and writing adb
get/setSafeMode() Runs in safe mode
get/setNonNumeric() Suppresses warnings when non-numeric data is used as numeric data
get/setExtendedError() Displays extended error codes for file error "30"
get/setDumpMem() Dumps memory for memory access violations
get/setThrowErrors() Displays error message text in a MessageBox
get/setCharToGui() Converts character screens to GUI equivalent
get/setZipErrorFile() Compresses the error file
get/setLinkageLength() Disables Linkage item length test
getNoSignalHandlers() and setNoSignalHandlers(boolean value) setNoSignalHandlers sets or suppresses the --no-signal-handlers switch during runtime initialization. When set, this switch prevents the runtime's signal handlers from being enabled. (In some cases the runtime's signal handlers may interfere with the expected Java signal handlers, causing unexpected behavior.)

This switch is off by default; therefore, use the following to set it, before CVM.initialize() is called:

CVM.setNoSignalHandlers(true);

getNoSignalHandlers returns the current value of the switch.

To set options in the CVM class (that is, to set runtime options), use the specific "setOption" method such as "setConfigFile" and the value to set. You can also call "setOption" with the option name passed as a string.

Call "cvm.initialize" after setting options. After "initialize" is called, setting options has no effect until you call "initialize" again.