AMT Help Files

COM Connection Interface

This section describes the functions and properties of the AMT COM connection object. This object encapsulates the connection to AMT-COBOL and the current transaction, which is the last transaction sent from the transaction server to the client application.

The following functionality is provided:

Properties

Name Type Access Description
ActiveFormName String Read/Write Name of the active form. If you write a new value, it becomes the active form and is sent on the next transmit.
ApplicationName String Read-only The name of the application.
AverageResponseTime Integer Read-only The average response time of transactions.
BaseAddress String Read/Write The base address of the transaction server to which the AMT COM Module will connect to. This property has to be set before the connection can be made.
CleanupStationSessions Boolean Read/Write Please only use this property in cases where there will only be a single station connected to the application. This property, when set to True, will clear older "hanging" sessions upon connecting.
Connected Boolean Read-only Will be True if the AMT COM module is connected to the transaction server.
Cursor String Read/Write The name of the control item where the cursor is positioned.
DebugMode Boolean Read/Write

Enables debug mode in the COM module, which allows you to debug transactions from the COM module in the AMT debugger.
The user name in the COM module connection must match the AMT debugger user name.
Set this property before OpenSession is executed. The default value is false.

DefaultLanguage String Read-only The default language of the connected application.
DisplayFieldCount Integer Read-only The number of layout controls of the current form.
FieldCount Integer Read-only The number of fields of the current form.
FilterHighlighters Boolean Read/Write Switch that determines whether the layout controls are returned with highlighters or not.
FormCount Integer Read-only The number of forms that the user can access by Page2Recall.
IgnoreReadOnly Boolean Read/Write If set to "True", the ReadOnly status of controls is ignored.
Language String Read/Write The current set language for the application.
LastError ResponseCode Read-only The last error after executing a function.
ListCount Integer Read-only The number of items in the current list.
LogFileName String Read-only The name of the log file, if it is enabled.
LogLevel LogLevelCode Read-only Contains the log level: 0 = no logging, 1 = log errors, 2 = log all.
NoErrors Integer Read-only The number of errors in the error buffer after a transaction.
NoSessionData Boolean Read/Write If set to True, the session data will not be saved.
ResponseTime Integer Read-only The last response time of the form transaction in milliseconds.
StationName String Read/Write The name of the station.
StatusLine String Read-only The current status line.
Timeout Integer Read/Write The Receive timeout of the BasicHttpBinding.
UserName String Read/Write The user name of the client connection. The default is the Windows user who runs the client program.

Functions

Function name Return type Parameters Description
Name Type
CloseSession Void --- Closes the session to the transaction server.
DisableLogging Void --- Disables logging of transactions.
EnableLogging Boolean LogLevel LogLevelCode

Enables logging with a set LogLevel to the given FileName.

For the values of LogLevelCode, see COM Constants.

FileName String
ExecuteProgram String Program String Execute a program with parameters without GUI returning the result.
Parameters String
FormDescription String Index Integer Returns the description of the form specified by Index.
FormName String Index Integer Returns the name of the form specified by Index that the client application can call with Page2Recall. See also the FormCount property.
FormText String --- Returns all the field names and values as a single string separated by '@@' separator sequences.
GetCommArea String --- Retrieve the Communication area data used by transactions in an IBM CICS migrated environment.
GetDisplayField IAmtField Object Index Integer

Returns the DisplayField for the specified Index.
If no field is found, null will be returned.

GetError String ErrorNo Integer Returns the description of the error specified by ErrorNo in the error message buffer.
GetFieldByIndex IAmtField Object Index Integer

Returns the AMT Field object for the field specified by Index.
If no field is found, null will be returned.

GetFieldByName IAmtField Object FieldName String

Returns the AMT Field object for the field specified by field name.
If no field is found, null will be returned.

OpenSession ResponseCode --- Opens a session to the transaction server and returns the response code of the operation.
OpenSession ResponseCode ApplicationName String

Opens a session to a specific transaction server and returns the response code of the operation.
An endpoint with this name must be present in the config file.

Page2Recall Boolean FormName String Tries to perform a transaction for the specified form name as transaction code. Returns True on success and False on failure.
SetCommArea Void CommArea String Set the Communication area data to use for transactions in an IBM CICS migrated environment.
SetFieldValue Void FieldName String Sets the value of the field specified by field name to the specified value.
Value String
SetKeyPressedValue Void Value String

Sets the key pressed value to imitate the usage of certain attention and function keys.
Possible values: ENTER, CLEAR, PA1 - PA3, PF1 - PF24. Other values will be ignored.

Shutdown Void --- Shutdown COM Module Environment.
Transmit ResponseCode --- Transmit the current active form to the transaction server and returns the response code of the operation.
VersionNumber String --- Returns the full AMT version number, including the patch and fix numbers.
WriteToLog Void MsgText String Write the text specified to the log file.

Event handlers

The AMT COM connection events are exposed as an event interface, which means that the AMT COM connection can raise events.

Name Description
OnBye Event raised when the transaction server executes RECALL(BYE). The connection to the transaction server is then closed.
OnErrorResponse Event raised when an error occurs. The error message can be queried with NoErrors and GetError.
OnFormResponse Event raised when the transaction server returns its message to the COM module. All fields are filled at that moment.
OnSessionClosed Event raised when the connection between the transaction server and COM module is closed.

Contents