JSch SFTP是否可以支持站点命令,如lrecl或blksize [英] Can JSch SFTP support site commands like lrecl or blksize

查看:108
本文介绍了JSch SFTP是否可以支持站点命令,如lrecl或blksize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚Jsch sftp框架是否可以支持站点命令,例如 lrecl blksize mgtmclass 等从非大型机环境SFTP到大型机(zos)环境.

I'm trying to figure out whether Jsch sftp framework can support site commands like lrecl, blksize, mgtmclass and so on when trying to SFTP to a mainframe (zos) environment from a non-mainframe environment.

从目前为止我所遇到的情况来看,似乎SFTP规范不直接支持site命令,但是我不确定100%是否正确.

From what I've run across so far it would appear that SFTP specification does not directly support the site command, but I was not 100% sure if that information was accurate.

在进一步研究JSch时,似乎有一个 ChannelExec 类似乎可以远程执行命令,但是在这里是否能够满足我的需求,我也无法确定.

In researching the JSch more it appears there is a ChannelExec class that appears to be able to execute commands remotely, but whether that will meet my needs here I have not been able to determine as well.

一个专门研究大型机的同伴也告诉我,可以将某些大型机魔术与 ls/+/一起使用,但是如何将其潜在地应用于任何类因为Java并不是他的专业领域,所以JSch可以提供的知识已经超出了他的范围.

I've also been told by a peer who specializes in mainframe that there is the ability to use some mainframe magic with ls /+/ but how that potentially could be applied to any of the classes available in JSch is beyond him since Java is not his area of expertise.

这里的任何帮助将不胜感激.

Any help here would be greatly appreciated.

推荐答案

我部分地打算回答我自己不希望做的问题.经过大量搜索,我遇到了一段正是我所需要的代码.

I am in part going to answer my own question which I was not expecting to do. I ran across, after lots of searching, a piece of code that is exactly what I needed.

因此,这利用了我的同辈正在谈论的大型机魔术来使用 ls 命令传递站点命令.

So this uses that mainframe magic my peer was talking about to pass the site commands using the ls command.

我只是摘录了一个小片段,以显示我在这里要完成的工作:

I am just taking a small excerpt that shows what I was trying to accomplish here:

String lrecl = "/+/lrecl=128"
JSch jsch = new JSch();
Session session = jsch.getSession(user, hostName, port);
session.setPassword(password);
session.connect(120000);
ChannelSftp channel = (ChannelSftp)session.openChannel("sftp");
channel.connect(100000);
channel.ls(lrecl);

这只是代码的一部分,但确实显示了如何传递站点命令.我还不确定是否可以通过这种方式发送所有站点命令.

This was only part of the code but does show how a site command can be passed. I have not confirmed if all site commands can be sent this way or not.

希望这有助于或为某人节省一些时间.

Hope this helps or saves someone some time.

有关此方法的任何反馈或想法,请让我知道.

Any feed back or thoughts on this approach please let me know.

这篇关于JSch SFTP是否可以支持站点命令,如lrecl或blksize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆