Skip to main content

Thanks to Andree!!!  I have made a fair amount of progress in writing a .csf script which connects, and then logs on, issues a command, disconnects, and logs a line to a log file.  If any of the steps fail, then the HandleError is called, and logs the error, including potentially the error that appears on line 24 of the screen, returned from the mainframe.

However, there is still a case that I cannot see how to "trap" and log.  The first line of my script is EMStartSession calling a .rsdm profile.  If, e.g., while in the debugger, I disconnect the network cable as the EMStartSession is executing, I get the below WinSock 10065 error pop-up.  However, the script seems to continue, and just times out every step along the way.

Since I will ultimately run the script from the Windows Scheduler, I would like:

1. To ensure that there is no pop-up and

2. to be able to catch the winsock error (or any other error/failure), log the error, and exit the script.

 

Is there a way to do this?

 

Thanks,

Larry


#Rumba

Thanks to Andree!!!  I have made a fair amount of progress in writing a .csf script which connects, and then logs on, issues a command, disconnects, and logs a line to a log file.  If any of the steps fail, then the HandleError is called, and logs the error, including potentially the error that appears on line 24 of the screen, returned from the mainframe.

However, there is still a case that I cannot see how to "trap" and log.  The first line of my script is EMStartSession calling a .rsdm profile.  If, e.g., while in the debugger, I disconnect the network cable as the EMStartSession is executing, I get the below WinSock 10065 error pop-up.  However, the script seems to continue, and just times out every step along the way.

Since I will ultimately run the script from the Windows Scheduler, I would like:

1. To ensure that there is no pop-up and

2. to be able to catch the winsock error (or any other error/failure), log the error, and exit the script.

 

Is there a way to do this?

 

Thanks,

Larry


#Rumba

I see your point Larry.
The Rumba script engine doesn't support Events, that would made it  very easy to implement.
You may want to check for any VBA Windows API.

The RUMBA VBA Macro-Addon supports Events and comes with OnConnectionStateChange Method.
The method is triggered as soon the connection state changes.

Syntax
Void OnConnectionStateChange(RumbaConnectionState oldState, RumbaConnectionState newState)
Old state and new state can be one of the following:
RumbaConnectionState_Disconnected = 0
RumbaConnectionState_BeforeConnect = 1
RumbaConnectionState_Connected = 2
RumbaConnectionState_BeforeDisconnect = 3

/andree


I see your point Larry.
The Rumba script engine doesn't support Events, that would made it  very easy to implement.
You may want to check for any VBA Windows API.

The RUMBA VBA Macro-Addon supports Events and comes with OnConnectionStateChange Method.
The method is triggered as soon the connection state changes.

Syntax
Void OnConnectionStateChange(RumbaConnectionState oldState, RumbaConnectionState newState)
Old state and new state can be one of the following:
RumbaConnectionState_Disconnected = 0
RumbaConnectionState_BeforeConnect = 1
RumbaConnectionState_Connected = 2
RumbaConnectionState_BeforeDisconnect = 3

/andree

Thanks Adree... I will try to look into that, although I seem to recall that the Macro-Addon is a separate package that we don't have a license for ?  Is that possible?

In any event, I was trying something else, as follows, and ran into an issue (although it could be that it is not a worthwhile direction to head into in any case ...):

Given some of the information provided in a different thread (TLS 1.2 using Rumba) I thought that maybe using an rsdm profile for the EMStartSession argument, was preventing the ability to catch the WinSock error.  I also wanted to see if using the "NMSecurityBase.Factory4" traceLevel might give me some debug logs...  In any case, I replaced:

EMStartSession "MyProfiler.rsdm","3270"

with:

EMSetTN3270 "1.2.3.4", 11003, 2, "ExtendDS"   '  Set host connection - our MainFrame's port of 11003
EMStartSession "*", "My3270" ' Connect to host
EMConnect "TELNET"

Now the EMStartSession gives me the following:

clipboard_image_0.png


I see your point Larry.
The Rumba script engine doesn't support Events, that would made it  very easy to implement.
You may want to check for any VBA Windows API.

The RUMBA VBA Macro-Addon supports Events and comes with OnConnectionStateChange Method.
The method is triggered as soon the connection state changes.

Syntax
Void OnConnectionStateChange(RumbaConnectionState oldState, RumbaConnectionState newState)
Old state and new state can be one of the following:
RumbaConnectionState_Disconnected = 0
RumbaConnectionState_BeforeConnect = 1
RumbaConnectionState_Connected = 2
RumbaConnectionState_BeforeDisconnect = 3

/andree

Hi Andree - I was able to install the Macro AddOn.   I am now trying to use the OnConnectionStateChange method/event form within a script, but am unsure how to proceed.  Do you have any simple example of what this would look like?  Or did I misunderstand and the AddOn can only be used with Macros, but not inside a script?

 

TIA,

Larry


Hi Andree - I was able to install the Macro AddOn.   I am now trying to use the OnConnectionStateChange method/event form within a script, but am unsure how to proceed.  Do you have any simple example of what this would look like?  Or did I misunderstand and the AddOn can only be used with Macros, but not inside a script?

 

TIA,

Larry

Hi Larry,
with the VBA Macro Addon you don't need the script engine.
Recorded VBA Macros are saved within the RUMBA Session File no need for a separate file.
The power of VBA Macros is you can automate rumba from thrird party applications (eg. Excel) or via VBScript.

VBA Macro example:

Sub navigate()
Dim session As RumbaEmulationSessionObject: Set session = CurrentSessionObject
session.Connect
WaitScreen session, "Command --> ", SearchOnlyAt, False, DefaultConnectionTimeout, 22, 1, 22, 13
session.TypeText "cics"
session.SendKey "Enter"
WaitScreenTimeout session, DefaultScreenTimeout
session.SendKey "Clear"
WaitScreenTimeout session, DefaultScreenTimeout
session.TypeText "tele"
session.SendKey "Enter"
WaitScreen session, "Account Number : ", SearchOnlyAt, False, DefaultScreenDataTimeout, 6, 26, 6, 44
session.TypeText "1111111111"
session.SendKey "Enter"
End Sub


Private Sub RumbaEmulationSessionObject_OnConnectionStateChange(ByVal oldState As Long, ByVal newState As Long)
Debug.Print ("newState: " & newState & " oldState: " & oldState)
If newState = 2 Then
Call navigate
End If

End Sub

2019-10-24_211934.png