From: Theisen, G. <gar...@ed...> - 2003-08-08 18:30:01
|
Hi all, I've been searching/reading for a solution for the following: I'm on a WinNT box with IIS webserver using PHP. I'm trying to make a connection to a mainframe os/390 to be able to "browse" a VSAM file and = load an array with data that I need. I can currently log into the mainframe using a JAVA telnet client tn3270, and can use PHP (or PERL) to FTP = test files. FTP is out of the question since this file I need to work with = is enormous. I'm working on calling a PERL script (from my PHP web script), to = "create behind the scenes" a telnet session into the mainframe to begin work on = the file. I've tried Net::Telnet, but w/no success. The problem is I'm on = a winNT box. The code is below. The output is cryptic, and nothing I = can read so there is a communication/protocol problem with what the = mainframe is expecting/receiving (I think). I've just found out about IO::Tty and IO::Pty. But don't want to spin = my wheels for another week. Has anyone out there successfully used any of those PERL modules to connect (automatically...w/o direct user input = like a terminal) to a mainframe from a WinNT box? Any help/pointers/directions = to tutorials would be greatly appreciated! Gary use Net::Telnet; # Config Variables #$host =3D @ARGV[0]; #$user =3D @ARGV[1]; #$pass =3D @ARGV[2]; $host =3D "mainframe.com"; $user =3D "user"; $pass =3D "pass"; $secs =3D 10; $command =3D open (SOLRPT, "user.test.solrpt"); $command .=3D $solrpt =3D <SOLRPT>; $command .=3D close(SOLRPT); # debug log of data sent to host. $dumplog =3D 'i:/perl/dumplog.txt'; # debug log of data received from host. $inputlog =3D 'i:/perl/inputlog.txt'; $mode =3D 1; $term =3D 'vt100'; # Net::Telnet object creation. my $telnet =3D new Net::Telnet ( Prompt =3D> '/\>$/', Telnetmode=3D>0, Timeout =3D> $secs); $telnet->errmode("return"); $log=3D $telnet->input_log($inputlog); $dlog=3D $telnet->dump_log($dumplog); # login $telnet->open($host); $telnet->login($user, $pass);# or die "login failed: = @{[$telnet->errmsg]}"; $telnet->waitfor('/\>$/'); # execute command on remote host. @output =3D $telnet->cmd( String =3D> $command, Prompt =3D> '/\>/', Timeout =3D> $secs, Cmd_remove_mode =3D> $mode ) or die "Command failed: $!"; @output =3D $telnet->waitfor('/.:\>/'); #close telnet session $telnet->close; # print STDOUT returned from remote command. print @output; foreach (@output) { print "$_\n"; } FROM THE DUMP LOG: < 0x00000: ff fd 28 =FF=FD( > 0x00000: 0d 0a .. |