Of course. I do that all the time at my company (no telnet access for me)
#!/usr/bin/perl use IPC::Open2; use POSIX ":sys_wait_h"; open PASS, "< /etc/passgmc"; while (<PASS>) { chop ($_);($user,$password)=/(.*)\:(.*)/;} close PASS; if (length($user)<8) {$user.="\\t";} select((select(STDOUT), $|=1)[0]); $pid = open2(*CHILD_OUT, *CHILD_IN, 's3270 myhost.mycompany'); print CHILD_IN "Ascii\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } print CHILD_IN "String $user$password\\n\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } print CHILD_IN "Ascii\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } print CHILD_IN "String heythisisacommand\\n\\nLGCA\\n\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } #let's send some input to the app while (<>) { $inicio=time; chop $_; $myinput=$_; print CHILD_IN "String ".$myinput."\\t\\t\\t\\t\\tX\\n\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } print CHILD_IN "Ascii\n"; while (<CHILD_OUT>) { #let's look for something in the output if (/NOT FOUND/) { $k="K0000"; $desc="NOPE"; } if (/CODE..:.(K....).(.*)/) {$k=$1;$desc=$2;} last if /ok/; } print $myinput." ".$k." ".$desc."\n"; print STDERR $myinput." ".$k." ".$desc."\n"; #let's go to the previous screen if (not ($k eq "K0000")) { print CHILD_IN "String \\pa1\n"; while (<CHILD_OUT>) { #print $_; last if /ok/; } } # print CHILD_IN "\cD"; # print time-$inicio."\n"; } close CHILD_IN; close CHID_OUT; kill 9,$pid; waitpid $pid,0;

In reply to Re^2: How do i interact with a ibm 3270 mainframe? by faibistes
in thread How do i interact with a ibm 3270 mainframe? by pedrosantos

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.