× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,

CALL PGM(QP2SHELL) PARM('/QOpenSys/usr/bin/sftp' '-b' PUT
'/Qsys.lib/dodom1.lib/dictionary.file/dictionary.mbr'  'dictionary'
(file name at other site)   'userid@xxxxxxxxxxxx')

What do you all think?

Personally, I prefer to provide the name of a shell as the first parameter to the Qp2Shell API. That way, I can use the services that the shell provides, such as the PATH, globbing ("wildcards"), environment variables, etc. I just find it's more intuitive.

So I'd write the code like this:

CALL PGM(QP2SHELL) PARM('/QOpensys/usr/bin/-sh' '-c'
     'sftp -b /home/odom/ftpscript.sftp userid@xxxxxxxxxxx')

The first parameter to QP2SHELL is the name of an actual Unix shell. In this case, I picked the -sh shell that's invoked by default when you run QP2TERM... then I passed -c as a parameter to the shell to tell it that the next parameter (The one after the -c) is a command-line that it should run.

The final parameter, of course, is the sftp command-line that it should interpret and run.

Note that the -b parameter to sftp is for specifying a "batchfile" (or FTP script) that the sftp command should run. This is equivalent to specifying OVRDBF FILE(INPUT) TOFILE(xxx/xxx) with the native FTP client. Only difference is that it's specified as a command-line arguement instead of with an override.... oh, and that it's an IFS file.

Then in that batch file, you'd specify your PUT command. (Plus any other commands, like CD, PUT, GET, DIR, etc.)

Hope that makes sense.

I find myself wondering why you're bothering with SFTP if all you want to do is simply send a file. why not use SCP in that case? Just like SFTP, it's included with SSH, and it's quite simple to use...

CALL PGM(QP2SHELL) PARM('/QOpensys/usr/bin/-sh' '-c'
     'scp /path/to/inputfile user@host:/path/to/outputfile')

It's been around longer, and part of the SSH protocol longer, than SFTP, so finding support for this on Unix systems should be a non-issue.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.