File transfer from client to ftp MVS server.

hvnDMV - Nov 25, 2008 at 01:00 PM
 carmi - Nov 25, 2008 at 02:50 PM
I am performing a data transfer from a local file to host (MVS server).
Client language: VB.NET. I created object "socket" from class System.Net.Sockets.socket to connect to host and send command to host. My FTP server is MVS server. My coding performed following jobs successfully.
1) Connecting to host, 2) Sending commands PASV, TYPE and SITE to host.
My Question: How to create a remote file in host?
I cannot to create a remote file in host via sending command STOR to host by methods socket.Send() and socket.Receive(). No response was returned from host. My remote file path name is <userID>.<xxx>.<Upload>.<Test>.<RemoteFileNam>.
I appreciate all helps and suggestions to solve this problem.
Howard N

2 replies

Do you have any access to the MVS machine? in that case you can 'get' the file from the MVS without any written code/script in the PC.

Carmi Sternberg
Thank you for your reply.
Yes. I have a permission to access MVS.
My case is uploading a local file to a specific remote file in MVS.
My coding established a connection from client to host successfully. After the connection is established, I sent commands TYPE and SITE to host successfully. However I can not send command STOR from client to MVS to create a remote file. Here is my coding.

strRemoteFullFName = "MW.BARCODE.UPLOAD.TEST.D08001"
objSocketFTP.SendFTPCommand("STOR " & UCase(strRemoteFullFName))

Public Sub SendFTPCommand(ByVal pstrFTPCommand As String)
Dim byteCommand As Byte()
Dim byteLen As Integer

'Check to make sure the parameter has been supplied
If pstrFTPCommand.Length = 0 Then
Throw New Exception("You must supply a command to the SendFTPCommand")
Exit Sub

End If

byteCommand = _TEXT.Encoding.ASCII.GetBytes((pstrFTPCommand & vbCrLf).ToCharArray())
byteLen = byteCommand.Length

'Send the command(in bytes) to host. Note: Host was connected to client in earlier.
Socket.Send(byteCommand, byteLen, _SOCKETS.SocketFlags.None)

'Get message returned from host.

Catch er As Exception
Throw New Exception("Sub SendFTPCommand: error sending command to remote server.")
Exit Sub
End Try
End Sub
Thank you so much for your helps and suggestions.
Howard N.
1. Why don't yoy to upload the file directly from the MVS? usually this is the best solution.
2. Try to use the SEND command instead of the STOR
3. put the files in apostrophes SEND a.txt 'a.b.c.d'
4. if the file doesn't exist in the MVS, you should create it (again the preferred method is to start the process of uploading the file FROM the MVS and not vice versa. to create it see the DCB commands description in the following link

what is the error code you get?

Carmi Sternberg