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 ...
In reply to Re: Interact with mainframe screen
by Corion
in thread Interact with mainframe screen
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |