views:

535

answers:

3

Hello, I am trying to upload a file from my pc to mainframes. I am trying to upload it using Chilkat FTP2. Below is the code.

The file I am trying to upload is 2009102600000

Dim ftp As New Chilkat.Ftp2()

Dim success As Boolean

' Any string unlocks the component for the 1st 30-days.'
success = ftp.UnlockComponent("Anything for 30-day trial")
If (success <> true) Then
    MsgBox(ftp.LastErrorText)
    Exit Sub
End If


ftp.Hostname = "www.myside.com"
ftp.Username = "****"
ftp.Password = "****"

' The default data transfer mode is "Active" as opposed to "Passive".'
' Change it to Passive by setting the Passive property:'
ftp.Passive = true

' Connect and login to the FTP server.'
success = ftp.Connect()
If (success <> true) Then
    MsgBox(ftp.LastErrorText)
    Exit Sub
End If


' Change to the remote directory where the file will be uploaded.'
success = ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
If (success <> true) Then
    MsgBox(ftp.LastErrorText)
    Exit Sub
End If


' Upload a file.'
Dim localFilename As String
localFilename = "c:\2009102600000"
Dim remoteFilename As String
remoteFilename = "2009102600000"

success = ftp.PutFile(localFilename,remoteFilename)
If (success <> true) Then
    MsgBox(ftp.LastErrorText)
    Exit Sub
End If


ftp.Disconnect()

MsgBox("File Uploaded!")

The error I am getting is dataset not found use MVS dsn name or something like that.

I would really appreciate if you can help me out with this one please.

+2  A: 

I'm not at all sure you can treat data set prefixes as directories. When I'm doing uploads to the mainframe with ftp, I always just specify the full target name. I would get rid of the

ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")

section altogether and just change:

remoteFilename = "2009102600000"

to:

remoteFilename = "'ABC.SITEUPLOAD.UPLOAD.2009102600000'"

if it's a sequesntial data set, or:

remoteFilename = "'ABC.SITEUPLOAD.UPLOAD(2009102600000)'"

if it's a member (in which case the data set will have to exist first).

It would also help if you changed the MsgBox statements so that they included an indication as to what is actually causing the error. Something along the lines of:

MsgBox("Connect error: " & ftp.LastErrorText)
MsgBox("ChangeRemoteDir error: " & ftp.LastErrorText)
MsgBox("PutFile error: " & ftp.LastErrorText)

instead of the generic:

MsgBox(ftp.LastErrorText)

One other point: you'll notice I've put single quotes around the targets above. That's because z/OS has a habit of (sometimes) prefixing your login name to members. It may be that:

put xyz.txt upload(xyz)

is actually trying to put it into yourname.upload(xyz). Quoting it will prevent that.

Update: You know, I just noticed something that totally escaped me the first time I read this question. The error message spells it out plainly.

Data set name segments and member names within partitioned data sets are limited to 8 characters. Hence your 'ABC.SITEUPLOAD.UPLOAD(2009102600000)' is invalid on two counts, the SITEUPLOAD and the 2009102600000. Try shortening the names and re-transferring.

Here's the proof:

C:\Documents and Settings\Pax> ftp bigiron
Connected to bigiron.box.com.
220-FTPD1 IBM FTP CS V1R9 at BIGIRON.BOX.COM, 02:15:23 on 2009-11-06.
220 Connection will close if idle for more than 5 minutes.
User (bigiron.box.com:(none)): pax
331 Send password please.
Password:
230 PAX is logged on.  Working directory is "PAX.".

ftp> put test.txt 'pax.siteupload'
200 Port request OK.
501 Invalid data set name "'pax.siteupload'".  Use MVS Dsname conventions.

ftp> put test.txt 'pax.siteupld'
200 Port request OK.
125 Storing data set PAX.SITEUPLD
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.

ftp> put test.txt 'pax.jcl(abcdefghi)'
200 Port request OK.
501 Invalid data set name "'pax.jcl(abcdefghi)'".  Use MVS Dsname conventions.

ftp> put test.txt 'pax.jcl(abcdefgh)'
200 Port request OK.
125 Storing data set PAX.JCL(ABCDEFGH)
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.

ftp> bye
221 Quit command received. Goodbye.
paxdiablo
Paxdiablo,Thanks for your kind response. But I tried all the options you mentioned But I still get the same error. I am able to download the file but not upload. Please helo
acadia
@acadia, a few questions (1) is it a sequentail dataset or a member of a PDS(E)? (2) can your log onto the box and use ISPF to get information on that member - use option 3.4 DSLIST with the 'i' line command? (3) When logged onto ISPF can you edit that member (maybe there's a RACF issue)? (4) Which error did you get, connect, chdir or put?
paxdiablo
(5) Show the *exact* error message you're getting. If I can't help you with that information, you'll probably need to turn to your sysprogs - they will be able to determine what you're doing from the system logs on the big iron.
paxdiablo
A: 

Paxdiablo, Sorry for the delay in responding.

I am still not able to fix the issue. Below is the error I am getting

STOR failed Filename: 'ABC.SITEUPLOAD.UPLOAD(1250178379029)' FtpResponse24: 501 Invalid data set name "'ABC.SITEUPLOAD.UPLOAD(1250178379029)'". Use MVS Dsname conventions. Failed.

acadia
A: 

Are you sure you don't need to store it as a generational dataset from the root directory? Like this:

'ABC.SITEUPLOAD.UPLOAD.2009102600000(+1)'
Jason