×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to determine session name in Extra! attachmate

how to determine session name in Extra! attachmate

how to determine session name in Extra! attachmate

(OP)
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?

RE: how to determine session name in Extra! attachmate

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close