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,@_); };

In reply to Re^3: Interact with mainframe screen by Corion
in thread Interact with mainframe screen by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.