The above code is only the package to launch the connection to the 3270 window, not to give any input to it. I recommend that you read the documentation that accompanies IBM Personal Communications to find out how to automate stuff within it. I won't post my complete code as much of it belongs to my employer I guess. You will then need to employ the methods to read what is on the screen and which fields are available for input. For example, I have the following subroutine in Host::PCom:
sub screen {
my ($self) = @_;
my ($cols,$rows) = ($self->cols,$self->rows);
my ($line) = $self->eclps->GetTextRect(1,1,$rows,$cols);
my @lines;
while ( $line =~ s/(^.{1,$cols})//sm) {
push @lines, $1;
};
s!\0! !g
for @lines;
# Mark fields as dirty
$self->log("Fields marked dirty");
$self->{fields} = undef;
push @lines, $line if $line;
@lines;
};
It returns the current screen (resp. a cached version of it) as a list of scalars which my programs then check. I also have two routines for getting and setting input fields:
sub get_set_field {
my $self = shift;
my $field = shift;
my $result;
if (defined wantarray) {
$result = $field->GetText();
$self->log("value is $result");
carp( "get_set_field() called in void context without a value",2 )
+ unless @_;
};
if (@_) {
$field->SetText(@_);
$self->log("Setting field to @_");
};
$result;
};
sub field_by_index {
my $self = shift;
my $index = shift;
my @fields = $self->fields;
my $field = $fields[ $index ];
$self->get_set_field($field,@_);
};
|