× 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.



We use Python with pExpect so we are using openSSH sFTP called within python.

The Python script is called from a .sh script which is shelled out from CL using QB2SHELL (see frag below).

Jerry

/* Declare variables for QP2SHELL Command */

             DCL        VAR(&CMD) TYPE(*CHAR) LEN(21) +
VALUE('/QOpenSys/usr/bin/sh')

             DCL        VAR(&PARM1) TYPE(*CHAR) LEN(10) VALUE('-c')

             DCL        VAR(&PARM2) TYPE(*CHAR) LEN(65) +
                          VALUE('/apps/sndrcv.sh')

             DCL  VAR(&NULL)   TYPE(*CHAR)   LEN(1) VALUE(X'00')

/* Declare variables for QUSRJOBI API to check qp2batch code */

             DCL        VAR(&JOBI0600) TYPE(*CHAR) LEN(200)
             DCL        VAR(&JOBILEN) TYPE(*INT) LEN(4) VALUE(200)
             DCL        VAR(&ILERC) TYPE(*INT) STG(*DEFINED) LEN(4) +
                          DEFVAR(&JOBI0600 109)

/* Null terminate parameters for QP2SHELL command */

             CHGVAR VAR(&CMD) VALUE(&CMD *TCAT &NULL)

             CHGVAR VAR(&PARM1) VALUE(&PARM1 *TCAT &NULL)

             CHGVAR VAR(&PARM2) VALUE(&PARM2 *TCAT &NULL)

/* Call main shell script

             CALL       PGM(QP2SHELL) PARM(&CMD &PARM1 &PARM2)

                                   &JOBILEN   +
                                   'JOBI0600' +
                                   '*' +
                                   ' ' )

           SNDPGMMSG MSG(%CHAR(&ILERC))

           IF         COND(%BIN(&JOBI0600 109 4) *NE 0) THEN(DO)
           CHGVAR VAR(&TMPVAR) VALUE(%BIN(&JOBI0600 109 4))
           SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
                        MSGDTA('BRKSNDRCV Error Occurred') +
MSGTYPE(*ESCAPE)
ENDDO


On 2/15/2023 8:16 AM, Sean Courtney wrote:
Hello all,


I have been following up on the posts regarding sFTP and the following was
quoted by John Yeoug :

“You could also switch to using API-style programming with, say, Python and
pysftp. That tends to be much more flexible and less brittle.”


My question.. do you have a python example using pysftp …


How are you invoking the call to your python script… are you calling it
directly via CLLE or are you running it as a service somewhere.


If you are invoking with CLLE or RPGLE then please post an example if
available.


Many thanks





Mit freundlichen Grüßen / Kind regards / Bien à vous,


Seán Courtney





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.