running mainframe jobs from the pc

Michael Clingman Michael.D.Clingman at
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

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

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



# 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.
$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

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

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

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

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

# 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