in reply to Interact with mainframe screen
I automate 3270 applications from Perl by using the IBM Personal Communications 3270 terminal emulator on Win32 via Win32::OLE. It is very well documented and it works very good.
As an alternative if you are not on Win32, consider looking into s3270 resp. x3270 for automating your program, but these do not provide the good API that IBM does.
Here is a short extract I use to initialize and start a session:
package Host::PCOM; use strict; use Carp qw(croak carp); use Logger; use Win32; use Win32::OLE; Win32::OLE->Option( Warn => 3 ); sub new { my ($class,$connection_name) = @_; my $self = {}; bless $self, $class; $self->log("Creating connection manager"); my $connmgr = Win32::OLE->new("PCOMM.autECLConnMgr") or die "Couldn't create PCOMM.autECLConnMgr : $!\n"; $self->log("Creating session"); my ($session) = Win32::OLE->new("PCOMM.autECLSession") or die "Couldn't create PCOMM.autECLSession $!\n"; # Now connect the session my $session_info; $session_info = $connmgr->{autECLConnList}->FindConnectionByName($co +nnection_name); unless ($session_info) { $self->log("Personal Communications not found running. Starting se +ssion"); #my $hostname = Win32::NodeName; my $hostname = 'WSConfig'; $connmgr->StartConnection("profile=$hostname connname=$connection_ +name"); my ($count) = 20; while (! $session_info and $count--) { $connmgr->{autECLConnList}->Refresh(); $session_info = $connmgr->{autECLConnList}->FindConnectionByName +($connection_name); #sleep(2); select undef, undef, undef, 0.5 unless $session_info; }; sleep(5); }; die "Couldn't find or start session $connection_name\n" unless $session_info; $session->SetConnectionByHandle( $session_info->{Handle} ); my $ECLOIA = $session->autECLOIA(); die "Couldn't get ECLOIA : $!" unless $ECLOIA; my $ECLPS = $session->autECLPS(); while (! $session->Started) { $ECLPS->Wait(500); }; if (! $session->CommStarted) { $session->StartCommunication; while (! $session->CommStarted) { $ECLPS->Wait(500); }; }; $self->{conn} = $connmgr; $self->{session} = $session; $self->{ecloia} = $ECLOIA; $self->{eclps} = $ECLPS; $self; }; ... much domain specific code following which I won't post ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Interact with mainframe screen
by jeepj (Scribe) on Mar 05, 2008 at 11:42 UTC | |
Re^2: Interact with mainframe screen
by huzeh (Initiate) on Jun 30, 2007 at 09:25 UTC | |
by Corion (Patriarch) on Jun 30, 2007 at 13:25 UTC | |
by shmem (Chancellor) on Jun 30, 2007 at 14:09 UTC | |
by Corion (Patriarch) on Jun 30, 2007 at 14:14 UTC | |
Re^2: Interact with mainframe screen
by Anonymous Monk on Apr 20, 2007 at 13:39 UTC | |
Re^2: Interact with mainframe screen
by Anonymous Monk on Apr 20, 2007 at 13:53 UTC | |
by Corion (Patriarch) on Apr 20, 2007 at 14:04 UTC | |
by notveryperlish (Initiate) on Jun 13, 2007 at 14:21 UTC | |
by Corion (Patriarch) on Jun 13, 2007 at 14:31 UTC | |
by notveryperlish (Initiate) on Jun 13, 2007 at 14:55 UTC | |
| |
by Anonymous Monk on Apr 20, 2007 at 14:57 UTC | |
by BrowserUk (Patriarch) on Apr 20, 2007 at 15:40 UTC | |
Re^2: Interact with mainframe screen
by Anonymous Monk on Jun 26, 2007 at 15:00 UTC |