Remote Command with Mainframe not recognized

+1 vote
asked Oct 31, 2014 by GregW (150 points)
edited Nov 3, 2014

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
answered Nov 3, 2014 by Tomas Knopp (58,890 points)
edited Nov 3, 2014

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.

commented Nov 3, 2014 by GregW (150 points)
edited Nov 3, 2014

Thanks that did it.

...