Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Larry Weisberg Regular Contributor.
Regular Contributor.
139 views

automate mainframe connection with login and other commands

Jump to solution

Hi - I recently installed the Script Editor (ScriptEngine.msi) for Rumba 9.5.  I have available to me a .RSDM file which connects to a Mainframe.  After running that, I can record and then run a script to give the mainframe various command (logon/user/password/+ other commands specific to our mainframe's application). 

What I would like to have is a standalone script which I can run automatically every X minutes (e.g., via Windows scheduler, running something like "VSP.exe myScript.csf") which connects+logs on + runs 1-3 commands.  I would like to then be able to detect that all the steps worked, returned some expected text result from the mainframe, etc.

Can someone give me some ideas on how to combine the above into a single script?  (I was hoping to find the demo.csf after installing the Script Editor, but was unable to find it.  I am not sure if that would have helped anyway :-))

 

Thanks in advance,
Larry

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: automate mainframe connection with login and other commands

Jump to solution

Hi Larry,
you already described the basic steps to automate Rumba.
You need to modify and adjust the recorded script.

If you want to open a specific Rumba session you could use
EMStartSession "MyRumbaSession.rsdm","SESSION1"

Or configure your parameter in your code

EMSetTN3270 "yourMFhost.com",23,2,"ExtendedDS"
EMStartSession "*","3270"
'3270 session now active.
EMConnect "TELNET"

EMWaitCursor TimeOut ,19,45
If NM_ResultCode = 2 Then
Goto HandelError
End If

The HandelError could be a Function or Sub routine that logs the information into a File.


You can execute rumba csf scripts via the commandline
VSP.exe [-n -d -p -v -e -s -i] [yourScript.csf]

Option Description
-n Opens the Script Player in a normal window size. If the option is omitted, the Script Player opens minimized.
-d Opens the Script Player in debug mode. The Script Player window is normal size. If a filename.csf is specified, it is run.
-p Opens the Script Player in animate mode. The Script Player window is normal size. If a filename.csf is specified, it is run.
-v Variable predefinition.
-e Sets the active emulation (can be:Telnet, 3270, 5250).
-s Sets the active session.
-i Sets the active InstanceName. When using long instance names, include the name within quotes (").

You can use the windows task scheduler to start your script .

Sample scripts can be found under RUMBA\System\ScriptEngine\Scripts

3 Replies
Micro Focus Expert
Micro Focus Expert

Re: automate mainframe connection with login and other commands

Jump to solution

Hi Larry,
you already described the basic steps to automate Rumba.
You need to modify and adjust the recorded script.

If you want to open a specific Rumba session you could use
EMStartSession "MyRumbaSession.rsdm","SESSION1"

Or configure your parameter in your code

EMSetTN3270 "yourMFhost.com",23,2,"ExtendedDS"
EMStartSession "*","3270"
'3270 session now active.
EMConnect "TELNET"

EMWaitCursor TimeOut ,19,45
If NM_ResultCode = 2 Then
Goto HandelError
End If

The HandelError could be a Function or Sub routine that logs the information into a File.


You can execute rumba csf scripts via the commandline
VSP.exe [-n -d -p -v -e -s -i] [yourScript.csf]

Option Description
-n Opens the Script Player in a normal window size. If the option is omitted, the Script Player opens minimized.
-d Opens the Script Player in debug mode. The Script Player window is normal size. If a filename.csf is specified, it is run.
-p Opens the Script Player in animate mode. The Script Player window is normal size. If a filename.csf is specified, it is run.
-v Variable predefinition.
-e Sets the active emulation (can be:Telnet, 3270, 5250).
-s Sets the active session.
-i Sets the active InstanceName. When using long instance names, include the name within quotes (").

You can use the windows task scheduler to start your script .

Sample scripts can be found under RUMBA\System\ScriptEngine\Scripts

Larry Weisberg Regular Contributor.
Regular Contributor.

Re: automate mainframe connection with login and other commands

Jump to solution

Hi thanks for the information - it was very helpful, although my task is still a work in progress.  I have gotten the .csf and .rsdm files to work together.  But I am still:

  1. playing with having it run completely from the command line using vsp.exe - I think I've gotten past this.  It appears that if the .csf file has a space in the name, and then you use "" around the name, it diesn't automatically load the csf.  Easily remedied 🙂
    Although I think if I want to use from the windows scheduler, I'd still prefer that it doesn't bring up the Script dialog, even as minimized.  I'd like it to run like a console app, not a windows app...
  2. The other thing that I haven't yet investigated, is, as a result of the success/failure of the script, to have an email sent or maybe a log added to a SQL Server database.  I think maybe there is a sample code for this, but I haven't yet investigated this further.

 

Thanks again!

Larry

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: automate mainframe connection with login and other commands

Jump to solution

Hi Larry,

I'm using RUMBA 10 and I can run the script from the command line even with spaces.
e.g: "C:\Micro Focus\RUMBA\System\ScriptEngine\vsp.exe -h" c:\tmp\test test.csf

To hide the script player completly you can use some standard windows api function
Following a small example: Windows show Windows API reference : https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow


example code: hides the Rumba script player
'-------------------------------------------------------------------------------------------------------------------------------------------
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdSHow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub Main

SysHide "Timer"

CONST SW_HIDE = 0

Dim retval
'hides the Rumba script player
retval = apicShowWindow("AfxFrameOrView140", "Script Player",SW_HIDE)

Emulation "TN3270"
Dim Timeout As Integer
Dim Result As Integer
Dim Row As Integer
Dim Col As Integer
Dim Password As String
Dim DataArr(1) As String
Timeout=60
EMSendKey "cics"

EMSendKey "<Enter>"
EMSendKey "1111111111"
EMSendKey "<Enter>"
Stop
HandleError:
Print "Error receiving text or cursor position. Script terminated."
End Sub

 

Function apicShowWindow(strClassName As String, strWindowName As String, lngState As Long)

'Get window handle.
Dim lngWnd As Long
Dim intRet As Integer
lngWnd = FindWindow(strClassName, strWindowName)
apicShowWindow = ShowWindow(lngWnd, lngState)

End Function


Function apicFindWindow(strClassName As String, strWindowName As String)

'Get window handle.
Dim lngWnd As Long
apicFindWindow = FindWindow(strClassName, strWindowName)

End Function

'-------------------------------------------------------------------------------------------------------------------------------------------

I recommand to take a look into the VBA-Addon for Rumba:
https://www.microfocus.com/documentation/rumba/desktop951/pdfdoc/MicroFocusVBAAdd-OnforRumba+DesktopQuickStartGuide.pdf

The VBA-Addon provides the Microsoft Visual Basic for Applications Editor to develop script.
With the Addon you now can automate RUMBA from any other third party Application or via VBScript.

 

regards

/andree

 

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.