Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to determine session name in Extra! attachmate

Status
Not open for further replies.

yarnseeker

Programmer
Apr 12, 2002
10
US
I have a bunch of macros written by our business folks and one of the issues that I would like to solve with these is that they do not tell you which session or environment they ran in at execution.

I need to be able to find the name of the active session...not the name of the entire extra emulator session but like CICS production vs CICS test vs TSO session names w/in the extra attachmate session.

Does anybody know how to do this?
 
Kind of long, but I run this through an access data base to break down which sess. vs. which control entity was needed. Then wrote this code to go in check and back out. Hope this helps...

Sub Main()
'--------------------------------------------------------------------------------

Dim Sys As Object, Sess As Object
Dim Conn As Object, RS As ADODB.Recordset, DB As Object, Sql As String, DLR As String

Set Sys = CreateObject("Extra.system")
Set Sess = Sys.ActiveSession

Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.Recordset")


'******* You will need to change your DB address and SQL to match you path, database and table name


Set DB = CurrentDb

Sql = "Select * from Closed_Macro_Q ORDER BY Sess_Ltr, comp, DLR_NBR;"
Set Conn = Application.CurrentProject.Connection

RS.Open Sql, Conn





' Get the main system object
Dim Sessions As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If
Set Sessions = System.Sessions

If (Sessions Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 750 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Get the necessary Session Object
Dim Sess0 As Object

Dim MyScreen As Object
Dim MyArea As Object
Dim TotCL As Double
Dim RunCL As Double
Dim LnCL As Double
Dim ROWX As Integer
Dim DLR_Nbr As String
Dim Sess_Ltr As String
Dim Comp As String
Dim Sess_Ltr_Prior As String
Dim Prior_comp As String
Dim WF_comment As String
Dim Lockton_Flag As String




Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

'=======================================================
'Section determines which session to go to based on the

' Initialize Sess_Ltr

Sess_Ltr_Prior = "z"
Prior_comp = RS.Fields("Comp")

Do Until RS.EOF

Comp = RS.Fields("Comp")
Sess_Ltr = RS.Fields("Sess_Ltr")
DLR_Nbr = RS!DLR_Nbr
WF_comment = RS!WF_comment




If Sess_Ltr <> Sess_Ltr_Prior Then


Sess0.Screen.SendKeys ("<Pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

'Determine the moveto screen location based on the session required. Macro is designed with only different sessions


If Sess_Ltr = "A" Then
Sess0.Screen.MoveTo 8, 4
Else
If Sess_Ltr = "B" Then
Sess0.Screen.MoveTo 9, 4
Else
Sess0.Screen.MoveTo 10, 4
End If
End If
'Cursor is now in the correct position for selection

Sess0.Screen.SendKeys ("S")
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)



'We are now at the AIMS Main Menu

Sess0.Screen.SendKeys ("01")
Sess0.Screen.SendKeys ("<EraseEOF>")
Sess0.Screen.PutString Comp
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)


Else
End If

'====================== Company comparison ===============================

If Comp <> Prior_comp Then

Sess0.Screen.SendKeys ("<Pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Pf3>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("01")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<EraseEOF>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.PutString Comp
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("01")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("C")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

Else
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top