Question

I'm trying to write a perl script (below) to automate an upload of source files from Windows to z/OS (aka MVS or OS/390). The put() method appears to be prefixing the remote dataset (file) name on z/OS with the userid that I have logged on with ("JCARTER"). The remote dataset name that I want to upload to is "FSI.V121P01.INSTALL", and it is a Partitioned Data Set (PDS). This prefixing of the destination dataset name with "JCARTER" causes the dataset to be not found and the put() fails. I've tried different ways of quoting the destination file name but my userid is still prepended to the file name. I've also tried using cwd() to set the cwd, using quote('SITE', 'QUOTESOVERRIDE') and quote('SITE', 'DATASETMODE'), but still no success.

Here's the script:

use strict;
use Net::FTP;

my $HostIP="xxx.xxx.xxx.xxx";
my $ftp;

$ftp = Net::FTP -> new ($HostIP) or die "Cannot connect to zOS: $@";
$ftp->login("userid","pw") or die "Cannot login.", $ftp->message;
$ftp->ascii();

#$ftp->cwd();
#$ftp->quot('SITE', 'QUO');
#$ftp->quot('SITE', 'DATAS');
print $ftp->message;
$ftp->pwd();
print $ftp->message;
$ftp->put('J:\REL122\RPS100\A2WBLIB\C\a2wversn.c', 'FSI.V121P01.INSTALL(A2WVERSN)');
print $ftp->message;
$ftp->quit;

Running the program above results in the messages below:

Representation type is Ascii NonPrint "'JCARTER.'" is working directory. JCARTER.FSI.V121P01.INSTALL(A2WVERSN) requests a nonexistent partitioned data se t. Use MKD command to create it.

When I try adding a cwd(""), to remove the current working directory, I get:

Representation type is Ascii NonPrint "'JCARTER.'" is working directory. "/" is the HFS working directory. Storing data set /FSI.V121P01.INSTALL(A2WVERSN) Open of /FSI.V121P01.INSTALL(A2WVERSN) failed.

It seems that I'm pretty close. Any suggestions ? Thanks - John

Was it helpful?

Solution

It sounds like when you connect via the FTP, the dataset it drops you in is named "JCARTER," per your username.

Have you tried cdup () to take you up out of that JCARTER named dataset? Then you may be able to cwd() into the FSI.V121P01.INSTALL PDS.

If that doesn't work, you may want to just establish the connection, run dir() and take a look at what Net::FTP returns for you. That might make things more logically navigable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top