+1 vote
by (150 points)
edited

I am trying to upload a file to a mainframe and allocate the dataset first executing a remote command: ls /+recfm=vb,lrecl=124,blksize=0,space=cyl.25.10

A straight ls / command works and pulls the directory contents of where I login, so I know that the remote command is being sent.

The response I get from the mainframe is:
ls: FSUM6785 File or directory "/+recfm=vb,lrecl=124,blksize=0,space=cyl.25.10" is not found

Any assistance is greatly appreciated.

Code is below.

Try channel = sftp.Session.OpenSession() channel.RequestExec(RemoteCommand) ''# receive all response Dim response As New StringBuilder() Dim buffer As Byte() = New Byte(4095) {} While channel.State = SshChannelState.Connected If Not channel.Poll(sftp.Timeout * 1000, SocketSelectMode.SelectRead) Then Exit While End If

Dim n As Integer = channel.Receive(buffer, 0, buffer.Length) LogIt("Channel Receive: " & n, False, False, "", "") response.Append(Encoding.[Default].GetString(buffer, 0, n)) LogIt("Response: " & response.ToString, False, False, "", "") End While LogIt(response.ToString().TrimEnd(), False, False, "", "")

Catch ex As Exception LogIt("error: " & ex.Message, False, False, "", "") Finally If channel IsNot Nothing Then LogIt("Closing Channel for Remote Command", False, False, "", "") channel.Close() End If sftp.PutFile(LocalPath & LocalFileName, RemoteDir & RemoteFileName) End Try


Applies to: Rebex SFTP

1 Answer

0 votes
by (58.9k points)
edited

Hello,

please try to use our GetList method to execute the '/+recfm=vb,lrecl=124,blksize=0,space=cyl.25.10' like this:

sftp.GetList("/+recfm=vb,lrecl=124,blksize=0,space=cyl.25.10")

Please let us know whether it helped. If it still doesn't work for you, please create a log of communication and then either post the log here or mail it back to support@rebex.net for analysis.

by (150 points)
edited

Thanks that did it.

...