running mainframe jobs from the pc

Michael Clingman Michael.D.Clingman at ssa.gov
Wed Mar 8 12:39:09 CST 2000


Our office has the capability of submitting jobs to the mainframe from the
pc.  It turns out that we have very expensive proprietary software from a
company called "Open Connect Systems" that runs the ftp server on the
mainframe.  The software allows us to "put" a jcl file into the batch
queue.  (Since the IBM mainframes are batch machines placing a jcl file in
the batch queue is the way to run a job.)

On our machines the way to do this is simply to ftp to the mainframe and
give commands like:

ftp ocs
quote site upcase no verify
put your_jcl_file sysin=a
bye

This places the jcl file in the batch queue.  Of course everything needed
by the jcl, such as the program being run and permissions to run the
program and write to output, must be set up ahead of time.  Either the
program can be uploaded by an earlier jcl statement or stored on the
mainframe.

If you are using Open Connect as your ftp server the above command might
work.  If not you could try talking with the ftp vendor and find out if a
similar command exists.

Attached is an edited perlscript that submits a jcl to the mainframe and
downloads the output file.

Michael Clingman

-----------------------------------------------------------------------

#!/usr/local/bin/perl

# perlscript to submit a jcl on the mainframe and download output file.

# this module allows reading in of passwords without echoing to screen.
use Term::ReadKey;

$cmd = "ftp -n";  # run ftp in batch mode.

print "Enter MISF password: ";
# read password so it does not echo to screen.
ReadMode('noecho');
$passwd = ReadLine(0);
print "\n";

# "ocs" is the name we use to ftp to the mainframe on our system.
# $1234 is the user id.
# archivej_ftp is a jcl file on the pc.  it compiles, links, and runs a
# fortran program already on the mainframe.
# the "sysin=a" command tells the mainframe to submit the jcl as a batch job.
$template =
"     open ocs
      user \$1234 $passwd
      quote site upcase no verify
      put archivej_ftp sysin=a
      bye
";

open(CMD, "|$cmd") || die "could not start command ($cmd).";
print CMD $template;
close(CMD);

print "JCL submitted, giving job time to run.\n";
# wait 5 minutes to give jcl time to run
sleep(5*60);

# after 5 minutes download the output file.
# in this case the name of the mainframe file is 'act.mdcl.pub.archive.act'.
$template =
"     open ocs
      user \$1234 $passwd
      cd 'act.mdcl.pub.archive'
      get act archives_new
      bye
";

open(CMD, "|$cmd") || die "could not start command ($cmd).";
print CMD $template;
close(CMD);

# check that downloaded archives file is different than prior months file
# if the new downloaded file is the same as the prior downloaded file there
# may be a problem with the mainframe run.
$check_file = `cmp archives_new archives`;
if ( "$check_file" eq "" )   # new and prior files are equivalent.
  {
  print "\n**********************WARNING************************************\n";
  print "The downloaded file archives_new matches the prior month\'s\n";
  print "  archives file.\n";
  print "The JCL batch job may not have run correctly on the MISF.\n";
  print "Do you want to continue? [n]/y: ";
  $_ = <STDIN>;
  unless ( /^[yY]/ )
    {
    print "please place the current archives file in this directory and then\n";
    die "  rerun this script\n";
    }
  }
system("cp archives_new archives") && die "cannot run system command";

# do any processing on the downloaded file here.




More information about the Baltimore-pm mailing list