INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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.

Jobs

VBA and Custom Functions

Can data from an Attachemate EXTRA! (CICS) session screen be captured directly into an MS Access database? by CautionMP
Posted: 20 Dec 03 (Edited 3 Dec 05)

Working in an environment that uses mainly "mainframe" applications that use a terminal emulator to attach to I developed this Class module to scrape data from the session screen which I then have several MS Access routines that I use to normalize the data for importing data into MS Access tables. Because I know that I am not the only developer in this situation I thought I would post this code.

This module will require a reference to the Attachmate EXTRA! 6.5 Object Library to work.

CODE

Option Compare Database
Option Explicit

Dim objExtraSystem As ExtraSystem
Dim objExtraSessions As ExtraSessions
Dim objExtraSession As ExtraSession
Dim objExtraScreen As ExtraScreen
Dim objExtraArea As ExtraArea

Private Sub Class_Initialize()
'Connect to an active Extra instance

Set objExtraSystem = CreateObject("Extra.System")
If objExtraSystem Is Nothing Then
    MsgBox "Could not create an Extra System Object" & Chr(13) & "because there is no mainframe session open", vbCritical, "Capture Error"
    Exit Sub
End If
'Establish a Sessions collection for objExtraSystem

Set objExtraSessions = objExtraSystem.Sessions
If objExtraSessions Is Nothing Then
    MsgBox "Could not create an Extra Sessions Object"
    Set objExtraSystem = Nothing
    Exit Sub
End If
'Append objExtraSystem.ActiveSession to objExtraSessions

Set objExtraSession = objExtraSystem.ActiveSession
If objExtraSession Is Nothing Then
    MsgBox "Could not create an Extra Session object"
    Set objExtraSessions = Nothing
    Set objExtraSystem = Nothing
    Exit Sub
End If
If Not objExtraSession.Visible Then objExtraSession.Visible = True
'Establish a Sreen Object

Set objExtraScreen = objExtraSession.Screen
If objExtraScreen Is Nothing Then
    MsgBox "Could not create an Extra Screen object"
    Set objExtraSession = Nothing
    Set objExtraSessions = Nothing
    Set objExtraSystem = Nothing
    Exit Sub
End If
End Sub

Private Sub Class_Terminate()
Set objExtraSession = Nothing
Set objExtraSessions = Nothing
Set objExtraSystem = Nothing
End Sub

Public Property Get ConnectionDetails() As String
Dim strTestResult As String
strTestResult = "Extra System Object " & objExtraSystem.Name & Chr(13)
strTestResult = strTestResult & "Extra Sessions Object " & objExtraSessions.Count & Chr(13)
strTestResult = strTestResult & "Extra Session Object " & objExtraSession.FullName
ConnectionDetails = strTestResult
End Property

Public Sub MoveNext()
objExtraScreen.SendKeys ("<Home>")
objExtraScreen.WaitHostQuiet (0)
'In my world F8 scrolls down so 1<PF8> will scroll 1 line

objExtraScreen.SendKeys ("1<PF8>")
objExtraScreen.WaitHostQuiet (0)
End Sub

Public Property Get CurrentLineText(StartRow As Integer, StartColumn As Integer, StopRow As Integer, StopColumn As Integer) As String
Set objExtraArea = objExtraScreen.Select(StartRow, StartColumn, StopRow, StopColumn)
CurrentLineText = objExtraArea.Value
End Property

Public Property Get SessionActive() As Boolean
If objExtraSystem Is Nothing Then
    SessionActive = False
ElseIf objExtraSessions Is Nothing Then
    SessionActive = False
ElseIf objExtraSession Is Nothing Then
    SessionActive = False
Else
    SessionActive = True
End If
End Property

Public Property Get HostBusy() As Boolean
If objExtraScreen.OIA.XStatus = 5 Then
    HostBusy = True
Else
    HostBusy = False
End If
End Property

This code is still changing (evolving) and if you find this useful I have a series of routines written specifically for the Computer Associates "View" facility for capturing archived reports (primarily from AFS Level III).

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

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